대시보드 이슈 정리 1차

This commit is contained in:
Yun Chan 2026-06-27 17:51:54 +09:00
parent 94cc56592f
commit f472883c31
13 changed files with 592 additions and 311 deletions

View file

@ -127,6 +127,22 @@ function SettingsSkeleton({
);
}
const DEFAULT_NOTIFICATION_PREFERENCES: NotificationPreferences = {
session_done: true,
safety_signal: true,
learner_progress: true,
product_news: false,
};
function completeNotificationPreferences(
preferences?: NotificationPreferences | null,
): NotificationPreferences {
return {
...DEFAULT_NOTIFICATION_PREFERENCES,
...preferences,
};
}
export default function Settings() {
const { user } = useAuth();
const role = user?.role ?? "learner";
@ -313,11 +329,12 @@ export default function Settings() {
const savePreferences = async (key: string) => {
if (!preferencesReady || !preferences) return;
const notifications = completeNotificationPreferences(preferences.notifications);
const next = await userApi.updatePreferences({
theme: dark ? "dark" : "light",
voice_preset_id: preferences.voice_preset_id,
voice_rate: preferences.voice_rate,
notifications: preferences.notifications,
notifications,
});
setPreferences(next);
flashSaved(key);
@ -348,7 +365,7 @@ export default function Settings() {
setPreferences((cur) => cur ? ({
...cur,
notifications: {
...cur.notifications,
...completeNotificationPreferences(cur.notifications),
[key]: value,
},
}) : cur);
@ -362,13 +379,12 @@ export default function Settings() {
: false;
const engineStorageLabel = !engineConfig
? "확인 중"
: engineConfig.source === "unconfigured"
? "미구성"
: engineConfig.durable
: engineConfig.durable
? "DB 저장"
: "런타임 적용";
const engineService = adminHealth?.services.find((service) => service.key === "engine");
const engineServiceStatus = engineService?.status ?? "degraded";
const notificationPreferences = completeNotificationPreferences(preferences?.notifications);
return (
<AppShell contextLabel="설정" hideNav hideTopbar bleed>
@ -828,7 +844,7 @@ export default function Settings() {
</div>
<Toggle
checked={Boolean(
preferences.notifications[item.id as keyof NotificationPreferences],
notificationPreferences[item.id as keyof NotificationPreferences],
)}
onChange={(next) =>
updateNotification(item.id as keyof NotificationPreferences, next)