Fix discovery/filters bugs, build real settings pages, sequential onboarding questions

- Fix reset-filters button being a no-op (referential-equality bug with
  the DEFAULT_FILTERS constant) and add an unlimited-distance toggle to
  discovery filters
- Replace the "coming soon" settings stubs with working Notifications,
  Privacy & Security, and Help & Support pages
- Rework the onboarding profile-questions step to walk users through
  one question at a time instead of picking 3 then filling them all at once
- Enforce a 10MB client-side cap on photo uploads (onboarding + profile)

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-26 18:10:02 +03:30
parent cbbfb145dc
commit d55d61ba81
12 changed files with 614 additions and 95 deletions
+20
View File
@@ -48,6 +48,9 @@ export interface UserProfile {
is_admin: boolean;
bio?: string;
streak_count: number;
notify_matches: boolean;
notify_messages: boolean;
notify_likes: boolean;
}
export interface TokenPair {
@@ -440,6 +443,23 @@ export function checkIn() {
return authRequest<CheckInResult>("/profile/checkin", { method: "POST" });
}
export interface NotificationSettings {
notify_matches: boolean;
notify_messages: boolean;
notify_likes: boolean;
}
export function updateNotificationSettings(settings: NotificationSettings) {
return authRequest<null>("/profile/notifications", {
method: "PATCH",
body: JSON.stringify(settings),
});
}
export function deleteAccount() {
return authRequest<null>("/profile/me", { method: "DELETE" });
}
// ---------------- دوستیابی ----------------
export function getDiscoverFeed(params?: {
+12
View File
@@ -12,6 +12,18 @@ export function formatDistance(km: number): string {
return `${rounded} کیلومتر`;
}
// سقف حجم عکس سمت کلاینت (موبایل/وب)؛ قبل از اینکه اصلاً آپلود شروع بشه
// جلوی فایل‌های خیلی بزرگ رو می‌گیره. بک‌اند هم خودش جداگانه سقف داره؛ این
// فقط یه فیدبک فوری‌تر به کاربره، نه جایگزین اعتبارسنجی سمت سرور.
export const MAX_PHOTO_SIZE_BYTES = 10 * 1024 * 1024;
export function validatePhotoSize(file: File): string | null {
if (file.size > MAX_PHOTO_SIZE_BYTES) {
return "حجم عکس نباید بیشتر از ۱۰ مگابایت باشه؛ یه عکس کوچیک‌تر انتخاب کن.";
}
return null;
}
export function calcAge(birthDate?: string): number | null {
if (!birthDate) return null;
const b = new Date(birthDate);