diff --git a/app/components/progress-bar.hbs b/app/components/progress-bar.hbs index 545af820..b1635148 100644 --- a/app/components/progress-bar.hbs +++ b/app/components/progress-bar.hbs @@ -1,4 +1,4 @@ -
+
{{#if this.isEditable}} - {{@value}} + {{@value}} {{else}} { - if (this.isEditable && Date.now() - this.lastEditTime >= 5000) { + const timeDelta = Date.now() - this.lastEditedTime; + if (this.isEditable && timeDelta >= 5000) { this.isEditable = false; } else if (this.isEditable) { this.setEditableToFalse(); diff --git a/app/styles/progress-bar.css b/app/styles/progress-bar.css index 00ce3fd7..294f8732 100644 --- a/app/styles/progress-bar.css +++ b/app/styles/progress-bar.css @@ -1,29 +1,36 @@ :root { --progress-bar-color: rgba(0, 128, 0, 0.9); - --light-grey:rgba(128, 128, 128, 0.5); + --light-grey: rgba(128, 128, 128, 0.5); --black: black; --white: white; } -.progress-bar-container { +.progress-bar { display: flex; + flex-direction: row; gap: 4px; } .progress-bar__button { - width: 1.4rem; + width: 1.5rem; height: 1.1rem; - font-size: 60%; - font-weight: bolder; - text-justify: auto; border: 2px solid var(--black); border-radius: 4px; background-color: transparent; + display: flex; + align-items: center; + justify-items: center; +} + +.progress-bar__button__text { + font-size: 0.6em; + font-weight: bolder; + margin: auto; } -.progress-bar__edit-icon { - width: 95%; - height: 95%; - margin-bottom: 2px; +.progress-bar__button__edit-icon { + width: 1rem; + height: 1rem; + margin: 3px; } .progress-bar__input-slider { -webkit-appearance: none; @@ -36,6 +43,7 @@ border: 2px solid var(--black); border-radius: 4px; } + .progress-bar__input-slider:focus { box-shadow: 0 0 0 1px var(--progress-bar-color); } @@ -65,10 +73,10 @@ ); } -.progress-bar__edit-hover:hover { +.progress-bar__button--hover:hover { background-color: var(--light-grey); } -.progress-bar__edit-icon-path-inner { +.progress-bar__button__edit-icon__inner { fill: var(--progress-bar-color); } diff --git a/app/utils/debounce.js b/app/utils/debounce.js new file mode 100644 index 00000000..1a2dcb9b --- /dev/null +++ b/app/utils/debounce.js @@ -0,0 +1,10 @@ +export const debounce = (func, delay) => { + let timerId; + + return (...args) => { + clearTimeout(timerId); + timerId = setTimeout(() => { + func.apply(this, args); + }, delay); + }; +}; diff --git a/package.json b/package.json index 828f7ecb..b1a70313 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,6 @@ "ember-cli-qrcode": "^2.1.0", "ember-click-outside": "^5.0.1", "ember-resources": "^5.6.0", - "lodash": "^4.17.21", "mixpanel-browser": "^2.43.0", "webpack": "^5.74.0", "webpack-5": "^0.0.0"