fix frontend
This commit is contained in:
@@ -191,6 +191,18 @@
|
||||
<slot />
|
||||
</div>
|
||||
</main>
|
||||
<!-- Notification Toast -->
|
||||
<Transition name="slide">
|
||||
<div v-if="notification.show" class="fixed bottom-4 right-4 z-50 flex items-center space-x-2 px-4 py-3 rounded-lg shadow-lg" :class="notification.type === 'success' ? 'bg-green-50 text-green-800 border border-green-200' : 'bg-red-50 text-red-800 border border-red-200'">
|
||||
<svg v-if="notification.type === 'success'" class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" />
|
||||
</svg>
|
||||
<svg v-else class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
|
||||
</svg>
|
||||
<span>{{ notification.message }}</span>
|
||||
</div>
|
||||
</Transition>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -200,7 +212,9 @@ import { useRoute, useRouter } from 'vue-router'
|
||||
import { useSettingsStore } from '../../stores/settings'
|
||||
import { useUserStore } from '../../stores/user'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { useNotification } from '../../composables/useNotification'
|
||||
|
||||
const { notification } = useNotification()
|
||||
const settings = useSettingsStore()
|
||||
const userStore = useUserStore()
|
||||
const route = useRoute()
|
||||
@@ -237,6 +251,7 @@ async function toggleLanguage() {
|
||||
locale.value = newLang
|
||||
localStorage.setItem('locale', newLang)
|
||||
} else {
|
||||
showNotification('profile.updateError', 'error');
|
||||
// В случае ошибки всё равно меняем локаль, но не сохраняем в БД
|
||||
locale.value = newLang
|
||||
localStorage.setItem('locale', newLang)
|
||||
@@ -248,3 +263,15 @@ async function toggleLanguage() {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.slide-enter-active,
|
||||
.slide-leave-active {
|
||||
transition: transform 0.3s ease, opacity 0.3s ease;
|
||||
}
|
||||
.slide-enter-from,
|
||||
.slide-leave-to {
|
||||
transform: translateX(100%);
|
||||
opacity: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user