mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-04 20:43:04 +00:00
refactor logo, bottom bar and perks.js
- add new logo - add tsconfig.json - move logo to new component - update bottombar - remove props from hotkeys and progress bar - convert perks.js -> perks.ts
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import perks from "./perks";
|
||||
import { getElem } from "./perks";
|
||||
|
||||
export default (mouseX, mouseY) => {
|
||||
const scope = perks.getElem("app", "id");
|
||||
const contextMenu = perks.getElem("context-menu", "class");
|
||||
const scope = getElem("app", "id");
|
||||
const contextMenu = getElem("context-menu", "class");
|
||||
// ? compute what is the mouse position relative to the container element (scope)
|
||||
let { left: scopeOffsetX, top: scopeOffsetY } = scope.getBoundingClientRect();
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const putCommas = (artists) => {
|
||||
const putCommas = (artists: string[]) => {
|
||||
let result = [];
|
||||
|
||||
artists.forEach((i, index, artists) => {
|
||||
@@ -24,18 +24,18 @@ function focusCurrent() {
|
||||
}
|
||||
}
|
||||
|
||||
function getElem(identifier, type) {
|
||||
function getElem(id: string, type: string) {
|
||||
switch (type) {
|
||||
case "class": {
|
||||
return document.getElementsByClassName(identifier)[0];
|
||||
return document.getElementsByClassName(id)[0];
|
||||
}
|
||||
case "id": {
|
||||
return document.getElementById(identifier);
|
||||
return document.getElementById(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function formatSeconds(seconds) {
|
||||
function formatSeconds(seconds: number) {
|
||||
// check if there are arguments
|
||||
|
||||
const date = new Date(seconds * 1000);
|
||||
@@ -75,10 +75,4 @@ function formatSeconds(seconds) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export default {
|
||||
putCommas,
|
||||
focusCurrent,
|
||||
formatSeconds,
|
||||
getElem,
|
||||
};
|
||||
export { putCommas, focusCurrent, formatSeconds, getElem };
|
||||
Reference in New Issue
Block a user