From cd2f62c89d5acfe03d08df13d6c93a3abe41fe6d Mon Sep 17 00:00:00 2001
From: "google-labs-jules[bot]"
<161369871+google-labs-jules[bot]@users.noreply.github.com>
Date: Sat, 31 May 2025 08:31:45 +0000
Subject: [PATCH] feat: Add configurable transition speed for route animations
This commit introduces a new feature allowing you to control the speed
of route transitions.
Changes include:
- Added `transitionSpeed` state (defaulting to 1 for normal) and a
`setTransitionSpeed` action to `ui/src/stores/useUi.js`. The speed
is a multiplier for the base transition duration.
- `transitionSpeed` is now persisted to local storage.
- Modified `ui/src/App.vue` to dynamically calculate and apply the
transition duration using a CSS variable (`--current-transition-duration`)
based on the `transitionSpeed` from the store. The base duration for
normal speed is 0.3s.
- Added a new "Animation Speed" setting in `ui/src/views/SettingsView.vue`
with options (Slow, Normal, Fast) using radio buttons. This control
updates the `transitionSpeed` in the UI store.
This allows you to customize the feel of the application's navigation
transitions to your preference.
---
ui/src/App.vue | 15 ++++++++++++---
ui/src/stores/useUi.js | 10 +++++++++-
ui/src/views/SettingsView.vue | 26 ++++++++++++++++++++++++++
3 files changed, 47 insertions(+), 4 deletions(-)
diff --git a/ui/src/App.vue b/ui/src/App.vue
index 296e375..cbecb93 100644
--- a/ui/src/App.vue
+++ b/ui/src/App.vue
@@ -1,5 +1,5 @@
@@ -59,7 +68,7 @@ watchEffect(() => {
// The global style.css will handle base background and text color via body styling
// but we can keep specific overrides here if needed or theme classes.
// ui.theme === 'dark' ? 'bg-gray-800 text-gray-100' : 'bg-gray-100 text-gray-900'
- ]">
+ ]" :style="transitionDurationStyle"> {/* Apply style here */}
@@ -80,7 +89,7 @@ watchEffect(() => {
.slide-fade-enter-active,
.slide-fade-leave-active {
- transition: all 0.3s ease-out; /* Increased duration for a smoother slide */
+ transition: all var(--current-transition-duration) ease-out; /* Use the CSS variable */
}
.slide-fade-enter-from {
diff --git a/ui/src/stores/useUi.js b/ui/src/stores/useUi.js
index 45eb65f..bfe2f29 100644
--- a/ui/src/stores/useUi.js
+++ b/ui/src/stores/useUi.js
@@ -30,6 +30,7 @@ const appearanceSettingKeys = [
'defaultViewPlanillas',
'defaultViewAsistencias',
'defaultViewConfiguracion',
+ 'transitionSpeed',
]
const loadSettingsFromLocalStorage = () => {
@@ -104,6 +105,7 @@ export const useUi = defineStore('ui', {
'defaultViewPlanillas': 'table',
'defaultViewAsistencias': 'table',
'defaultViewConfiguracion': 'table',
+ transitionSpeed: 1, // Default to normal speed
}
const loadedSettings = loadSettingsFromLocalStorage()
@@ -237,7 +239,13 @@ export const useUi = defineStore('ui', {
setDefaultViewConfiguracion(view) {
this.defaultViewConfiguracion = view
_saveAppearanceState(this)
- }
+ },
+
+ // Action for transition speed
+ setTransitionSpeed(newSpeed) {
+ this.transitionSpeed = Number(newSpeed) // Ensure it's a number
+ _saveAppearanceState(this)
+ },
},
})
diff --git a/ui/src/views/SettingsView.vue b/ui/src/views/SettingsView.vue
index 6553161..1d1f6e2 100644
--- a/ui/src/views/SettingsView.vue
+++ b/ui/src/views/SettingsView.vue
@@ -26,6 +26,26 @@
+
+
+
+
+
+ Adjust the speed of screen transitions (applied if animations are enabled).
+