Match auth screens to the in-app layout and collapse the profile hero on scroll.

Login and register no longer use a boxed splash, and the mobile profile keeps only the avatar as the green header shrinks.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-10 21:41:07 +03:30
co-authored by Cursor
parent c81db8e620
commit 20a8e2eec2
6 changed files with 309 additions and 134 deletions
+79 -1
View File
@@ -216,11 +216,89 @@ input[type='number'] {
color: var(--color-text); color: var(--color-text);
} }
.auth-page {
background: transparent;
}
.auth-top {
display: grid;
grid-template-columns: 40px 1fr 40px;
align-items: center;
gap: 4px;
padding: 8px var(--page-padding);
background: var(--color-surface);
}
.auth-top__title {
margin: 0;
text-align: center;
font-size: 1rem;
font-weight: 700;
color: var(--color-text);
}
.auth-top .icon-btn {
width: 40px;
height: 40px;
border: none;
border-radius: 12px;
background: transparent;
display: grid;
place-items: center;
cursor: pointer;
color: var(--color-text);
padding: 0;
}
.auth-body {
padding: 20px var(--page-padding) 32px;
display: flex;
flex-direction: column;
gap: 16px;
background: transparent;
}
.auth-lead {
margin: 0;
font-size: 0.875rem;
color: var(--color-text-muted);
line-height: 1.6;
}
.auth-page .card { .auth-page .card {
width: 100%;
max-width: var(--auth-form-max-width);
margin-inline: auto;
background: transparent; background: transparent;
border: none; border: none;
box-shadow: none; box-shadow: none;
padding-inline: 0; padding: 0;
}
.auth-switch {
margin: 0 auto;
width: 100%;
max-width: var(--auth-form-max-width);
text-align: center;
font-size: 0.875rem;
color: var(--color-text-muted);
}
.auth-switch a {
font-weight: 700;
color: var(--color-primary);
}
.auth-page .input,
.auth-page .job-select,
.auth-page .otp-box {
border: 1px solid #eeeef1;
border-radius: 12px;
background: var(--color-surface);
}
.auth-page .btn {
border-radius: 12px;
} }
.card + .card { .card + .card {
+5 -8
View File
@@ -48,19 +48,16 @@
} }
/* Auth pages */ /* Auth pages */
.auth-page__scroll { .auth-body {
display: flex;
flex-direction: column;
align-items: center; align-items: center;
justify-content: center; padding-block: 32px 48px;
padding-block: 48px;
} }
.auth-header, .auth-lead,
.auth-page .card, .auth-page .card,
.auth-footer { .auth-switch {
width: 100%; width: 100%;
max-width: var(--form-max-width); max-width: var(--auth-form-max-width);
} }
/* Company selection */ /* Company selection */
+12 -18
View File
@@ -72,14 +72,15 @@ async function submit() {
</script> </script>
<template> <template>
<div class="page page-shell auth-page"> <div class="page auth-page">
<AuthThemeToggle /> <header class="auth-top">
<span aria-hidden="true" />
<h1 class="auth-top__title">ورود</h1>
<AuthThemeToggle variant="inline" />
</header>
<div class="page__scroll flex flex-col justify-center py-6"> <div class="page__scroll auth-body">
<div class="auth-header"> <p class="auth-lead">برای سفارش پارچه، شماره موبایل خود را وارد کنید.</p>
<h1 class="page-title">ورود به سامانه</h1>
<p class="page-subtitle">سامانه سفارش عمده پارچه</p>
</div>
<form class="card" @submit.prevent="submit"> <form class="card" @submit.prevent="submit">
<FormErrorBanner :message="formError" /> <FormErrorBanner :message="formError" />
@@ -102,17 +103,10 @@ async function submit() {
<BaseButton block type="submit" :loading="auth.loading">دریافت کد تأیید</BaseButton> <BaseButton block type="submit" :loading="auth.loading">دریافت کد تأیید</BaseButton>
</form> </form>
<div class="mt-6 w-full max-w-[var(--form-max-width)] text-center"> <p class="auth-switch">
<p class="m-0 text-sm text-muted"> حساب کاربری ندارید؟
حساب کاربری ندارید؟ <RouterLink to="/register">ثبت‌نام کنید</RouterLink>
<RouterLink </p>
to="/register"
class="ms-1 font-bold text-primary no-underline hover:underline"
>
ثبت نام کنید
</RouterLink>
</p>
</div>
</div> </div>
</div> </div>
</template> </template>
+15 -31
View File
@@ -231,22 +231,22 @@ onMounted(() => {
</script> </script>
<template> <template>
<div class="page page-shell auth-page"> <div class="page auth-page">
<button <header class="auth-top">
type="button" <button
class="auth-back" type="button"
aria-label="بازگشت" class="icon-btn"
@click="router.push(isRegister ? '/register' : '/login')" aria-label="بازگشت"
> @click="router.push(isRegister ? '/register' : '/login')"
<IconChevronBack :size="20" /> >
</button> <IconChevronBack :size="20" />
<AuthThemeToggle /> </button>
<h1 class="auth-top__title">تأیید موبایل</h1>
<AuthThemeToggle variant="inline" />
</header>
<div class="page__scroll flex flex-col justify-center py-6"> <div class="page__scroll auth-body">
<div class="auth-header"> <p class="auth-lead">کد ارسال‌شده به {{ toPersianDigits(phone) }} را وارد کنید.</p>
<h1 class="page-title">تأیید شماره موبایل</h1>
<p class="page-subtitle">کد ارسال‌شده به {{ toPersianDigits(phone) }} را وارد کنید</p>
</div>
<form class="card" @submit.prevent="submit"> <form class="card" @submit.prevent="submit">
<FormErrorBanner :message="formError" /> <FormErrorBanner :message="formError" />
@@ -344,20 +344,4 @@ onMounted(() => {
font-size: 0.8125rem; font-size: 0.8125rem;
margin: 4px 0 0; margin: 4px 0 0;
} }
.auth-back {
position: fixed;
top: calc(12px + env(safe-area-inset-top, 0px));
inset-inline-start: 16px;
z-index: 100;
width: 40px;
height: 40px;
border: none;
background: transparent;
display: grid;
place-items: center;
cursor: pointer;
color: var(--color-text);
padding: 0;
}
</style> </style>
+151 -60
View File
@@ -1,5 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue' import { computed, ref } from 'vue'
import { onClickOutside } from '@vueuse/core'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import { useAuthStore } from '@/stores/auth' import { useAuthStore } from '@/stores/auth'
import BaseInput from '@/components/ui/BaseInput.vue' import BaseInput from '@/components/ui/BaseInput.vue'
@@ -28,9 +29,25 @@ const firstName = ref('')
const lastName = ref('') const lastName = ref('')
const phone = ref('') const phone = ref('')
const jobCategory = ref<JobCategory | ''>('') const jobCategory = ref<JobCategory | ''>('')
const jobOpen = ref(false)
const jobRoot = ref<HTMLElement | null>(null)
const fieldErrors = ref<FieldErrors>({}) const fieldErrors = ref<FieldErrors>({})
const formError = ref('') const formError = ref('')
const selectedJobLabel = computed(
() => JOB_CATEGORY_OPTIONS.find((opt) => opt.id === jobCategory.value)?.label ?? 'انتخاب کنید',
)
onClickOutside(jobRoot, () => {
jobOpen.value = false
})
function selectJob(id: JobCategory) {
jobCategory.value = id
jobOpen.value = false
clearField('jobCategory')
}
function clearField(key: string) { function clearField(key: string) {
fieldErrors.value = clearFieldError(fieldErrors.value, key) fieldErrors.value = clearFieldError(fieldErrors.value, key)
if (!hasFieldErrors(fieldErrors.value)) formError.value = '' if (!hasFieldErrors(fieldErrors.value)) formError.value = ''
@@ -83,20 +100,19 @@ async function submit() {
</script> </script>
<template> <template>
<div class="page page-shell auth-page"> <div class="page auth-page">
<button type="button" class="auth-back" aria-label="بازگشت" @click="router.push('/login')"> <header class="auth-top">
<IconChevronBack :size="20" /> <button type="button" class="icon-btn" aria-label="بازگشت" @click="router.push('/login')">
</button> <IconChevronBack :size="20" />
<AuthThemeToggle /> </button>
<h1 class="auth-top__title">ثبت‌نام</h1>
<AuthThemeToggle variant="inline" />
</header>
<div class="page__scroll flex flex-col justify-center py-6"> <div class="page__scroll auth-body">
<div class="auth-header"> <p class="auth-lead">نام، موبایل و شغل خود را وارد کنید تا حساب ساخته شود.</p>
<div class="text-5xl mb-3">🧵</div>
<h1 class="page-title">ثبت‌نام</h1>
<p class="page-subtitle">ایجاد حساب کاربری جدید</p>
</div>
<div class="card"> <form class="card" @submit.prevent="submit">
<FormErrorBanner :message="formError" /> <FormErrorBanner :message="formError" />
<BaseInput <BaseInput
@@ -124,75 +140,150 @@ async function submit() {
@update:model-value="clearField('phone')" @update:model-value="clearField('phone')"
/> />
<label class="job-label"> <div ref="jobRoot" class="job-field">
دسته‌بندی شغلی <span id="job-label" class="job-label">دسته‌بندی شغلی</span>
<select <button
v-model="jobCategory" type="button"
class="job-select" class="job-trigger"
:class="{ 'is-open': jobOpen, 'is-error': fieldErrors.jobCategory }"
aria-labelledby="job-label"
aria-haspopup="listbox"
:aria-expanded="jobOpen"
:aria-invalid="!!fieldErrors.jobCategory" :aria-invalid="!!fieldErrors.jobCategory"
@change="clearField('jobCategory')" @click="jobOpen = !jobOpen"
> >
<option disabled value="">انتخاب کنید</option> <span :class="{ 'is-placeholder': !jobCategory }">{{ selectedJobLabel }}</span>
<option v-for="opt in JOB_CATEGORY_OPTIONS" :key="opt.id" :value="opt.id"> <svg class="job-chevron" viewBox="0 0 12 12" aria-hidden="true">
{{ opt.label }} <path
</option> d="M2.5 4.5 6 8l3.5-3.5"
</select> fill="none"
stroke="currentColor"
stroke-width="1.4"
stroke-linecap="round"
/>
</svg>
</button>
<ul v-if="jobOpen" class="job-menu" role="listbox">
<li v-for="opt in JOB_CATEGORY_OPTIONS" :key="opt.id">
<button
type="button"
role="option"
class="job-option"
:class="{ 'is-active': jobCategory === opt.id }"
:aria-selected="jobCategory === opt.id"
@click="selectJob(opt.id)"
>
{{ opt.label }}
</button>
</li>
</ul>
<span v-if="fieldErrors.jobCategory" class="job-error">{{ fieldErrors.jobCategory }}</span> <span v-if="fieldErrors.jobCategory" class="job-error">{{ fieldErrors.jobCategory }}</span>
</label> </div>
<BaseButton block :loading="auth.loading" @click="submit">دریافت کد تأیید</BaseButton> <BaseButton block type="submit" :loading="auth.loading">دریافت کد تأیید</BaseButton>
</div> </form>
<div class="mt-6 w-full max-w-[var(--form-max-width)] text-center"> <p class="auth-switch">
<p class="m-0 text-sm text-muted"> قبلاً ثبت‌نام کرده‌اید؟
قبلاً ثبت‌نام کرده‌اید؟ <RouterLink to="/login">وارد شوید</RouterLink>
<RouterLink </p>
to="/login"
class="ms-1 font-bold text-primary no-underline hover:underline"
>
وارد شوید
</RouterLink>
</p>
</div>
</div> </div>
</div> </div>
</template> </template>
<style scoped> <style scoped>
.auth-back { .job-field {
position: fixed; position: relative;
top: calc(12px + env(safe-area-inset-top, 0px));
inset-inline-start: 16px;
z-index: 100;
width: 40px;
height: 40px;
border: none;
background: transparent;
display: grid;
place-items: center;
cursor: pointer;
color: var(--color-text);
padding: 0;
}
.job-label {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 6px; gap: 6px;
margin-bottom: 14px; margin-bottom: 14px;
}
.job-label {
font-size: 0.875rem; font-size: 0.875rem;
font-weight: 600; font-weight: 600;
color: var(--color-text); color: var(--color-text);
} }
.job-select { .job-trigger {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
width: 100%;
height: 48px; height: 48px;
border: 1px solid var(--color-border); padding: 0 14px;
border-radius: var(--radius-sm); border: 1px solid #eeeef1;
padding: 0 12px; border-radius: 12px;
font: inherit;
background: var(--color-surface); background: var(--color-surface);
color: var(--color-text); color: var(--color-text);
font: inherit;
font-size: 0.9375rem;
text-align: start;
cursor: pointer;
}
.job-trigger.is-open {
border-color: var(--color-primary);
}
.job-trigger.is-error {
border-color: var(--color-danger);
}
.job-trigger .is-placeholder {
color: var(--color-text-muted);
}
.job-chevron {
width: 12px;
height: 12px;
color: #9aa3af;
flex-shrink: 0;
transition: transform 0.15s;
}
.job-trigger.is-open .job-chevron {
transform: rotate(180deg);
}
.job-menu {
position: absolute;
inset-inline: 0;
top: calc(100% + 6px);
z-index: 20;
margin: 0;
padding: 6px;
list-style: none;
background: var(--color-surface);
border: 1px solid #eeeef1;
border-radius: 14px;
box-shadow: 0 8px 24px rgba(16, 24, 40, 0.08);
}
.job-option {
display: block;
width: 100%;
padding: 10px 12px;
border: none;
border-radius: 10px;
background: transparent;
color: var(--color-text);
font: inherit;
font-size: 0.9rem;
text-align: start;
cursor: pointer;
}
.job-option:hover {
background: #f4f6f5;
}
.job-option.is-active {
background: var(--color-primary-soft);
color: var(--color-primary);
font-weight: 600;
} }
.job-error { .job-error {
@@ -99,6 +99,13 @@ const unreadLabel = computed(() =>
notificationStore.unreadCount > 9 ? '9+' : String(notificationStore.unreadCount), notificationStore.unreadCount > 9 ? '9+' : String(notificationStore.unreadCount),
) )
const samplePrice = computed(() => sampleProduct.value.basePrice ?? SAMPLE_PRODUCT.basePrice ?? 0) const samplePrice = computed(() => sampleProduct.value.basePrice ?? SAMPLE_PRODUCT.basePrice ?? 0)
const collapse = ref(0)
const COLLAPSE_DISTANCE = 160
function onProfileScroll(event: Event) {
const top = (event.target as HTMLElement).scrollTop
collapse.value = Math.min(1, Math.max(0, top / COLLAPSE_DISTANCE))
}
onMounted(async () => { onMounted(async () => {
loading.value = true loading.value = true
@@ -127,7 +134,7 @@ onMounted(async () => {
<template> <template>
<div class="page profile-page"> <div class="page profile-page">
<header class="hero"> <header class="hero" :class="{ 'is-collapsed': collapse > 0.85 }" :style="{ '--c': String(collapse) }">
<div class="hero__top"> <div class="hero__top">
<button <button
type="button" type="button"
@@ -161,20 +168,25 @@ onMounted(async () => {
:initials="displayName.charAt(0)" :initials="displayName.charAt(0)"
:size="84" :size="84"
/> />
<h2>{{ displayName }}</h2> <div class="hero__meta">
<p>کد واسطه: {{ code }}</p> <h2>{{ displayName }}</h2>
<span class="level-pill"> <p>کد واسطه: {{ code }}</p>
<svg class="level-pill__crown" viewBox="0 0 24 24" aria-hidden="true"> <span class="level-pill">
<path <svg class="level-pill__crown" viewBox="0 0 24 24" aria-hidden="true">
fill="currentColor" <path
d="M3.5 17.5h17l-1.2-8.2a1 1 0 0 0-1.5-.7L14 11l-2.5-5.2a1 1 0 0 0-1.8 0L7.2 11 4.2 8.6a1 1 0 0 0-1.5.7L3.5 17.5Zm1.7 1.5h13.6v1.2H5.2V19Z" fill="currentColor"
/> d="M3.5 17.5h17l-1.2-8.2a1 1 0 0 0-1.5-.7L14 11l-2.5-5.2a1 1 0 0 0-1.8 0L7.2 11 4.2 8.6a1 1 0 0 0-1.5.7L3.5 17.5Zm1.7 1.5h13.6v1.2H5.2V19Z"
</svg> />
سطح: {{ levelLabel }} </svg>
</span> سطح: {{ levelLabel }}
</span>
</div>
</header> </header>
<div class="page__scroll page__scroll--with-nav profile-scroll"> <div
class="page__scroll page__scroll--with-nav profile-scroll"
@scroll.passive="onProfileScroll"
>
<PageSkeleton v-if="loading" variant="profile" /> <PageSkeleton v-if="loading" variant="profile" />
<template v-else> <template v-else>
<section class="panel"> <section class="panel">
@@ -330,13 +342,15 @@ onMounted(async () => {
} }
.hero { .hero {
--c: 0;
flex-shrink: 0;
background: linear-gradient( background: linear-gradient(
145deg, 145deg,
var(--color-primary) 0%, var(--color-primary) 0%,
color-mix(in srgb, var(--color-primary) 78%, #0a1f18) 100% color-mix(in srgb, var(--color-primary) 78%, #0a1f18) 100%
); );
color: #fff; color: #fff;
padding: 12px var(--page-padding) 44px; padding: 12px var(--page-padding) calc(44px - var(--c) * 34px);
text-align: center; text-align: center;
} }
@@ -344,13 +358,14 @@ onMounted(async () => {
display: grid; display: grid;
grid-template-columns: 40px 1fr 40px; grid-template-columns: 40px 1fr 40px;
align-items: center; align-items: center;
margin-bottom: 16px; margin-bottom: calc(16px * (1 - var(--c)));
} }
.hero__top h1 { .hero__top h1 {
margin: 0; margin: 0;
font-size: 1rem; font-size: 1rem;
font-weight: 700; font-weight: 700;
opacity: calc(1 - var(--c));
} }
.icon-btn { .icon-btn {
@@ -382,9 +397,23 @@ onMounted(async () => {
} }
.hero__avatar { .hero__avatar {
margin: 0 auto 12px; margin: 0 auto calc(12px * (1 - var(--c)));
border: 3px solid rgba(255, 255, 255, 0.35); border: 3px solid rgba(255, 255, 255, 0.35);
color: #fff; color: #fff;
transform: scale(calc(1 - var(--c) * 0.18));
transform-origin: center top;
}
.hero__meta {
overflow: hidden;
max-height: calc((1 - var(--c)) * 130px);
opacity: calc(1 - var(--c));
transform: translateY(calc(var(--c) * -12px));
pointer-events: none;
}
.hero.is-collapsed .hero__meta {
visibility: hidden;
} }
.hero h2 { .hero h2 {
@@ -420,6 +449,8 @@ onMounted(async () => {
.profile-scroll { .profile-scroll {
position: relative; position: relative;
z-index: 1; z-index: 1;
flex: 1;
min-height: 0;
margin-top: -24px; margin-top: -24px;
padding: 20px var(--page-padding) 24px; padding: 20px var(--page-padding) 24px;
display: flex; display: flex;