2026-08-05 14:07:42 +02:00
|
|
|
<script setup lang="ts">
|
2026-08-06 17:12:57 +03:30
|
|
|
import { useTimeoutFn } from '@vueuse/core'
|
2026-08-05 14:07:42 +02:00
|
|
|
import BaseButton from '@/components/ui/BaseButton.vue'
|
2026-08-06 17:12:57 +03:30
|
|
|
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
|
2026-08-05 14:07:42 +02:00
|
|
|
import ProfileSubpageLayout from '@/views/profile/components/ProfileSubpageLayout.vue'
|
2026-08-06 17:12:57 +03:30
|
|
|
import { useThemeStore, type ThemePreference } from '@/stores/theme'
|
|
|
|
|
import { ref } from 'vue'
|
2026-08-05 14:07:42 +02:00
|
|
|
|
2026-08-06 17:12:57 +03:30
|
|
|
const theme = useThemeStore()
|
2026-08-05 14:07:42 +02:00
|
|
|
const saved = ref(false)
|
|
|
|
|
|
2026-08-06 17:12:57 +03:30
|
|
|
const { start: hideSaved } = useTimeoutFn(() => {
|
|
|
|
|
saved.value = false
|
|
|
|
|
}, 2000)
|
|
|
|
|
|
|
|
|
|
const themeOptions: {
|
|
|
|
|
value: ThemePreference
|
|
|
|
|
label: string
|
|
|
|
|
description: string
|
|
|
|
|
icon: string
|
|
|
|
|
}[] = [
|
|
|
|
|
{
|
|
|
|
|
value: 'light',
|
|
|
|
|
label: 'روشن',
|
|
|
|
|
description: 'پسزمینه روشن و کنتراست بالا',
|
|
|
|
|
icon: 'vuesax-linear:sun-1',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
value: 'dark',
|
|
|
|
|
label: 'تاریک',
|
|
|
|
|
description: 'مناسب استفاده در شب',
|
|
|
|
|
icon: 'vuesax-linear:moon',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
value: 'system',
|
|
|
|
|
label: 'سیستم',
|
|
|
|
|
description: 'همتراز با تنظیمات دستگاه',
|
|
|
|
|
icon: 'vuesax-linear:mobile',
|
|
|
|
|
},
|
|
|
|
|
]
|
|
|
|
|
|
2026-08-05 14:07:42 +02:00
|
|
|
function save() {
|
|
|
|
|
saved.value = true
|
2026-08-06 17:12:57 +03:30
|
|
|
hideSaved()
|
2026-08-05 14:07:42 +02:00
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
2026-08-06 17:12:57 +03:30
|
|
|
<ProfileSubpageLayout title="تنظیمات نمایش" subtitle="حالت نمایش روشن، تاریک یا سیستم">
|
|
|
|
|
<div class="display-page">
|
|
|
|
|
<fieldset class="display-fieldset">
|
|
|
|
|
<legend class="display-fieldset__legend">حالت نمایش</legend>
|
2026-08-05 14:07:42 +02:00
|
|
|
|
2026-08-06 17:12:57 +03:30
|
|
|
<div class="display-grid" role="radiogroup" aria-label="حالت نمایش">
|
|
|
|
|
<button
|
|
|
|
|
v-for="option in themeOptions"
|
|
|
|
|
:key="option.value"
|
|
|
|
|
type="button"
|
|
|
|
|
class="theme-card"
|
|
|
|
|
:class="{ 'theme-card--active': theme.preference === option.value }"
|
|
|
|
|
role="radio"
|
|
|
|
|
:aria-checked="theme.preference === option.value"
|
|
|
|
|
@click="theme.preference = option.value"
|
|
|
|
|
>
|
|
|
|
|
<span class="theme-card__icon" aria-hidden="true">
|
|
|
|
|
<BasicIcon :icon="option.icon" :size="26" :stroke-width="1.5" />
|
|
|
|
|
</span>
|
|
|
|
|
<span class="theme-card__body">
|
|
|
|
|
<strong class="theme-card__label">{{ option.label }}</strong>
|
|
|
|
|
<span class="theme-card__desc">{{ option.description }}</span>
|
|
|
|
|
</span>
|
|
|
|
|
<span class="theme-card__check" aria-hidden="true">
|
|
|
|
|
<BasicIcon
|
|
|
|
|
v-if="theme.preference === option.value"
|
|
|
|
|
icon="vuesax-linear:tick-circle"
|
|
|
|
|
:size="20"
|
|
|
|
|
:stroke-width="1.75"
|
|
|
|
|
/>
|
|
|
|
|
</span>
|
|
|
|
|
</button>
|
2026-08-05 14:07:42 +02:00
|
|
|
</div>
|
|
|
|
|
</fieldset>
|
|
|
|
|
|
|
|
|
|
<BaseButton block @click="save">ذخیره تنظیمات</BaseButton>
|
|
|
|
|
<p v-if="saved" class="display-saved">تنظیمات نمایش ذخیره شد ✓</p>
|
|
|
|
|
</div>
|
|
|
|
|
</ProfileSubpageLayout>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
2026-08-06 17:12:57 +03:30
|
|
|
.display-page {
|
2026-08-05 14:07:42 +02:00
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
2026-08-06 17:12:57 +03:30
|
|
|
gap: 20px;
|
2026-08-05 14:07:42 +02:00
|
|
|
}
|
|
|
|
|
|
2026-08-06 17:12:57 +03:30
|
|
|
.display-fieldset {
|
2026-08-05 14:07:42 +02:00
|
|
|
margin: 0;
|
|
|
|
|
padding: 0;
|
|
|
|
|
border: none;
|
|
|
|
|
}
|
|
|
|
|
|
2026-08-06 17:12:57 +03:30
|
|
|
.display-fieldset__legend {
|
|
|
|
|
margin: 0 0 12px;
|
|
|
|
|
padding: 0;
|
2026-08-05 14:07:42 +02:00
|
|
|
font-size: 0.875rem;
|
2026-08-06 17:12:57 +03:30
|
|
|
font-weight: 700;
|
|
|
|
|
color: var(--color-text);
|
2026-08-05 14:07:42 +02:00
|
|
|
}
|
|
|
|
|
|
2026-08-06 17:12:57 +03:30
|
|
|
.display-grid {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
gap: 10px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.theme-card {
|
|
|
|
|
display: grid;
|
|
|
|
|
grid-template-columns: 48px 1fr 24px;
|
|
|
|
|
align-items: center;
|
|
|
|
|
gap: 12px;
|
|
|
|
|
width: 100%;
|
|
|
|
|
padding: 14px 16px;
|
|
|
|
|
border: 1px solid var(--color-border);
|
|
|
|
|
border-radius: 16px;
|
|
|
|
|
background: var(--color-elevated);
|
|
|
|
|
color: var(--color-text);
|
|
|
|
|
text-align: right;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
transition:
|
|
|
|
|
border-color 0.15s,
|
|
|
|
|
background 0.15s,
|
|
|
|
|
box-shadow 0.15s,
|
|
|
|
|
transform 0.15s;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.theme-card:hover {
|
|
|
|
|
border-color: var(--color-primary);
|
|
|
|
|
box-shadow: var(--shadow-sm);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.theme-card:active {
|
|
|
|
|
transform: scale(0.99);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.theme-card--active {
|
2026-08-05 14:07:42 +02:00
|
|
|
border-color: var(--color-primary);
|
|
|
|
|
background: var(--color-primary-soft);
|
2026-08-06 17:12:57 +03:30
|
|
|
box-shadow: 0 0 0 1px var(--color-primary);
|
2026-08-05 14:07:42 +02:00
|
|
|
}
|
|
|
|
|
|
2026-08-06 17:12:57 +03:30
|
|
|
.theme-card__icon {
|
|
|
|
|
width: 48px;
|
|
|
|
|
height: 48px;
|
|
|
|
|
border-radius: 14px;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
background: var(--color-surface);
|
|
|
|
|
color: var(--color-text-muted);
|
|
|
|
|
border: 1px solid var(--color-border);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.theme-card--active .theme-card__icon {
|
|
|
|
|
background: var(--color-primary);
|
|
|
|
|
border-color: var(--color-primary);
|
|
|
|
|
color: #fff;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.theme-card__body {
|
|
|
|
|
min-width: 0;
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
gap: 2px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.theme-card__label {
|
|
|
|
|
font-size: 0.9375rem;
|
|
|
|
|
font-weight: 700;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.theme-card__desc {
|
|
|
|
|
font-size: 0.75rem;
|
|
|
|
|
color: var(--color-text-muted);
|
|
|
|
|
line-height: 1.4;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.theme-card--active .theme-card__label {
|
|
|
|
|
color: var(--color-primary);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.theme-card__check {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
color: var(--color-primary);
|
|
|
|
|
min-height: 20px;
|
2026-08-05 14:07:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.display-saved {
|
|
|
|
|
margin: 0;
|
|
|
|
|
font-size: 0.875rem;
|
|
|
|
|
text-align: center;
|
|
|
|
|
color: var(--color-success);
|
|
|
|
|
}
|
|
|
|
|
</style>
|