대시보드 이슈 정리 1차
This commit is contained in:
parent
94cc56592f
commit
f472883c31
13 changed files with 592 additions and 311 deletions
|
|
@ -13,7 +13,8 @@ import {
|
|||
} from "../lib/api";
|
||||
|
||||
type UserDraft = Pick<AdminManagedUser, "display_name" | "role" | "affiliation" | "cohort_ids">;
|
||||
type NewUserDraft = AdminUserCreateRequest;
|
||||
type NewUserDraft = Required<Pick<AdminUserCreateRequest, "email" | "display_name" | "role">> &
|
||||
Pick<UserDraft, "affiliation" | "cohort_ids">;
|
||||
const MAX_RENDERED_USERS = 40;
|
||||
|
||||
const EMPTY_NEW_USER: NewUserDraft = {
|
||||
|
|
|
|||
|
|
@ -554,7 +554,7 @@ export default function Professor() {
|
|||
<Badge tone={personaReviewTone(persona.status)}>
|
||||
{personaReviewStatusLabel(persona.status)}
|
||||
</Badge>
|
||||
<span>{formatDateTime(persona.created_at)}</span>
|
||||
<span>{formatDateTime(persona.created_at ?? null)}</span>
|
||||
</div>
|
||||
<div className="pf-persona__actions">
|
||||
<Button
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue