improved progress bar design
This commit is contained in:
@@ -9,10 +9,10 @@
|
||||
width: `${(progressStore.status || 0) * 100}%`,
|
||||
}"></div>
|
||||
</div>
|
||||
<div
|
||||
class="sm-spinner"
|
||||
:style="{ opacity: `${progressStore.spinner || 0}` }">
|
||||
<div class="sm-spinner-icon"></div>
|
||||
<div class="sm-spinner">
|
||||
<div
|
||||
class="sm-spinner-icon"
|
||||
:style="{ opacity: `${progressStore.spinner || 0}` }"></div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -48,7 +48,7 @@ const progressStore = useProgressStore();
|
||||
position: fixed;
|
||||
top: 10px;
|
||||
right: 10px;
|
||||
transition: opacity 0.2s ease-in-out;
|
||||
opacity: 0.5;
|
||||
|
||||
.sm-spinner-icon {
|
||||
width: 18px;
|
||||
@@ -60,6 +60,8 @@ const progressStore = useProgressStore();
|
||||
border-left-color: #29d;
|
||||
border-radius: 50%;
|
||||
|
||||
transition: opacity 0.2s ease-in-out;
|
||||
|
||||
-webkit-animation: sm-progress-spinner 500ms linear infinite;
|
||||
animation: sm-progress-spinner 500ms linear infinite;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ import SMColumn from "./components/SMColumn.vue";
|
||||
import { PromiseDialog } from "vue3-promise-dialog";
|
||||
import { VueReCaptcha } from "vue-recaptcha-v3";
|
||||
import "./lib/prism";
|
||||
import { Vue3ProgressPlugin } from "@marcoschulte/vue3-progress";
|
||||
|
||||
const pinia = createPinia();
|
||||
pinia.use(piniaPluginPersistedstate);
|
||||
@@ -27,7 +26,6 @@ createApp(App)
|
||||
autoHideBadge: true,
|
||||
},
|
||||
})
|
||||
.use(Vue3ProgressPlugin)
|
||||
.component("SMContainer", SMContainer)
|
||||
.component("SMRow", SMRow)
|
||||
.component("SMColumn", SMColumn)
|
||||
|
||||
@@ -4,8 +4,6 @@ import { useApplicationStore } from "../store/ApplicationStore";
|
||||
import { useProgressStore } from "../store/ProgressStore";
|
||||
import { api } from "../helpers/api";
|
||||
|
||||
const progresses = [];
|
||||
|
||||
export const routes = [
|
||||
{
|
||||
path: "/",
|
||||
@@ -379,7 +377,6 @@ router.beforeEach(async (to, from, next) => {
|
||||
const applicationStore = useApplicationStore();
|
||||
const progressStore = useProgressStore();
|
||||
|
||||
// progressStore.reset();
|
||||
progressStore.start();
|
||||
|
||||
applicationStore.clearDynamicTitle();
|
||||
|
||||
@@ -21,12 +21,12 @@ export const useProgressStore = defineStore({
|
||||
|
||||
actions: {
|
||||
start() {
|
||||
if (this.queue == 0) {
|
||||
if (this.queue == 0 && this.opacity == 0) {
|
||||
this.set(0);
|
||||
|
||||
const work = () => {
|
||||
window.setTimeout(() => {
|
||||
if (this.status != null) {
|
||||
if (this.status < 1) {
|
||||
this._trickle();
|
||||
work();
|
||||
}
|
||||
@@ -43,7 +43,7 @@ export const useProgressStore = defineStore({
|
||||
this.timeoutID = window.setTimeout(() => {
|
||||
this._show();
|
||||
this.timeoutID = null;
|
||||
}, 200);
|
||||
}, 2000);
|
||||
}
|
||||
|
||||
if (this.spinner == 0) {
|
||||
@@ -55,7 +55,8 @@ export const useProgressStore = defineStore({
|
||||
},
|
||||
|
||||
set(number: number) {
|
||||
this.status = clamp(number, 0.08, 1);
|
||||
const n = clamp(number, 0.08, 1);
|
||||
this.status = n;
|
||||
},
|
||||
|
||||
finish() {
|
||||
@@ -67,21 +68,29 @@ export const useProgressStore = defineStore({
|
||||
_trickle() {
|
||||
const n = this.status;
|
||||
|
||||
if (this.queue == 0 && this.timeoutID == null) {
|
||||
this.timeoutID = window.setTimeout(() => {
|
||||
this.set(1);
|
||||
if (this.queue == 0) {
|
||||
if (this.opacity == 0 && this.timeoutID != null) {
|
||||
this._hide();
|
||||
window.clearTimeout(this.timeoutID);
|
||||
this.timeoutID = null;
|
||||
|
||||
} else if (this.timeoutID == null) {
|
||||
this.timeoutID = window.setTimeout(() => {
|
||||
this._hide();
|
||||
this.set(1);
|
||||
this.timeoutID = null;
|
||||
|
||||
this.timeoutID = window.setTimeout(() => {
|
||||
this._hide();
|
||||
this.timeoutID = null;
|
||||
|
||||
window.setTimeout(() => {
|
||||
this.status = 0;
|
||||
}, 150);
|
||||
}, 500);
|
||||
}, 500);
|
||||
}, 200);
|
||||
}
|
||||
}
|
||||
|
||||
if (n == 0) {
|
||||
this.start();
|
||||
} else if (n < 1) {
|
||||
if (n > 0 && n < 1) {
|
||||
let amount = 0;
|
||||
|
||||
if (n >= 0 && n < 0.2) {
|
||||
|
||||
Reference in New Issue
Block a user