diff --git a/frontend/src/app/(dashboard)/appointments/page.tsx b/frontend/src/app/(dashboard)/appointments/page.tsx index ead192c..3561ff0 100644 --- a/frontend/src/app/(dashboard)/appointments/page.tsx +++ b/frontend/src/app/(dashboard)/appointments/page.tsx @@ -14,6 +14,7 @@ import { AppointmentScheduleGrid } from '@/components/ui/appointments/Appointmen import { AppointmentsPatientSearch } from '@/components/ui/appointments/AppointmentsPatientSearch'; import { AppointmentScheduleLegend } from '@/components/ui/appointments/AppointmentScheduleLegend'; import { ScheduleDayPicker } from '@/components/ui/common/ScheduleDayPicker'; +import { Toast } from '@/components/ui/common/Toast'; import type { AppointmentPurpose } from '@/types/appointment'; import { formatApiErrorMessage } from '@/lib/formatApiError'; import { getLocalDayIsoRange, startOfLocalDay } from '@/lib/appointmentTime'; @@ -280,12 +281,6 @@ export default function AppointmentsPage() { )} - {scheduleError && ( -
- {scheduleError} -
- )} - )} - {(toastError || toastSuccess || toastInfo) && ( -
-
- {toastError && ( -
- {toastError} -
- )} - {toastInfo && ( -
- {toastInfo} -
- )} - {toastSuccess && ( -
- {toastSuccess} -
- )} + {(scheduleError || toastError || toastSuccess || toastInfo) && ( +
+
+ {scheduleError && {scheduleError}} + {toastError && {toastError}} + {toastInfo && {toastInfo}} + {toastSuccess && {toastSuccess}}
)} diff --git a/frontend/src/app/(dashboard)/settings/subscriptions/page.tsx b/frontend/src/app/(dashboard)/settings/subscriptions/page.tsx index e5ab6b1..e6f6450 100644 --- a/frontend/src/app/(dashboard)/settings/subscriptions/page.tsx +++ b/frontend/src/app/(dashboard)/settings/subscriptions/page.tsx @@ -6,6 +6,7 @@ import { useRouter } from 'next/navigation'; import { useAuth } from '@/lib/hooks/useAuth'; import { authApi } from '@/lib/api/auth'; import { Button } from '@/components/ui/common/Button'; +import { Toast } from '@/components/ui/common/Toast'; import type { SubscriptionAlertData } from '@/types/subscription'; const PLAN_OPTIONS = [ @@ -69,7 +70,7 @@ export default function SubscriptionsSettingsPage() { : 'text-red-400'; return ( -
+
Start purchase process - {purchaseNotice && ( -
-

{purchaseNotice}

-
- )}
+ + {purchaseNotice && ( +
+
+ {purchaseNotice} +
+
+ )}
); } diff --git a/frontend/src/components/ui/common/Toast.tsx b/frontend/src/components/ui/common/Toast.tsx new file mode 100644 index 0000000..094531e --- /dev/null +++ b/frontend/src/components/ui/common/Toast.tsx @@ -0,0 +1,26 @@ +import type { ReactNode } from 'react'; +import type { BadgeVariant } from '@/components/ui/common/Badge'; + +interface ToastProps { + children: ReactNode; + variant?: BadgeVariant; + className?: string; +} + +const variantStyles: Record = { + success: 'bg-badge-success-bg text-badge-success-fg border-badge-success-border', + warning: 'bg-badge-warning-bg text-badge-warning-fg border-badge-warning-border', + danger: 'bg-badge-danger-bg text-badge-danger-fg border-badge-danger-border', + default: 'bg-badge-default-bg text-badge-default-fg border-badge-default-border', +}; + +export function Toast({ children, variant = 'default', className = '' }: ToastProps) { + return ( +
+ {children} +
+ ); +} diff --git a/frontend/src/components/ui/treatment/TreatmentWorkspace.tsx b/frontend/src/components/ui/treatment/TreatmentWorkspace.tsx index e18ce0f..0c20616 100644 --- a/frontend/src/components/ui/treatment/TreatmentWorkspace.tsx +++ b/frontend/src/components/ui/treatment/TreatmentWorkspace.tsx @@ -8,6 +8,7 @@ import { Checkbox } from '@/components/ui/common/Checkbox'; import { Button } from '@/components/ui/common/Button'; import { Dropdown } from '@/components/ui/common/Dropdown'; import { SearchBar } from '@/components/ui/common/SearchBar'; +import { Toast } from '@/components/ui/common/Toast'; import { isSameLocalCalendarDay, startOfLocalDay } from '@/lib/appointmentTime'; import { fetchLinkedOrganizations, @@ -325,7 +326,7 @@ export function TreatmentWorkspace({ userId, currentOrganization }: TreatmentWor } return ( -
+

Treatment

@@ -345,12 +346,6 @@ export function TreatmentWorkspace({ userId, currentOrganization }: TreatmentWor loading={apptsLoading} /> - {banner && ( -

- {banner} -
- )} -
{selectedAppointment ? ( @@ -651,6 +646,14 @@ export function TreatmentWorkspace({ userId, currentOrganization }: TreatmentWor
+ + {banner && ( +
+
+ {banner} +
+
+ )}
); }