Polish Novya UI with brand colors, first-load skeletons, and session transition overlay.
Keep chat pinned to the latest message while AI thinks or streams, and align buttons/inputs with the logo teal/blue focus treatment. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -6,11 +6,12 @@ import { PROGRAM_SESSION_COUNT } from '@/data/program/sessions';
|
||||
import { getProgramProgress } from '@/services/programService';
|
||||
import { Progress } from '@/components/ui/progress';
|
||||
import { Navigate, useNavigate } from 'react-router-dom';
|
||||
import { Check, ChevronLeft, Loader2, Lock } from 'lucide-react';
|
||||
import { Check, ChevronLeft, Lock } from 'lucide-react';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { StaggeredList, StaggerItem, AnimationWrapper } from '@/components/motion';
|
||||
import { motion } from 'framer-motion';
|
||||
import { fastTransition } from '@/lib/motion';
|
||||
import { CourseStatusSkeleton } from '@/components/skeletons';
|
||||
|
||||
type StepState = 'open' | 'locked' | 'done';
|
||||
|
||||
@@ -19,17 +20,14 @@ type StepState = 'open' | 'locked' | 'done';
|
||||
* Journey status only — no settings, scores, or assessment results.
|
||||
*/
|
||||
export default function AccountPage() {
|
||||
const { effectiveUserId, isGuest, guestSessionHydrated } = useAuth();
|
||||
const { effectiveUserId, isGuest, guestSessionHydrated, user } = useAuth();
|
||||
const { progress, loading, permissions } = useLearningJourney(effectiveUserId ?? undefined);
|
||||
const { currentSession, isProgramComplete, programProgress } = useCurrentSession(effectiveUserId);
|
||||
const navigate = useNavigate();
|
||||
const usernameLabel = isGuest ? 'مهمان' : user?.email?.trim() || null;
|
||||
|
||||
if (!guestSessionHydrated || loading) {
|
||||
return (
|
||||
<div className="flex min-h-[50vh] items-center justify-center">
|
||||
<Loader2 className="h-8 w-8 animate-spin text-neon-cyan" />
|
||||
</div>
|
||||
);
|
||||
return <CourseStatusSkeleton />;
|
||||
}
|
||||
|
||||
if (!effectiveUserId) {
|
||||
@@ -48,6 +46,10 @@ export default function AccountPage() {
|
||||
: Math.round((completedSessions / PROGRAM_SESSION_COUNT) * 100);
|
||||
|
||||
const preDone = Boolean(progress?.pre_test_completed_at);
|
||||
const reachedFinalSession =
|
||||
Boolean(progress?.training_completed_at) ||
|
||||
completedSessions >= PROGRAM_SESSION_COUNT - 1 ||
|
||||
programDone;
|
||||
const trainingDone = Boolean(progress?.training_completed_at) || programDone;
|
||||
const postDone = Boolean(progress?.post_test_completed_at);
|
||||
|
||||
@@ -63,16 +65,23 @@ export default function AccountPage() {
|
||||
: 'open';
|
||||
const postState: StepState = postDone
|
||||
? 'done'
|
||||
: permissions.canTakePostTest || (trainingDone && preDone && !postDone)
|
||||
: permissions.canTakePostTest || (reachedFinalSession && preDone && !postDone)
|
||||
? 'open'
|
||||
: 'locked';
|
||||
|
||||
return (
|
||||
<div className="h-full min-h-0 flex-1 overflow-y-auto px-4 py-6">
|
||||
<div className="h-full min-h-0 flex-1 overflow-y-auto bg-slate-50 px-4 py-6 transition-colors duration-300 dark:bg-slate-900">
|
||||
<div className="mx-auto w-full max-w-md space-y-4">
|
||||
<AnimationWrapper immediate className="space-y-1 pb-2">
|
||||
<h1 className="text-2xl font-bold tracking-tight text-foreground">وضعیت دوره</h1>
|
||||
{isGuest && <p className="text-sm text-body">جلسه مهمان</p>}
|
||||
{usernameLabel && (
|
||||
<p className="text-sm text-body">
|
||||
نام کاربری:{' '}
|
||||
<span className="font-medium text-foreground" dir="ltr">
|
||||
{usernameLabel}
|
||||
</span>
|
||||
</p>
|
||||
)}
|
||||
</AnimationWrapper>
|
||||
|
||||
<StaggeredList itemCount={3} className="space-y-3" role="region" aria-label="وضعیت دوره">
|
||||
@@ -114,7 +123,7 @@ export default function AccountPage() {
|
||||
</p>
|
||||
<div className="flex items-center gap-3">
|
||||
<Progress value={progressPercent} className="h-2.5 flex-1" />
|
||||
<span className="min-w-[2.5rem] text-left text-sm tabular-nums text-body">
|
||||
<span className="min-w-[2.75rem] text-left text-sm font-semibold tabular-nums text-foreground">
|
||||
{progressPercent}٪
|
||||
</span>
|
||||
</div>
|
||||
@@ -131,14 +140,14 @@ export default function AccountPage() {
|
||||
lockedHint={
|
||||
postDone
|
||||
? 'انجام شده — قابل تکرار نیست'
|
||||
: 'پس از پایان دوره آموزشی فعال میشود'
|
||||
: 'پس از رسیدن به جلسه پایانی فعال میشود'
|
||||
}
|
||||
>
|
||||
{postState === 'done' && <StatusDone label="انجام شده" />}
|
||||
{postState === 'open' && (
|
||||
<p className="flex items-center gap-2 text-sm font-medium text-foreground">
|
||||
<span
|
||||
className="inline-block h-2 w-2 shrink-0 rounded-full bg-neon-teal shadow-[0_0_8px_rgba(52,184,150,0.7)]"
|
||||
className="inline-block h-2 w-2 shrink-0 rounded-full bg-teal-500 dark:bg-teal-400"
|
||||
aria-hidden
|
||||
/>
|
||||
آماده انجام
|
||||
@@ -147,7 +156,7 @@ export default function AccountPage() {
|
||||
{postState === 'locked' && (
|
||||
<p className="flex items-start gap-2 text-sm text-body">
|
||||
<Lock className="mt-0.5 h-4 w-4 shrink-0 text-muted-foreground" aria-hidden />
|
||||
<span>پس از پایان دوره فعال میشود</span>
|
||||
<span>پس از رسیدن به جلسه پایانی فعال میشود</span>
|
||||
</p>
|
||||
)}
|
||||
</StatusRow>
|
||||
@@ -180,12 +189,12 @@ function StatusRow({
|
||||
{children}
|
||||
</div>
|
||||
{isInteractive ? (
|
||||
<ChevronLeft className="mt-0.5 h-5 w-5 shrink-0 text-neon-cyan" aria-hidden />
|
||||
<ChevronLeft className="mt-0.5 h-5 w-5 shrink-0 text-sky-600 dark:text-sky-400" aria-hidden />
|
||||
) : (
|
||||
<Lock
|
||||
className={cn(
|
||||
'mt-0.5 h-4 w-4 shrink-0',
|
||||
state === 'done' ? 'text-neon-emerald/70' : 'text-muted-foreground'
|
||||
state === 'done' ? 'text-emerald-600/80 dark:text-emerald-400/70' : 'text-muted-foreground'
|
||||
)}
|
||||
aria-hidden
|
||||
/>
|
||||
@@ -201,7 +210,14 @@ function StatusRow({
|
||||
whileHover={{ scale: 1.02 }}
|
||||
whileTap={{ scale: 0.98 }}
|
||||
transition={fastTransition}
|
||||
className="glass-panel w-full px-4 py-4 text-right transition-colors duration-200 hover:border-neon-cyan/55 hover:shadow-[0_0_18px_rgba(72,180,200,0.22)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-neon-cyan/50"
|
||||
className={cn(
|
||||
'status-card w-full rounded-2xl px-4 py-4 text-right transition-all duration-200',
|
||||
'border border-slate-200/90 bg-gradient-to-b from-white to-slate-50/80',
|
||||
'hover:border-sky-300/80 hover:from-white hover:to-sky-50/40',
|
||||
'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sky-400/40',
|
||||
'dark:border-slate-700/50 dark:from-slate-800/90 dark:to-slate-900/80',
|
||||
'dark:hover:border-slate-600 dark:hover:from-slate-800 dark:hover:to-slate-800/90'
|
||||
)}
|
||||
aria-label={`${title} — باز کردن`}
|
||||
>
|
||||
{content}
|
||||
@@ -211,7 +227,11 @@ function StatusRow({
|
||||
|
||||
return (
|
||||
<div
|
||||
className="glass-panel w-full px-4 py-4 opacity-90"
|
||||
className={cn(
|
||||
'status-card w-full rounded-2xl px-4 py-4 opacity-90',
|
||||
'border border-slate-200/80 bg-gradient-to-b from-white to-slate-50/70',
|
||||
'dark:border-slate-700/50 dark:from-slate-800/70 dark:to-slate-900/60'
|
||||
)}
|
||||
aria-disabled="true"
|
||||
title={lockedHint}
|
||||
>
|
||||
@@ -223,7 +243,7 @@ function StatusRow({
|
||||
function StatusDone({ label }: { label: string }) {
|
||||
return (
|
||||
<p className="flex items-center gap-2 text-sm font-medium text-foreground">
|
||||
<Check className="h-4 w-4 shrink-0 text-neon-emerald" aria-hidden />
|
||||
<Check className="h-4 w-4 shrink-0 text-emerald-600 dark:text-emerald-400" aria-hidden />
|
||||
{label}
|
||||
</p>
|
||||
);
|
||||
|
||||
@@ -13,6 +13,8 @@ import { getBackendErrorMessage, isBackendNetworkError } from '@/lib/backendErro
|
||||
import { useToast } from '@/components/ui/use-toast';
|
||||
import { PCQ24_QUESTIONS, PCQ_LIKERT_OPTIONS } from '@/config/pcq24';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { AssessmentSkeleton } from '@/components/skeletons';
|
||||
import { LoadingOverlay } from '@/components/ui/loading-overlay';
|
||||
|
||||
const FADE_MS = 220;
|
||||
|
||||
@@ -71,6 +73,10 @@ export default function AssessmentPage() {
|
||||
}
|
||||
}
|
||||
|
||||
if (loading) {
|
||||
return <AssessmentSkeleton />;
|
||||
}
|
||||
|
||||
const advanceWithFade = (delta: number) => {
|
||||
if (isAnimating || submitting || isRedirecting) return;
|
||||
setIsAnimating(true);
|
||||
@@ -229,6 +235,10 @@ export default function AssessmentPage() {
|
||||
|
||||
return (
|
||||
<div className="relative h-full min-h-0 flex-1 overflow-hidden p-4">
|
||||
<LoadingOverlay
|
||||
open={isRedirecting}
|
||||
message={successMessage ?? 'در حال انتقال…'}
|
||||
/>
|
||||
{/* Intro overlay — dark veil on text area; bottom almost visible */}
|
||||
{showIntro && (
|
||||
<div
|
||||
@@ -314,10 +324,12 @@ export default function AssessmentPage() {
|
||||
disabled={isAnimating || submitting || isRedirecting || showIntro}
|
||||
onClick={() => onSelect(currentQuestion.id, option.value)}
|
||||
className={cn(
|
||||
'flex h-11 w-full items-center justify-start rounded-xl border px-4 text-right text-sm transition-colors duration-200',
|
||||
'flex h-11 w-full items-center justify-start rounded-xl border px-4 text-right text-sm transition-all duration-200',
|
||||
'shadow-[0_2px_4px_rgba(15,23,42,0.05)] focus-visible:outline-none',
|
||||
'focus-visible:border-[#26d4ca] focus-visible:shadow-[0_0_0_1px_rgba(38,212,202,0.35),0_3px_8px_rgba(15,23,42,0.08)]',
|
||||
selected
|
||||
? 'border-cyan-500 bg-cyan-100 text-cyan-950 shadow-sm dark:border-neon-cyan dark:bg-neon-blue/25 dark:text-white dark:shadow-glow-sm'
|
||||
: 'border-slate-200 bg-white/80 text-body hover:border-cyan-400 hover:bg-white hover:text-foreground dark:border-neon-cyan/20 dark:bg-slate-900/35 dark:hover:border-neon-cyan/50 dark:hover:bg-slate-800/45 dark:hover:text-white'
|
||||
? 'border-[#26d4ca] bg-[rgb(38_212_202/0.12)] text-foreground shadow-[0_0_0_1px_rgba(38,212,202,0.25),0_3px_8px_rgba(15,23,42,0.08)] dark:border-neon-cyan dark:bg-neon-cyan/15 dark:text-white dark:shadow-glow-sm'
|
||||
: 'border-slate-200 bg-white/80 text-body hover:border-[#26d4ca]/70 hover:bg-white hover:text-foreground dark:border-neon-cyan/20 dark:bg-slate-900/35 dark:hover:border-neon-cyan/55 dark:hover:bg-slate-800/45 dark:hover:text-white'
|
||||
)}
|
||||
>
|
||||
{option.label}
|
||||
@@ -357,12 +369,6 @@ export default function AssessmentPage() {
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{successMessage && (
|
||||
<p className="shrink-0 rounded-xl border border-neon-emerald/35 bg-neon-emerald/10 px-3 py-2 text-center text-sm text-neon-teal">
|
||||
{successMessage}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -7,19 +7,20 @@ import { Label } from '@/components/ui/label';
|
||||
import { useAuth } from '@/hooks/useAuth';
|
||||
import { useTheme } from '@/hooks/useTheme';
|
||||
import { useToast } from '@/components/ui/use-toast';
|
||||
import { getBackendErrorMessage } from '@/lib/backendError';
|
||||
import { Loader2, Mail, Lock, Moon, Sun, Sparkles } from 'lucide-react';
|
||||
import { getLoginErrorMessage } from '@/lib/backendError';
|
||||
import { Loader2, Mail, Lock, Moon, Sun, Eye, EyeOff } from 'lucide-react';
|
||||
import { AnimationWrapper } from '@/components/motion';
|
||||
import { APP_NAME, APP_DESCRIPTION } from '@/utils/constants';
|
||||
import { BrandLogo } from '@/components/BrandLogo';
|
||||
|
||||
export default function LoginPage() {
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
const { signIn, isAuthenticated, continueAsGuest } = useAuth();
|
||||
const { signIn, isAuthenticated } = useAuth();
|
||||
const { toggleTheme, isDark } = useTheme();
|
||||
const { toast } = useToast();
|
||||
const [email, setEmail] = useState('');
|
||||
const [password, setPassword] = useState('');
|
||||
const [showPassword, setShowPassword] = useState(false);
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -39,10 +40,37 @@ export default function LoginPage() {
|
||||
const nextEmail = String(form.get('email') ?? email).trim();
|
||||
const nextPassword = String(form.get('password') ?? password);
|
||||
|
||||
if (!nextEmail || !nextPassword) {
|
||||
if (!nextEmail && !nextPassword) {
|
||||
toast({
|
||||
title: 'خطا',
|
||||
description: 'لطفا ایمیل و رمز عبور را وارد کنید',
|
||||
description: 'لطفاً ایمیل و رمز عبور را وارد کنید.',
|
||||
variant: 'destructive',
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (!nextEmail) {
|
||||
toast({
|
||||
title: 'خطا',
|
||||
description: 'لطفاً ایمیل خود را وارد کنید.',
|
||||
variant: 'destructive',
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (!nextPassword) {
|
||||
toast({
|
||||
title: 'خطا',
|
||||
description: 'لطفاً رمز عبور را وارد کنید.',
|
||||
variant: 'destructive',
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(nextEmail)) {
|
||||
toast({
|
||||
title: 'خطا',
|
||||
description: 'فرمت ایمیل نامعتبر است. لطفاً یک ایمیل معتبر وارد کنید.',
|
||||
variant: 'destructive',
|
||||
});
|
||||
return;
|
||||
@@ -58,8 +86,8 @@ export default function LoginPage() {
|
||||
} catch (error: unknown) {
|
||||
console.error('Login error:', error);
|
||||
toast({
|
||||
title: 'خطا',
|
||||
description: getBackendErrorMessage(error, 'خطا در ورود. لطفاً دوباره تلاش کنید.'),
|
||||
title: 'خطا در ورود',
|
||||
description: getLoginErrorMessage(error),
|
||||
variant: 'destructive',
|
||||
});
|
||||
} finally {
|
||||
@@ -67,23 +95,6 @@ export default function LoginPage() {
|
||||
}
|
||||
};
|
||||
|
||||
const handleContinueWithoutLogin = async () => {
|
||||
setIsLoading(true);
|
||||
try {
|
||||
await continueAsGuest();
|
||||
const fromState = (location.state as { from?: { pathname?: string } | string } | null)?.from;
|
||||
const from =
|
||||
typeof fromState === 'string' ? fromState : fromState?.pathname;
|
||||
const safeFrom =
|
||||
from && from !== '/login' && from !== '/signup' ? from : '/';
|
||||
navigate(safeFrom, { replace: true });
|
||||
} catch {
|
||||
toast({ title: 'خطا', description: 'خطا در ایجاد حساب مهمان', variant: 'destructive' });
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="app-auth-screen ambient-glow relative flex h-full min-h-0 items-center justify-center overflow-y-auto p-4">
|
||||
<button
|
||||
@@ -101,18 +112,12 @@ export default function LoginPage() {
|
||||
className="pointer-events-none absolute inset-x-0 top-0 h-32 bg-gradient-to-b from-neon-blue/20 via-neon-cyan/5 to-transparent"
|
||||
aria-hidden
|
||||
/>
|
||||
<CardHeader className="relative space-y-2">
|
||||
<div className="mb-2 flex justify-center">
|
||||
<div className="avatar-glow">
|
||||
<div className="flex h-14 w-14 items-center justify-center rounded-full bg-white text-cyan-700 shadow-sm dark:bg-navy dark:text-neon-cyan dark:shadow-none">
|
||||
<Sparkles className="h-7 w-7" />
|
||||
</div>
|
||||
</div>
|
||||
<CardHeader className="relative space-y-3">
|
||||
<div className="mb-1 flex justify-center">
|
||||
<BrandLogo imgClassName="h-12" />
|
||||
</div>
|
||||
<CardTitle className="text-center text-3xl font-bold tracking-tight text-foreground">{APP_NAME}</CardTitle>
|
||||
<CardDescription className="text-center text-body">
|
||||
ورود به {APP_NAME} — {APP_DESCRIPTION}
|
||||
</CardDescription>
|
||||
<CardTitle className="text-center text-2xl font-bold tracking-tight text-foreground">ورود</CardTitle>
|
||||
<CardDescription className="text-center text-body">وارد شوید</CardDescription>
|
||||
</CardHeader>
|
||||
|
||||
<CardContent className="relative space-y-4">
|
||||
@@ -145,14 +150,24 @@ export default function LoginPage() {
|
||||
<Input
|
||||
id="password"
|
||||
name="password"
|
||||
type="password"
|
||||
type={showPassword ? 'text' : 'password'}
|
||||
placeholder="••••••••"
|
||||
value={password}
|
||||
onChange={(e) => setPassword(e.target.value)}
|
||||
disabled={isLoading}
|
||||
className="pr-10"
|
||||
className="px-10"
|
||||
autoComplete="current-password"
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setShowPassword((open) => !open)}
|
||||
disabled={isLoading}
|
||||
className="absolute left-2 top-1/2 inline-flex h-8 w-8 -translate-y-1/2 items-center justify-center rounded-md text-muted-foreground transition-colors hover:text-foreground disabled:opacity-50"
|
||||
aria-label={showPassword ? 'مخفی کردن رمز عبور' : 'نمایش رمز عبور'}
|
||||
aria-pressed={showPassword}
|
||||
>
|
||||
{showPassword ? <EyeOff className="h-4 w-4" /> : <Eye className="h-4 w-4" />}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<Button type="submit" variant="neon" className="w-full" disabled={isLoading}>
|
||||
@@ -167,16 +182,6 @@ export default function LoginPage() {
|
||||
</Button>
|
||||
</form>
|
||||
|
||||
<Button
|
||||
type="button"
|
||||
variant="glass"
|
||||
className="w-full"
|
||||
onClick={handleContinueWithoutLogin}
|
||||
disabled={isLoading}
|
||||
>
|
||||
ادامه بدون ورود
|
||||
</Button>
|
||||
|
||||
<div className="text-center text-sm text-body">
|
||||
حساب کاربری ندارید؟{' '}
|
||||
<Link to="/signup" className="text-neon-cyan hover:text-neon-teal hover:underline">
|
||||
|
||||
@@ -8,8 +8,9 @@ import { useAuth } from '@/hooks/useAuth';
|
||||
import { useTheme } from '@/hooks/useTheme';
|
||||
import { useToast } from '@/components/ui/use-toast';
|
||||
import { getBackendErrorMessage } from '@/lib/backendError';
|
||||
import { Loader2, UserPlus, Moon, Sun } from 'lucide-react';
|
||||
import { Loader2, Moon, Sun, Eye, EyeOff } from 'lucide-react';
|
||||
import { APP_NAME, APP_DESCRIPTION } from '@/utils/constants';
|
||||
import { BrandLogo } from '@/components/BrandLogo';
|
||||
|
||||
export default function SignupPage() {
|
||||
const navigate = useNavigate();
|
||||
@@ -19,6 +20,8 @@ export default function SignupPage() {
|
||||
const [email, setEmail] = useState('');
|
||||
const [password, setPassword] = useState('');
|
||||
const [confirmPassword, setConfirmPassword] = useState('');
|
||||
const [showPassword, setShowPassword] = useState(false);
|
||||
const [showConfirmPassword, setShowConfirmPassword] = useState(false);
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
|
||||
const handleSignup = async (e: React.FormEvent) => {
|
||||
@@ -83,15 +86,11 @@ export default function SignupPage() {
|
||||
className="pointer-events-none absolute inset-x-0 top-0 h-32 bg-gradient-to-b from-neon-blue/20 via-neon-cyan/5 to-transparent"
|
||||
aria-hidden
|
||||
/>
|
||||
<CardHeader className="relative space-y-2">
|
||||
<div className="mb-2 flex justify-center">
|
||||
<div className="avatar-glow">
|
||||
<div className="flex h-14 w-14 items-center justify-center rounded-full bg-white text-cyan-700 shadow-sm dark:bg-navy dark:text-neon-cyan dark:shadow-none">
|
||||
<UserPlus className="h-7 w-7" />
|
||||
</div>
|
||||
</div>
|
||||
<CardHeader className="relative space-y-3">
|
||||
<div className="mb-1 flex justify-center">
|
||||
<BrandLogo imgClassName="h-12" />
|
||||
</div>
|
||||
<CardTitle className="text-center text-3xl font-bold tracking-tight text-foreground">ثبت نام</CardTitle>
|
||||
<CardTitle className="text-center text-2xl font-bold tracking-tight text-foreground">ثبت نام</CardTitle>
|
||||
<CardDescription className="text-center text-body">
|
||||
ایجاد حساب کاربری در {APP_NAME} — {APP_DESCRIPTION}
|
||||
</CardDescription>
|
||||
@@ -113,27 +112,53 @@ export default function SignupPage() {
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="password" className="text-body">رمز عبور</Label>
|
||||
<Input
|
||||
id="password"
|
||||
type="password"
|
||||
placeholder="••••••••"
|
||||
value={password}
|
||||
onChange={(e) => setPassword(e.target.value)}
|
||||
disabled={isLoading}
|
||||
autoComplete="new-password"
|
||||
/>
|
||||
<div className="relative">
|
||||
<Input
|
||||
id="password"
|
||||
type={showPassword ? 'text' : 'password'}
|
||||
placeholder="••••••••"
|
||||
value={password}
|
||||
onChange={(e) => setPassword(e.target.value)}
|
||||
disabled={isLoading}
|
||||
className="pl-10"
|
||||
autoComplete="new-password"
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setShowPassword((open) => !open)}
|
||||
disabled={isLoading}
|
||||
className="absolute left-2 top-1/2 inline-flex h-8 w-8 -translate-y-1/2 items-center justify-center rounded-md text-muted-foreground transition-colors hover:text-foreground disabled:opacity-50"
|
||||
aria-label={showPassword ? 'مخفی کردن رمز عبور' : 'نمایش رمز عبور'}
|
||||
aria-pressed={showPassword}
|
||||
>
|
||||
{showPassword ? <EyeOff className="h-4 w-4" /> : <Eye className="h-4 w-4" />}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="confirmPassword" className="text-body">تکرار رمز عبور</Label>
|
||||
<Input
|
||||
id="confirmPassword"
|
||||
type="password"
|
||||
placeholder="••••••••"
|
||||
value={confirmPassword}
|
||||
onChange={(e) => setConfirmPassword(e.target.value)}
|
||||
disabled={isLoading}
|
||||
autoComplete="new-password"
|
||||
/>
|
||||
<div className="relative">
|
||||
<Input
|
||||
id="confirmPassword"
|
||||
type={showConfirmPassword ? 'text' : 'password'}
|
||||
placeholder="••••••••"
|
||||
value={confirmPassword}
|
||||
onChange={(e) => setConfirmPassword(e.target.value)}
|
||||
disabled={isLoading}
|
||||
className="pl-10"
|
||||
autoComplete="new-password"
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setShowConfirmPassword((open) => !open)}
|
||||
disabled={isLoading}
|
||||
className="absolute left-2 top-1/2 inline-flex h-8 w-8 -translate-y-1/2 items-center justify-center rounded-md text-muted-foreground transition-colors hover:text-foreground disabled:opacity-50"
|
||||
aria-label={showConfirmPassword ? 'مخفی کردن تکرار رمز عبور' : 'نمایش تکرار رمز عبور'}
|
||||
aria-pressed={showConfirmPassword}
|
||||
>
|
||||
{showConfirmPassword ? <EyeOff className="h-4 w-4" /> : <Eye className="h-4 w-4" />}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<Button type="submit" variant="neon" className="w-full" disabled={isLoading}>
|
||||
{isLoading ? (
|
||||
|
||||
+210
-50
@@ -1,4 +1,4 @@
|
||||
import { useState, useRef, useEffect, useCallback, Fragment, type FormEvent } from 'react';
|
||||
import { useState, useRef, useEffect, useLayoutEffect, useCallback, Fragment, type FormEvent } from 'react';
|
||||
import { Navigate, useNavigate } from 'react-router-dom';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { MessageBubble } from '@/components/chat/MessageBubble';
|
||||
@@ -10,10 +10,14 @@ import { useCurrentSession } from '@/hooks/useCurrentSession';
|
||||
import { completeSessionWithBackend, getProgramProgress } from '@/services/programService';
|
||||
import { formatRemainingUnlockTime } from '@/lib/sessionUnlock';
|
||||
import { PROGRAM_SESSION_COUNT, getSessionByOrder } from '@/data/program/sessions';
|
||||
import { buildAiCoachSessionContext } from '@/lib/aiCoach/sessionContext';
|
||||
import { exampleCompletionSignal, looksLikeFinalPostTestHandoff } from '@/lib/aiCoach/sessionCompletion';
|
||||
import { useToast } from '@/components/ui/use-toast';
|
||||
import { getFetchErrorMessage } from '@/lib/fetchError';
|
||||
import { APP_NAME } from '@/utils/constants';
|
||||
import { ArrowUp, Loader2, Sparkles } from 'lucide-react';
|
||||
import { LoadingOverlay } from '@/components/ui/loading-overlay';
|
||||
import { ChatSkeleton, PageSkeleton } from '@/components/skeletons';
|
||||
|
||||
/**
|
||||
* Chat = Educational Environment.
|
||||
@@ -86,10 +90,14 @@ export default function ChatPage() {
|
||||
await refreshCurrentSession();
|
||||
await reloadProgress();
|
||||
|
||||
const isFinalSession = Boolean(updated.completedAt);
|
||||
const isFinalSession =
|
||||
payload.sessionOrder >= PROGRAM_SESSION_COUNT ||
|
||||
Boolean(updated.completedAt) ||
|
||||
updated.completedSessions.length >= PROGRAM_SESSION_COUNT;
|
||||
|
||||
if (isFinalSession) {
|
||||
await markTrainingDone();
|
||||
await reloadProgress();
|
||||
toast({
|
||||
title: 'دوره آموزشی تکمیل شد',
|
||||
description: 'پسآزمون برای شما فعال شد.',
|
||||
@@ -136,21 +144,50 @@ export default function ChatPage() {
|
||||
) {
|
||||
return;
|
||||
}
|
||||
void markTrainingDone();
|
||||
|
||||
let cancelled = false;
|
||||
void (async () => {
|
||||
try {
|
||||
const finalSession = getSessionByOrder(PROGRAM_SESSION_COUNT);
|
||||
if (finalSession) {
|
||||
const signal = exampleCompletionSignal(buildAiCoachSessionContext(finalSession));
|
||||
await completeSessionWithBackend(effectiveUserId, signal);
|
||||
}
|
||||
if (cancelled) return;
|
||||
await markTrainingDone();
|
||||
await reloadProgress();
|
||||
if (cancelled) return;
|
||||
toast({
|
||||
title: 'دوره آموزشی تکمیل شد',
|
||||
description: 'پسآزمون برای شما فعال شد.',
|
||||
});
|
||||
navigate('/assessment/post', { replace: true });
|
||||
} catch (error) {
|
||||
console.error('Failed to finalize training after program completion:', error);
|
||||
}
|
||||
})();
|
||||
|
||||
return () => {
|
||||
cancelled = true;
|
||||
};
|
||||
}, [
|
||||
effectiveUserId,
|
||||
isProgramComplete,
|
||||
markTrainingDone,
|
||||
navigate,
|
||||
progress?.post_test_completed_at,
|
||||
progress?.pre_test_completed_at,
|
||||
progress?.training_completed_at,
|
||||
progressLoading,
|
||||
reloadProgress,
|
||||
toast,
|
||||
]);
|
||||
|
||||
const {
|
||||
messages,
|
||||
loading,
|
||||
isAiThinking,
|
||||
isSessionCompletionQueued,
|
||||
isSessionTransitionPending,
|
||||
sendMessage,
|
||||
startCoachingSession,
|
||||
@@ -168,6 +205,72 @@ export default function ChatPage() {
|
||||
const currentSessionAnchorRef = useRef<HTMLDivElement>(null);
|
||||
const streamScrollRafRef = useRef<number | null>(null);
|
||||
const composerRef = useRef<HTMLTextAreaElement>(null);
|
||||
const finalHandoffRecoveryRef = useRef(false);
|
||||
|
||||
// Recover stuck final sessions: AI already handed off to post-test but completion never persisted.
|
||||
useEffect(() => {
|
||||
if (
|
||||
!effectiveUserId ||
|
||||
loading ||
|
||||
progressLoading ||
|
||||
!coachContext?.isFinalSession ||
|
||||
progress?.training_completed_at ||
|
||||
progress?.post_test_completed_at ||
|
||||
isAiThinking ||
|
||||
isSessionCompletionQueued ||
|
||||
isSessionTransitionPending ||
|
||||
finalHandoffRecoveryRef.current
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
const sessionMessages = messages.filter(
|
||||
(msg) => msg.sessionOrder === coachContext.order || msg.sessionOrder == null
|
||||
);
|
||||
const userTurns = sessionMessages.filter((msg) => msg.role === 'user').length;
|
||||
if (userTurns < 2) return;
|
||||
|
||||
const lastAssistant = [...sessionMessages].reverse().find((msg) => msg.role === 'assistant');
|
||||
if (!lastAssistant?.content || !looksLikeFinalPostTestHandoff(lastAssistant.content)) {
|
||||
return;
|
||||
}
|
||||
|
||||
finalHandoffRecoveryRef.current = true;
|
||||
let cancelled = false;
|
||||
void (async () => {
|
||||
try {
|
||||
await handleCoachSessionCompleted({
|
||||
sessionId: coachContext.sessionId,
|
||||
sessionOrder: coachContext.order,
|
||||
reason:
|
||||
'Recovered final-session handoff from existing assistant message; routing to post-test.',
|
||||
readyForNextSession: false,
|
||||
signal: exampleCompletionSignal(coachContext),
|
||||
});
|
||||
} catch (error) {
|
||||
if (!cancelled) {
|
||||
finalHandoffRecoveryRef.current = false;
|
||||
console.error('Failed to recover final-session handoff:', error);
|
||||
}
|
||||
}
|
||||
})();
|
||||
|
||||
return () => {
|
||||
cancelled = true;
|
||||
};
|
||||
}, [
|
||||
coachContext,
|
||||
effectiveUserId,
|
||||
handleCoachSessionCompleted,
|
||||
isAiThinking,
|
||||
isSessionCompletionQueued,
|
||||
isSessionTransitionPending,
|
||||
loading,
|
||||
messages,
|
||||
progress?.post_test_completed_at,
|
||||
progress?.training_completed_at,
|
||||
progressLoading,
|
||||
]);
|
||||
|
||||
const resizeComposer = useCallback(() => {
|
||||
const el = composerRef.current;
|
||||
@@ -182,57 +285,88 @@ export default function ChatPage() {
|
||||
el.style.height = `${next}px`;
|
||||
}, []);
|
||||
|
||||
const scrollToBottom = useCallback(() => {
|
||||
const scrollToBottom = useCallback((behavior: ScrollBehavior = 'auto') => {
|
||||
const scroller = messagesScrollRef.current;
|
||||
if (!scroller) return;
|
||||
scroller.scrollTop = scroller.scrollHeight;
|
||||
const end = messagesEndRef.current;
|
||||
if (end) {
|
||||
end.scrollIntoView({ behavior, block: 'end' });
|
||||
}
|
||||
if (scroller) {
|
||||
scroller.scrollTop = scroller.scrollHeight;
|
||||
}
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (loading || isSessionTransitionPending) return;
|
||||
// On enter / session change: jump to the latest message.
|
||||
let cancelled = false;
|
||||
const frame = window.requestAnimationFrame(() => {
|
||||
window.requestAnimationFrame(() => {
|
||||
if (!cancelled) scrollToBottom();
|
||||
});
|
||||
});
|
||||
return () => {
|
||||
cancelled = true;
|
||||
window.cancelAnimationFrame(frame);
|
||||
};
|
||||
}, [loading, coachContext?.order, messages.length, scrollToBottom, isSessionTransitionPending]);
|
||||
const isStreamOrThinking =
|
||||
isAiThinking || messages.some((msg) => msg.status === 'streaming');
|
||||
|
||||
// Entering chat / session change / new messages: pin to latest.
|
||||
useLayoutEffect(() => {
|
||||
if (loading && messages.length === 0) return;
|
||||
if (isSessionTransitionPending) return;
|
||||
scrollToBottom('auto');
|
||||
}, [
|
||||
loading,
|
||||
coachContext?.order,
|
||||
messages.length,
|
||||
isAiThinking,
|
||||
isSessionTransitionPending,
|
||||
scrollToBottom,
|
||||
]);
|
||||
|
||||
// While AI thinks or streams, keep the latest bubble (incl. dots) in view as height grows.
|
||||
useEffect(() => {
|
||||
if (loading) return;
|
||||
if (!isAiThinking && messages.every((msg) => msg.status !== 'streaming')) {
|
||||
return;
|
||||
if (loading || !isStreamOrThinking) return;
|
||||
|
||||
const scroller = messagesScrollRef.current;
|
||||
if (!scroller) return;
|
||||
|
||||
const stick = () => scrollToBottom('auto');
|
||||
stick();
|
||||
|
||||
const content = scroller.firstElementChild;
|
||||
const resizeObserver =
|
||||
typeof ResizeObserver !== 'undefined' && content
|
||||
? new ResizeObserver(() => stick())
|
||||
: null;
|
||||
if (content && resizeObserver) resizeObserver.observe(content);
|
||||
|
||||
const mutationObserver =
|
||||
typeof MutationObserver !== 'undefined'
|
||||
? new MutationObserver(() => stick())
|
||||
: null;
|
||||
if (mutationObserver) {
|
||||
mutationObserver.observe(scroller, { childList: true, subtree: true, characterData: true });
|
||||
}
|
||||
scrollToBottom();
|
||||
}, [messages, isAiThinking, loading, scrollToBottom]);
|
||||
|
||||
const frame = window.requestAnimationFrame(stick);
|
||||
const timeout = window.setTimeout(stick, 50);
|
||||
|
||||
return () => {
|
||||
resizeObserver?.disconnect();
|
||||
mutationObserver?.disconnect();
|
||||
window.cancelAnimationFrame(frame);
|
||||
window.clearTimeout(timeout);
|
||||
};
|
||||
}, [isStreamOrThinking, loading, scrollToBottom]);
|
||||
|
||||
const handleStreamProgress = useCallback(() => {
|
||||
if (streamScrollRafRef.current !== null) return;
|
||||
streamScrollRafRef.current = window.requestAnimationFrame(() => {
|
||||
streamScrollRafRef.current = null;
|
||||
scrollToBottom();
|
||||
scrollToBottom('auto');
|
||||
});
|
||||
}, [scrollToBottom]);
|
||||
|
||||
const handleStreamComplete = useCallback(
|
||||
(messageId: string) => {
|
||||
markAssistantStreamComplete(messageId);
|
||||
scrollToBottom();
|
||||
scrollToBottom('auto');
|
||||
},
|
||||
[markAssistantStreamComplete, scrollToBottom]
|
||||
);
|
||||
|
||||
if (!guestSessionHydrated) {
|
||||
return (
|
||||
<div className="flex h-full min-h-0 flex-1 items-center justify-center">
|
||||
<Loader2 className="h-8 w-8 animate-spin text-neon-cyan" />
|
||||
</div>
|
||||
);
|
||||
return <PageSkeleton />;
|
||||
}
|
||||
|
||||
if (!effectiveUserId) {
|
||||
@@ -257,7 +391,11 @@ export default function ChatPage() {
|
||||
const completedSessions =
|
||||
programProgress?.completedSessions.length ??
|
||||
getProgramProgress(effectiveUserId).completedSessions.length;
|
||||
const progressPercent = Math.round((completedSessions / PROGRAM_SESSION_COUNT) * 100);
|
||||
const displayCompletedSessions =
|
||||
isProgramComplete || (isSessionTransitionPending && coachContext?.isFinalSession)
|
||||
? PROGRAM_SESSION_COUNT
|
||||
: completedSessions;
|
||||
const progressPercent = Math.round((displayCompletedSessions / PROGRAM_SESSION_COUNT) * 100);
|
||||
const sessionOrder =
|
||||
currentSession?.order ??
|
||||
coachContext?.order ??
|
||||
@@ -281,10 +419,12 @@ export default function ChatPage() {
|
||||
!isAiThinking &&
|
||||
!hasCurrentSessionMessages &&
|
||||
!isWaitingForUnlock &&
|
||||
!isSessionCompletionQueued &&
|
||||
!isSessionTransitionPending;
|
||||
|
||||
const isStreamBusy =
|
||||
isAiThinking ||
|
||||
isSessionCompletionQueued ||
|
||||
isSessionTransitionPending ||
|
||||
messages.some((msg) => msg.status === 'streaming');
|
||||
|
||||
@@ -294,11 +434,9 @@ export default function ChatPage() {
|
||||
? 'در حال بارگذاری...'
|
||||
: isWaitingForUnlock
|
||||
? 'جلسه بعدی بهزودی باز میشود'
|
||||
: isSessionTransitionPending
|
||||
? 'در حال جمعبندی جلسه...'
|
||||
: showStartPrompt
|
||||
? 'برای شروع جلسه بعد، دکمه بالا را بزن'
|
||||
: 'پاسخ خود را بنویسید...';
|
||||
: showStartPrompt
|
||||
? 'برای شروع جلسه بعد، دکمه بالا را بزن'
|
||||
: 'پاسخ خود را بنویسید...';
|
||||
|
||||
const handleSend = async (e?: FormEvent, initialMessage?: string, skipUserMessage = false) => {
|
||||
e?.preventDefault();
|
||||
@@ -380,6 +518,14 @@ export default function ChatPage() {
|
||||
return (
|
||||
<div className="flex h-full min-h-0 flex-1 flex-col overflow-hidden">
|
||||
<div className="glass-panel-chat relative flex min-h-0 flex-1 flex-col gap-4 overflow-hidden p-4">
|
||||
<LoadingOverlay
|
||||
open={isSessionTransitionPending}
|
||||
message={
|
||||
coachContext?.isFinalSession
|
||||
? 'در حال آمادهسازی پسآزمون…'
|
||||
: 'در حال آمادهسازی جلسه بعد…'
|
||||
}
|
||||
/>
|
||||
<div className="relative z-10 shrink-0">
|
||||
{isProgramComplete ? (
|
||||
<p className="text-center text-xs text-muted-foreground">دوره آموزشی تکمیل شده</p>
|
||||
@@ -392,13 +538,16 @@ export default function ChatPage() {
|
||||
) : (
|
||||
<div className="space-y-2">
|
||||
<div className="flex items-center gap-2.5">
|
||||
<span className="shrink-0 rounded-md bg-muted px-1.5 py-0.5 text-[10px] font-medium tabular-nums text-foreground">
|
||||
<span className="shrink-0 rounded-md border border-slate-200 bg-white px-1.5 py-0.5 text-[10px] font-medium tabular-nums text-foreground dark:border-slate-700/50 dark:bg-slate-800">
|
||||
{sessionOrder}/{PROGRAM_SESSION_COUNT}
|
||||
</span>
|
||||
<p className="min-w-0 flex-1 truncate text-[13px] font-medium text-foreground">{sessionTitle}</p>
|
||||
<span className="shrink-0 text-[11px] font-semibold tabular-nums text-muted-foreground">
|
||||
{progressPercent}٪
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
className="h-[2px] w-full overflow-hidden rounded-full bg-black/10 dark:bg-white/[0.06]"
|
||||
className="h-1.5 w-full overflow-hidden rounded-full border border-slate-200/80 bg-slate-100 dark:border-slate-700/50 dark:bg-slate-800"
|
||||
role="progressbar"
|
||||
aria-valuenow={progressPercent}
|
||||
aria-valuemin={0}
|
||||
@@ -406,10 +555,23 @@ export default function ChatPage() {
|
||||
aria-label="پیشرفت دوره"
|
||||
>
|
||||
<div
|
||||
className="h-full rounded-full bg-gradient-to-l from-neon-cyan/80 to-neon-emerald/70 transition-all duration-500"
|
||||
className="h-full rounded-full bg-sky-500 transition-all duration-500 ease-out dark:bg-sky-600"
|
||||
style={{ width: `${progressPercent}%` }}
|
||||
/>
|
||||
</div>
|
||||
{Boolean(coachContext?.isFinalSession && permissions.canTakePostTest) && (
|
||||
<div className="flex justify-end pt-0.5">
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
size="sm"
|
||||
className="h-8 text-xs"
|
||||
onClick={() => navigate('/assessment/post')}
|
||||
>
|
||||
رفتن به پسآزمون
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
@@ -418,10 +580,8 @@ export default function ChatPage() {
|
||||
ref={messagesScrollRef}
|
||||
className="relative z-10 min-h-0 flex-1 overflow-y-auto overscroll-contain"
|
||||
>
|
||||
{loading ? (
|
||||
<div className="flex h-full items-center justify-center py-6">
|
||||
<Loader2 className="h-8 w-8 animate-spin text-neon-cyan" />
|
||||
</div>
|
||||
{loading && messages.length === 0 ? (
|
||||
<ChatSkeleton />
|
||||
) : messages.length === 0 && !isAiThinking ? (
|
||||
<div className="flex h-full min-h-0 flex-col items-center justify-center px-1 py-6 text-center">
|
||||
<div className="mb-5 flex h-14 w-14 items-center justify-center rounded-full bg-white/20 text-neon-cyan backdrop-blur-md dark:bg-white/10">
|
||||
@@ -503,7 +663,7 @@ export default function ChatPage() {
|
||||
className={`shrink-0 text-[11px] font-medium ${
|
||||
isPastSession
|
||||
? 'text-muted-foreground/80'
|
||||
: 'text-neon-cyan'
|
||||
: 'text-sky-700 dark:text-sky-400'
|
||||
}`}
|
||||
>
|
||||
جلسه {msgSessionOrder}
|
||||
@@ -561,7 +721,7 @@ export default function ChatPage() {
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="relative z-10 w-full shrink-0">
|
||||
<div className="relative z-10 w-full shrink-0 pb-1 pt-1">
|
||||
<form onSubmit={handleSend} className="w-full">
|
||||
<div className="composer-glass">
|
||||
<textarea
|
||||
@@ -589,14 +749,14 @@ export default function ChatPage() {
|
||||
type="submit"
|
||||
size="icon"
|
||||
variant="neon"
|
||||
className="mb-0.5 h-10 w-10 shrink-0 rounded-xl p-0 disabled:opacity-70 [&_svg]:h-6 [&_svg]:w-6"
|
||||
className="mb-0.5 h-10 w-10 shrink-0 rounded-full p-0 disabled:opacity-50 [&_svg]:h-5 [&_svg]:w-5"
|
||||
disabled={composerDisabled || !message.trim()}
|
||||
aria-label="ارسال"
|
||||
>
|
||||
{isSending ? (
|
||||
<Loader2 className="h-6 w-6 animate-spin" />
|
||||
<Loader2 className="h-5 w-5 animate-spin" />
|
||||
) : (
|
||||
<ArrowUp className="h-6 w-6" strokeWidth={2.75} />
|
||||
<ArrowUp className="h-5 w-5" strokeWidth={2.75} />
|
||||
)}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
@@ -1,18 +1,15 @@
|
||||
import { Navigate } from 'react-router-dom';
|
||||
import { useAuth } from '@/hooks/useAuth';
|
||||
import { useLearningJourney } from '@/hooks/useLearningJourney';
|
||||
import { Check, CheckCircle2, Loader2 } from 'lucide-react';
|
||||
import { Check, CheckCircle2 } from 'lucide-react';
|
||||
import { FinishedSkeleton } from '@/components/skeletons';
|
||||
|
||||
export default function FinishedPage() {
|
||||
const { effectiveUserId, guestSessionHydrated } = useAuth();
|
||||
const { permissions, loading } = useLearningJourney(effectiveUserId ?? undefined);
|
||||
|
||||
if (!guestSessionHydrated || loading) {
|
||||
return (
|
||||
<div className="flex min-h-[50vh] items-center justify-center">
|
||||
<Loader2 className="h-8 w-8 animate-spin text-neon-cyan" />
|
||||
</div>
|
||||
);
|
||||
return <FinishedSkeleton />;
|
||||
}
|
||||
|
||||
if (!effectiveUserId) {
|
||||
|
||||
@@ -9,8 +9,9 @@ import { useToast } from '@/components/ui/use-toast';
|
||||
import { hasSessionToken } from '@/services/backend';
|
||||
import { getBackendErrorMessage } from '@/lib/backendError';
|
||||
import { AnimationWrapper } from '@/components/motion';
|
||||
import { Loader2, Sparkles } from 'lucide-react';
|
||||
import { Loader2 } from 'lucide-react';
|
||||
import { ROUTES } from '@/utils/constants';
|
||||
import { BrandLogo } from '@/components/BrandLogo';
|
||||
|
||||
const NAME_MAX_LENGTH = 100;
|
||||
|
||||
@@ -99,13 +100,9 @@ export default function ProfileCompletionPage() {
|
||||
className="pointer-events-none absolute inset-x-0 top-0 h-32 bg-gradient-to-b from-neon-blue/20 via-neon-cyan/5 to-transparent"
|
||||
aria-hidden
|
||||
/>
|
||||
<CardHeader className="relative space-y-2">
|
||||
<div className="mb-2 flex justify-center">
|
||||
<div className="avatar-glow">
|
||||
<div className="flex h-14 w-14 items-center justify-center rounded-full bg-white text-cyan-700 shadow-sm dark:bg-navy dark:text-neon-cyan dark:shadow-none">
|
||||
<Sparkles className="h-7 w-7" />
|
||||
</div>
|
||||
</div>
|
||||
<CardHeader className="relative space-y-3">
|
||||
<div className="mb-1 flex justify-center">
|
||||
<BrandLogo imgClassName="h-12" />
|
||||
</div>
|
||||
<CardTitle className="text-center text-2xl font-bold tracking-tight text-foreground">
|
||||
قبل از شروع، کمی با هم آشنا بشیم
|
||||
|
||||
@@ -176,12 +176,16 @@ export default function ProgramPage() {
|
||||
})}
|
||||
</div>
|
||||
|
||||
{/* Program Complete Banner */}
|
||||
{programCompleted && (
|
||||
{/* Post-test available from Session 11 onward */}
|
||||
{(programCompleted || permissions.canTakePostTest) && (
|
||||
<Card className="mt-4 border-green-500/30 bg-green-500/5">
|
||||
<CardContent className="p-4 text-center">
|
||||
<CheckCircle2 className="h-8 w-8 text-green-600 mx-auto mb-2" />
|
||||
<p className="font-medium text-sm">تبریک! برنامه آموزشی را به پایان رساندید.</p>
|
||||
<p className="font-medium text-sm">
|
||||
{programCompleted
|
||||
? 'تبریک! برنامه آموزشی را به پایان رساندید.'
|
||||
: 'به جلسه پایانی رسیدهاید.'}
|
||||
</p>
|
||||
<p className="mt-1 text-xs text-muted-foreground">
|
||||
اکنون میتوانید پسآزمون را انجام دهید.
|
||||
</p>
|
||||
|
||||
Reference in New Issue
Block a user