From 29f77da7b876a006bc421d75fdb5ec7913e330e4 Mon Sep 17 00:00:00 2001 From: Mraveux Date: Sat, 12 Oct 2024 17:36:54 +0200 Subject: [PATCH 1/5] PrestakingWelcome: implement designer feedback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The prestaking welcome page now behave like an “instagram story” or something the like. --- src/components/StepProgressBar.vue | 36 +- .../prestaking/PrestakingWelcomePage.vue | 751 ++++++++++++------ types/images.d.ts | 4 + 3 files changed, 543 insertions(+), 248 deletions(-) create mode 100644 types/images.d.ts diff --git a/src/components/StepProgressBar.vue b/src/components/StepProgressBar.vue index 85aacd8be..b05519945 100644 --- a/src/components/StepProgressBar.vue +++ b/src/components/StepProgressBar.vue @@ -22,26 +22,26 @@ export default defineComponent({ type: Number, required: true, }, + shouldAnimate: { + type: Boolean, + default: true, + }, }, - setup(props) { - const animationProgress = ref(0); + setup(props, { emit }) { + const animationProgress = ref(100); // Start with full progress const isFirstStepAnimated = ref(false); - const ANIMATION_DURATION = 1500; // 1500ms = 1.5s + const ANIMATION_DURATION = 5000; // 5000ms = 5s (adjust as needed) const getFillWidth = computed(() => (step: number) => { if (props.currentStep > step) return '100%'; if (props.currentStep === step) { - // Apply easing function to the animation progress - const easedProgress = easeOutCubic(animationProgress.value / 100) * 100; - return `${easedProgress}%`; + return props.shouldAnimate ? `${animationProgress.value}%` : '100%'; } return '0%'; }); - // Easing function: easeOutCubic - const easeOutCubic = (t: number): number => 1 - (1 - t) ** 3; - let animationFrame: number; + let animationStartTime: number | null = null; const animateStep = (timestamp: number) => { if (!animationStartTime) { @@ -51,26 +51,30 @@ export default defineComponent({ const progress = Math.min(elapsed / ANIMATION_DURATION, 1); animationProgress.value = progress * 100; - if (progress < 1) { + if (progress < 1 && props.shouldAnimate) { animationFrame = requestAnimationFrame(animateStep); } else { isFirstStepAnimated.value = true; + emit('stepCompleted'); } }; - let animationStartTime: number | null = null; - const startAnimation = () => { - animationStartTime = null; - cancelAnimationFrame(animationFrame); - animationFrame = requestAnimationFrame(animateStep); + if (props.shouldAnimate) { + animationStartTime = null; + cancelAnimationFrame(animationFrame); + animationProgress.value = 0; // Reset progress before starting animation + animationFrame = requestAnimationFrame(animateStep); + } else { + animationProgress.value = 100; // Set to full progress immediately + } }; watch(() => props.currentStep, (newStep, oldStep) => { if (newStep > oldStep || (newStep === 1 && !isFirstStepAnimated.value)) { startAnimation(); } else if (newStep < oldStep) { - animationProgress.value = 0; + animationProgress.value = 100; // Set to full progress when going back } }); diff --git a/src/components/prestaking/PrestakingWelcomePage.vue b/src/components/prestaking/PrestakingWelcomePage.vue index 037ebd669..304bfc8f3 100644 --- a/src/components/prestaking/PrestakingWelcomePage.vue +++ b/src/components/prestaking/PrestakingWelcomePage.vue @@ -1,132 +1,290 @@ diff --git a/types/images.d.ts b/types/images.d.ts new file mode 100644 index 000000000..36ea77aff --- /dev/null +++ b/types/images.d.ts @@ -0,0 +1,4 @@ +declare module '*.png' { + const value: string; + export default value; +} From ffa6208f65f312b6fee4a4fd582fad5c3da5e1b5 Mon Sep 17 00:00:00 2001 From: Mraveux Date: Fri, 18 Oct 2024 18:17:50 +0200 Subject: [PATCH 2/5] =?UTF-8?q?make=20disabled=20=E2=80=9Clet=E2=80=99s=20?= =?UTF-8?q?go=E2=80=9D=20button=20stand=20out=20more?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/prestaking/PrestakingWelcomePage.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/prestaking/PrestakingWelcomePage.vue b/src/components/prestaking/PrestakingWelcomePage.vue index 304bfc8f3..06ab14b8a 100644 --- a/src/components/prestaking/PrestakingWelcomePage.vue +++ b/src/components/prestaking/PrestakingWelcomePage.vue @@ -344,8 +344,8 @@ export default defineComponent({ transition: opacity 0.3s ease, background-color 0.3s ease, color 0.3s ease; &.disabled { - color: rgba(255, 255, 255, 0.7); - background-color: rgba(31, 35, 72, 0.5); + color: white; + background-color: rgba(255, 255, 255, 0.1); opacity: 0.6; cursor: not-allowed; pointer-events: none; From d7e301a402e38dd38abb7a64f122f98bcdded09d Mon Sep 17 00:00:00 2001 From: Mraveux Date: Fri, 18 Oct 2024 18:51:47 +0200 Subject: [PATCH 3/5] StepProgressBar: allow to pause the progress bar --- src/components/StepProgressBar.vue | 54 +++++++++++++++++++++--------- 1 file changed, 39 insertions(+), 15 deletions(-) diff --git a/src/components/StepProgressBar.vue b/src/components/StepProgressBar.vue index b05519945..b554676fd 100644 --- a/src/components/StepProgressBar.vue +++ b/src/components/StepProgressBar.vue @@ -14,7 +14,7 @@