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:
geoffrey45
2022-05-24 15:55:26 +03:00
parent 599ba060b2
commit b497344521
24 changed files with 129 additions and 246 deletions
+3 -3
View File
@@ -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 };