improvement: users get notified whenever a task is done completely, not per step.

This commit is contained in:
2026-09-07 22:36:33 +03:30
parent e52701dba3
commit 880809fdbe
17 changed files with 79 additions and 29 deletions

View File

@@ -846,6 +846,7 @@
"activityTaskCompleted": "{step} completed by {actor} · {date}",
"activityTaskAssigned": "{step} assigned by {actor} · {date}",
"activityCaseImportant": "Marked important by {actor} · {date}",
"activityCaseCompleted": "All lab work completed by {actor} · {date}",
"activityCaseAmended": "Case updated by {actor} · {date}",
"activityGeneric": "Update · {date}",
"loadingHistory": "Loading history…",
@@ -1105,6 +1106,7 @@
"typeCaseImportant": "Case marked as important",
"typeTaskCompleted": "Lab task completed",
"typeTaskAssigned": "A task was assigned to you",
"typeCaseCompleted": "Lab case completed",
"typeConnectionRequest": "New organization connection request",
"typeStaffInvite": "Staff invitation created",
"typeUnknown": "Notification",

View File

@@ -847,6 +847,7 @@
"activityTaskCompleted": "{step} توسط {actor} تکمیل شد · {date}",
"activityTaskAssigned": "{step} توسط {actor} اختصاص داده شد · {date}",
"activityCaseImportant": "مهم علامت‌گذاری شد توسط {actor} · {date}",
"activityCaseCompleted": "تمام کارهای لابراتوار توسط {actor} تکمیل شد · {date}",
"activityCaseAmended": "پرونده به‌روزرسانی شد توسط {actor} · {date}",
"activityGeneric": "به‌روزرسانی · {date}",
"loadingHistory": "در حال بارگذاری تاریخچه...",
@@ -1106,6 +1107,7 @@
"typeCaseImportant": "پرونده به‌عنوان مهم علامت خورد",
"typeTaskCompleted": "وظیفه لابراتوار تکمیل شد",
"typeTaskAssigned": "یک وظیفه به شما اختصاص داده شد",
"typeCaseCompleted": "پرونده لابراتوار تکمیل شد",
"typeConnectionRequest": "درخواست اتصال سازمان جدید",
"typeStaffInvite": "دعوتنامه کارکنان ایجاد شد",
"typeUnknown": "اعلان",

View File

@@ -846,6 +846,7 @@
"activityTaskCompleted": "{step} voltooid door {actor} · {date}",
"activityTaskAssigned": "{step} toegewezen door {actor} · {date}",
"activityCaseImportant": "Als belangrijk gemarkeerd door {actor} · {date}",
"activityCaseCompleted": "Al het labwerk voltooid door {actor} · {date}",
"activityCaseAmended": "Case bijgewerkt door {actor} · {date}",
"activityGeneric": "Update · {date}",
"loadingHistory": "Geschiedenis laden...",
@@ -1105,6 +1106,7 @@
"typeCaseImportant": "Case gemarkeerd als belangrijk",
"typeTaskCompleted": "Labtaak voltooid",
"typeTaskAssigned": "Er is een taak aan u toegewezen",
"typeCaseCompleted": "Labcase voltooid",
"typeConnectionRequest": "Nieuw organisatieverzoek",
"typeStaffInvite": "Personeelsuitnodiging aangemaakt",
"typeUnknown": "Melding",

View File

@@ -54,7 +54,7 @@ export default async function LocaleLayout({
setRequestLocale(locale);
const messages = await getMessages();
const themeInit = `(function(){try{var k=${JSON.stringify(THEME_STORAGE_KEY)};var t=localStorage.getItem(k);document.documentElement.setAttribute('data-theme',t==='light'||t==='dark'?t:'dark');}catch(e){document.documentElement.setAttribute('data-theme','dark');}})();`;
const themeInit = `(function(){try{var k=${JSON.stringify(THEME_STORAGE_KEY)};var t=localStorage.getItem(k);document.documentElement.setAttribute('data-theme',t==='light'||t==='dark'?t:'light');}catch(e){document.documentElement.setAttribute('data-theme','light');}})();`;
const dir = isRtlLocale(locale) ? 'rtl' : 'ltr';
const fontSans = isRtlLocale(locale)
? 'var(--font-vazirmatn), var(--font-noto-sans-arabic), system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif'
@@ -65,6 +65,7 @@ export default async function LocaleLayout({
lang={localeHtmlLang(locale)}
dir={dir}
data-locale={locale}
data-theme="light"
className={`${vazirmatn.variable} ${notoSansArabic.variable}`}
style={{ ['--font-sans' as never]: fontSans }}
suppressHydrationWarning

View File

@@ -13,6 +13,7 @@ const TYPE_I18N: Record<UserNotificationType, string> = {
CASE_IMPORTANT: 'typeCaseImportant',
TASK_COMPLETED: 'typeTaskCompleted',
TASK_ASSIGNED: 'typeTaskAssigned',
CASE_COMPLETED: 'typeCaseCompleted',
CONNECTION_REQUEST: 'typeConnectionRequest',
STAFF_INVITE: 'typeStaffInvite',
};
@@ -74,6 +75,12 @@ export function notificationContextLine(
if (clinicName) parts.push(clinicName);
if (prosthesisLabel) parts.push(prosthesisLabel);
break;
case 'CASE_COMPLETED':
if (patientName) parts.push(patientName);
if (clinicName) parts.push(clinicName);
else if (labName) parts.push(labName);
if (prosthesisLabel) parts.push(prosthesisLabel);
break;
case 'LAB_COMMENT_CLINIC':
if (patientName) parts.push(patientName);
if (labName) parts.push(labName);

View File

@@ -43,6 +43,8 @@ export function formatLabCaseActivityLine(
});
case 'CASE_IMPORTANT':
return t('activityCaseImportant', { actor, date });
case 'CASE_COMPLETED':
return t('activityCaseCompleted', { actor, date });
case 'CASE_AMENDED':
return t('activityCaseAmended', { actor, date });
default:

View File

@@ -3,14 +3,14 @@ export const THEME_STORAGE_KEY = 'dyolink-theme';
export type ThemeMode = 'light' | 'dark';
export function getStoredTheme(): ThemeMode {
if (typeof window === 'undefined') return 'dark';
if (typeof window === 'undefined') return 'light';
try {
const v = localStorage.getItem(THEME_STORAGE_KEY);
if (v === 'light' || v === 'dark') return v;
} catch {
/* ignore */
}
return 'dark';
return 'light';
}
export function applyTheme(mode: ThemeMode) {

View File

@@ -262,13 +262,17 @@ body {
}
html {
color-scheme: dark;
color-scheme: light;
}
html[data-theme='light'] {
color-scheme: light;
}
html[data-theme='dark'] {
color-scheme: dark;
}
/* Minimal RTL layer — refine incrementally. */
html[dir='rtl'] body {
direction: rtl;
@@ -338,9 +342,7 @@ select option {
}
:root[data-theme='dark'] select.form-select,
:root[data-theme='dark'] select,
:root:not([data-theme='light']) select.form-select,
:root:not([data-theme='light']) select {
:root[data-theme='dark'] select {
color-scheme: dark;
}
@@ -358,8 +360,7 @@ select option {
}
}
:root[data-theme='dark'] .surface-card,
:root:not([data-theme='light']) .surface-card {
:root[data-theme='dark'] .surface-card {
background: color-mix(in srgb, var(--color-card-background) 82%, var(--color-background-primary));
}

View File

@@ -5,7 +5,8 @@ export type LabCaseActivityType =
| 'CASE_IMPORTANT'
| 'CASE_AMENDED'
| 'TASK_COMPLETED'
| 'TASK_ASSIGNED';
| 'TASK_ASSIGNED'
| 'CASE_COMPLETED';
export interface LabCaseActivityItem {
id: string;

View File

@@ -6,6 +6,7 @@ export type UserNotificationType =
| 'CASE_IMPORTANT'
| 'TASK_COMPLETED'
| 'TASK_ASSIGNED'
| 'CASE_COMPLETED'
| 'CONNECTION_REQUEST'
| 'STAFF_INVITE';