diff --git a/client/pages/SettingsPage.jsx b/client/pages/SettingsPage.tsx similarity index 90% rename from client/pages/SettingsPage.jsx rename to client/pages/SettingsPage.tsx index b3c500e..1de511f 100644 --- a/client/pages/SettingsPage.jsx +++ b/client/pages/SettingsPage.tsx @@ -1,9 +1,9 @@ -import React, { useState, useEffect, useCallback } from 'react'; +import { useState, useEffect, useCallback, type ComponentType, type ReactNode } from 'react'; import { useNavigate } from 'react-router-dom'; import { toast } from 'sonner'; import { AlertCircle, Moon, RefreshCw, Sun, Users } from 'lucide-react'; import { api } from '@/api'; -import { cn } from '@/lib/utils'; +import { cn, errMessage } from '@/lib/utils'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { CalendarFeedManager } from '@/components/CalendarFeedManager'; @@ -18,7 +18,7 @@ import { SaveStatus } from '@/components/ui/save-status'; import { NotificationPreferences, PushNotifications, asSettings } from '@/pages/ProfilePage'; export const LINK_IMPORT_PREF_KEY = 'link_import_ask'; -export function getLinkImportPref() { +export function getLinkImportPref(): boolean { return localStorage.getItem(LINK_IMPORT_PREF_KEY) !== 'false'; } @@ -26,12 +26,12 @@ export function getLinkImportPref() { // preferences; Profile keeps identity, security, and privacy) ────────────── function NotificationsSection() { - const [settings, setSettings] = useState(null); + const [settings, setSettings] = useState | null>(null); const load = useCallback(() => { api.profileSettings() .then((data) => setSettings(asSettings(data))) - .catch((err) => toast.error(err.message || 'Failed to load notification settings.')); + .catch((err) => toast.error(errMessage(err, 'Failed to load notification settings.'))); }, []); useEffect(() => { load(); }, [load]); @@ -39,7 +39,7 @@ function NotificationsSection() { if (!settings) return null; return (
- +
); @@ -47,7 +47,7 @@ function NotificationsSection() { // ─── Card wrapper ───────────────────────────────────────────────────────────── -function SectionCard({ title, children }) { +function SectionCard({ title, children }: { title: ReactNode; children: ReactNode }) { return (
@@ -62,7 +62,7 @@ function SectionCard({ title, children }) { // ─── Setting Row ────────────────────────────────────────────────────────────── -function SettingRow({ label, description, children }) { +function SettingRow({ label, description, children }: { label: ReactNode; description?: ReactNode; children: ReactNode }) { return (
@@ -80,7 +80,13 @@ function SettingRow({ label, description, children }) { // ─── Theme Card ─────────────────────────────────────────────────────────────── -function ThemeCard({ value, label, icon: Icon, currentTheme, onSelect }) { +function ThemeCard({ value, label, icon: Icon, currentTheme, onSelect }: { + value: string; + label: string; + icon: ComponentType<{ className?: string }>; + currentTheme: string; + onSelect: (v: string) => void; +}) { const selected = currentTheme === value; return (