-
-
-
- {getNotificationTitle(notification) || "Notification"}
-
-
-
- Sent via {notification.delivery_channel || "in-app"} ·{" "}
- {formatNotificationTimestamp(notification.timestamp)}
-
-
-
-
- {notification.image ? (
-
-

+
+
+
+
+ {getNotificationTitle(notification) || "Notification"}
+
+
+
+ {notification.delivery_channel}
+
+ ·
+
+ {formatNotificationTimestamp(notification.timestamp)}
+
+
- ) : null}
-
-
-
- {getNotificationMessage(notification) || "No message content."}
-
-
-
-
-
Type
-
- {formatNotificationTypeLabel(notification.type)}
-
-
-
-
Level
-
-
- {notification.level || "—"}
-
-
-
-
-
Channel
-
- {notification.delivery_channel || "—"}
-
-
-
-
Delivery status
-
- {notification.delivery_status || "—"}
-
-
-
-
Read status
-
- {notification.is_read ? "Read" : "Unread"}
-
-
- {notification.receiver_type ? (
-
-
Receiver
-
- {notification.receiver_type}
-
-
- ) : null}
-
-
Sent at
-
- {formatNotificationDateTime(notification.timestamp)}
-
-
- {isMeaningfulExpiry(notification.expires) ? (
-
-
Expires
-
- {formatNotificationDateTime(notification.expires)}
-
-
- ) : null}
-
-
- {notification.payload.tags && notification.payload.tags.length > 0 ? (
-
- {notification.payload.tags.map((tag) => (
-
- {tag}
-
- ))}
-
- ) : null}
- {onDelete ? (
-
-
-
- ) : null}
+ {/* Tabs */}
+
+ {[
+ { key: "details" as const, label: "Details" },
+ { key: "preview" as const, label: "Preview" },
+ ].map((t) => (
+
+ ))}
+
+
+ {/* Tab content */}
+
+ {tab === "details" ? (
+
+ ) : (
+
+ )}
+
>
) : null}
- )
+ );
+}
+
+function DetailsTab({
+ notification,
+ onDelete,
+}: {
+ notification: Notification;
+ onDelete?: () => void;
+}) {
+ return (
+
+ {/* Message */}
+
+ {/* Image */}
+ {notification.image && (
+
+

+
+ )}
+
+ {/* Metadata */}
+
+ {[
+ { k: "Type", v: formatNotificationTypeLabel(notification.type) },
+ { k: "Channel", v: notification.delivery_channel || "—" },
+ { k: "Status", v: notification.is_read ? "Read" : "Unread" },
+ { k: "Delivery", v: notification.delivery_status || "—" },
+ ...(notification.receiver_type
+ ? [{ k: "Receiver", v: notification.receiver_type }]
+ : []),
+ { k: "Sent", v: formatNotificationDateTime(notification.timestamp) },
+ ...(isMeaningfulExpiry(notification.expires)
+ ? [
+ {
+ k: "Expires",
+ v: formatNotificationDateTime(notification.expires),
+ },
+ ]
+ : []),
+ ].map((row) => (
+
+ {row.k}
+
+ {row.v}
+
+
+ ))}
+
+
+ {/* Tags */}
+ {notification.payload.tags && notification.payload.tags.length > 0 && (
+
+ {notification.payload.tags.map((tag) => (
+
+ {tag}
+
+ ))}
+
+ )}
+
+ {/* Actions */}
+ {onDelete && (
+
+
+
+ )}
+
+ );
+}
+
+function PreviewTab({
+ notification,
+ config,
+ Icon,
+}: {
+ notification: Notification;
+ config: { bg: string; color: string };
+ Icon: React.ComponentType<{ className?: string }>;
+}) {
+ const title = getNotificationTitle(notification) || "Notification";
+ const message = getNotificationMessage(notification) || "";
+
+ return (
+
+ {/* Full content preview */}
+
+
+ Full content
+
+
+ {title}
+
+ {message ? (
+
+ {message}
+
+ ) : (
+
+ No message content.
+
+ )}
+
+ {notification.payload.tags && notification.payload.tags.length > 0 && (
+
+ {notification.payload.tags.map((tag) => (
+
+ {tag}
+
+ ))}
+
+ )}
+
+
+ );
}
diff --git a/src/components/sidebar/Sidebar.tsx b/src/components/sidebar/Sidebar.tsx
index ee17ec3..4989a65 100644
--- a/src/components/sidebar/Sidebar.tsx
+++ b/src/components/sidebar/Sidebar.tsx
@@ -356,11 +356,12 @@ export function Sidebar({
onClick={onClose}
className={({ isActive }) =>
cn(
- "group flex items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium text-grayScale-600 transition",
+ "relative group flex items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium text-grayScale-600 transition",
isCollapsed && "justify-center gap-0 p-2",
"hover:bg-grayScale-100 hover:text-brand-600 dark:text-grayScale-400 dark:hover:bg-white/5 dark:hover:text-brand-400",
isActive &&
- "bg-brand-500/50 text-brand-600 hover:bg-brand-500/50 hover:text-brand-600 dark:bg-brand-500/30 dark:text-brand-400 dark:hover:bg-brand-500/30 dark:hover:text-brand-400",
+ "bg-brand-500/10 hover:bg-brand-500/10 dark:bg-brand-500/15 dark:hover:bg-brand-500/15",
+ isActive ? "text-[#000] dark:text-white" : "",
)
}
title={isCollapsed ? entry.label : undefined}
@@ -370,13 +371,24 @@ export function Sidebar({
{!isCollapsed && (
-
{entry.label}
+
+ {entry.label}
+
+ )}
+ {isActive && (
+
)}
>
)}
diff --git a/src/components/sidebar/SidebarNavGroup.tsx b/src/components/sidebar/SidebarNavGroup.tsx
index 88a520e..e873b62 100644
--- a/src/components/sidebar/SidebarNavGroup.tsx
+++ b/src/components/sidebar/SidebarNavGroup.tsx
@@ -1,5 +1,11 @@
import { ChevronDown } from "lucide-react";
-import { type ComponentType, type ReactNode, useEffect, useId, useState } from "react";
+import {
+ type ComponentType,
+ type ReactNode,
+ useEffect,
+ useId,
+ useState,
+} from "react";
import { NavLink, useLocation } from "react-router-dom";
import { cn } from "../../lib/utils";
@@ -34,7 +40,9 @@ export function SidebarNavGroup({
const location = useLocation();
const panelId = useId();
const paths = activePaths?.length ? activePaths : [basePath];
- const isSectionActive = paths.some((path) => location.pathname.startsWith(path));
+ const isSectionActive = paths.some((path) =>
+ location.pathname.startsWith(path),
+ );
const [expanded, setExpanded] = useState(isSectionActive);
useEffect(() => {
@@ -51,10 +59,10 @@ export function SidebarNavGroup({
onClick={onNavigate}
className={({ isActive }) =>
cn(
- "group flex items-center justify-center rounded-lg p-2 text-sm font-medium text-grayScale-600 transition",
+ "relative group flex items-center justify-center rounded-lg p-2 text-sm font-medium text-grayScale-600 transition",
"hover:bg-grayScale-100 hover:text-brand-600 dark:text-grayScale-400 dark:hover:bg-white/5 dark:hover:text-brand-400",
isActive &&
- "bg-brand-500/50 text-brand-600 hover:bg-brand-500/50 hover:text-brand-600 dark:bg-brand-500/30 dark:text-brand-400 dark:hover:bg-brand-500/30 dark:hover:text-brand-400",
+ "bg-brand-500/10 text-brand-600 hover:bg-brand-500/10 hover:text-brand-600 dark:bg-brand-500/15 dark:text-brand-400 dark:hover:bg-brand-500/15 dark:hover:text-brand-400",
)
}
title={label}
@@ -63,7 +71,8 @@ export function SidebarNavGroup({
@@ -82,20 +91,29 @@ export function SidebarNavGroup({
aria-controls={panelId}
onClick={() => setExpanded((open) => !open)}
className={cn(
- "group flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-sm font-medium text-grayScale-600 transition",
+ "relative group flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-sm font-medium text-grayScale-600 transition",
"hover:bg-grayScale-100 hover:text-brand-600 dark:text-grayScale-400 dark:hover:bg-white/5 dark:hover:text-brand-400",
- isSectionActive && "text-brand-600 dark:text-brand-400",
+ isSectionActive &&
+ "bg-brand-500/10 text-black dark:bg-brand-500/15 dark:text-white",
)}
>
- {label}
+
+ {label}
+
{trailing}
+ {isSectionActive && (
+
+ )}
{children}
-
-
+
+
Close
diff --git a/src/index.css b/src/index.css
index 515f4bf..3d6f0e1 100644
--- a/src/index.css
+++ b/src/index.css
@@ -112,9 +112,7 @@
:is(
.bg-brand-50,
.bg-brand-500,
- .bg-brand-600,
- [class*="bg-brand-500/"],
- [class*="bg-brand-600/"]
+ .bg-brand-600
) {
@apply text-white;
}
@@ -122,9 +120,7 @@
:is(
.bg-brand-50,
.bg-brand-500,
- .bg-brand-600,
- [class*="bg-brand-500/"],
- [class*="bg-brand-600/"]
+ .bg-brand-600
)
:is(.text-brand-500, .text-brand-600, .text-brand-700, .text-brand-800) {
@apply text-white;
@@ -133,9 +129,7 @@
:is(
.bg-brand-50,
.bg-brand-500,
- .bg-brand-600,
- [class*="bg-brand-500/"],
- [class*="bg-brand-600/"]
+ .bg-brand-600
)
svg:not([class*="text-"]) {
@apply text-white;
diff --git a/src/pages/ProfilePage.tsx b/src/pages/ProfilePage.tsx
index d955d1c..bc116cd 100644
--- a/src/pages/ProfilePage.tsx
+++ b/src/pages/ProfilePage.tsx
@@ -1,111 +1,132 @@
-import { useEffect, useState } from "react"
+import { useEffect, useState } from "react";
+import { Pencil, User } from "lucide-react";
+import { toast } from "sonner";
+import { notifyApiError } from "../lib/apiErrors";
+import { getTeamMe, updateTeamMe } from "../api/team.api";
+import { Badge } from "../components/ui/badge";
+import { Button } from "../components/ui/button";
import {
- BadgeCheck,
- CalendarDays,
- Clock3,
- Mail,
- Phone,
- Shield,
- User,
-} from "lucide-react"
-import { toast } from "sonner"
-import { notifyApiError } from "../lib/apiErrors"
-import { getTeamMe, updateTeamMe } from "../api/team.api"
-import { Badge } from "../components/ui/badge"
-import { Button } from "../components/ui/button"
-import { Card, CardContent, CardHeader, CardTitle } from "../components/ui/card"
+ Card,
+ CardContent,
+ CardHeader,
+ CardTitle,
+} from "../components/ui/card";
import {
Dialog,
DialogContent,
- DialogFooter,
- DialogHeader,
+ DialogDescription,
DialogTitle,
-} from "../components/ui/dialog"
-import { Input } from "../components/ui/input"
-import { SpinnerIcon } from "../components/ui/spinner-icon"
-import { Textarea } from "../components/ui/textarea"
-import { cn } from "../lib/utils"
-import type { TeamMeProfile } from "../types/team.types"
-import { ProfileAvatarUpload } from "../components/profile/ProfileAvatarUpload"
-import { PersonaProfilePictureUploadField } from "./personas/components/PersonaProfilePictureUploadField"
+} from "../components/ui/dialog";
+import { Input } from "../components/ui/input";
+import { SpinnerIcon } from "../components/ui/spinner-icon";
+import { Textarea } from "../components/ui/textarea";
+import { cn } from "../lib/utils";
+import type { TeamMeProfile } from "../types/team.types";
+import { ProfileAvatarUpload } from "../components/profile/ProfileAvatarUpload";
+import { PersonaProfilePictureUploadField } from "./personas/components/PersonaProfilePictureUploadField";
function formatDate(dateStr: string | null | undefined): string {
- if (!dateStr) return "—"
- const date = new Date(dateStr)
- if (Number.isNaN(date.getTime())) return dateStr
+ if (!dateStr) return "—";
+ const date = new Date(dateStr);
+ if (Number.isNaN(date.getTime())) return dateStr;
return date.toLocaleDateString(undefined, {
year: "numeric",
month: "long",
day: "numeric",
- })
+ });
}
function formatDateTime(dateStr: string | null | undefined): string {
- if (!dateStr) return "—"
- const date = new Date(dateStr)
- if (Number.isNaN(date.getTime())) return dateStr
+ if (!dateStr) return "—";
+ const date = new Date(dateStr);
+ if (Number.isNaN(date.getTime())) return dateStr;
return date.toLocaleString(undefined, {
year: "numeric",
month: "short",
day: "numeric",
hour: "2-digit",
minute: "2-digit",
- })
+ });
}
function formatRoleLabel(role: string): string {
- const value = role.trim()
- if (!value) return "—"
+ const value = role.trim();
+ if (!value) return "—";
return value
.split("_")
.map((part) => part.charAt(0).toUpperCase() + part.slice(1).toLowerCase())
- .join(" ")
-}
-
-function formatStatusLabel(status: string): string {
- const value = status.trim()
- if (!value) return "—"
- return value.charAt(0).toUpperCase() + value.slice(1).toLowerCase()
+ .join(" ");
}
function displayValue(value: string | null | undefined): string {
- const trimmed = value?.trim()
- return trimmed ? trimmed : "—"
+ const trimmed = value?.trim();
+ return trimmed ? trimmed : "—";
}
-function ReadOnlyField({ label, value }: { label: string; value: string }) {
+function FieldGroup({
+ label,
+ value,
+ mono,
+}: {
+ label: string;
+ value: string;
+ mono?: boolean;
+}) {
return (
-
-
{label}
-
{value}
+
- )
+ );
+}
+
+function SectionCard({
+ title,
+ children,
+}: {
+ title: string;
+ children: React.ReactNode;
+}) {
+ return (
+
+
+
+ {title}
+
+
+ {children}
+
+ );
}
function LoadingSkeleton() {
return (
-
+
-
-
- {[1, 2].map((item) => (
-
- ))}
-
+
+
+
- )
+ );
}
type EditFormState = {
- first_name: string
- last_name: string
- phone_number: string
- department: string
- job_title: string
- profile_picture_url: string
- bio: string
- work_phone: string
-}
+ first_name: string;
+ last_name: string;
+ phone_number: string;
+ department: string;
+ job_title: string;
+ profile_picture_url: string;
+ bio: string;
+ work_phone: string;
+};
function profileToEditForm(profile: TeamMeProfile): EditFormState {
return {
@@ -117,16 +138,16 @@ function profileToEditForm(profile: TeamMeProfile): EditFormState {
profile_picture_url: profile.profile_picture_url ?? "",
bio: profile.bio ?? "",
work_phone: profile.work_phone ?? "",
- }
+ };
}
export function ProfilePage() {
- const [profile, setProfile] = useState
(null)
- const [loading, setLoading] = useState(true)
- const [error, setError] = useState(null)
- const [editing, setEditing] = useState(false)
- const [saving, setSaving] = useState(false)
- const [uploadingPicture, setUploadingPicture] = useState(false)
+ const [profile, setProfile] = useState(null);
+ const [loading, setLoading] = useState(true);
+ const [error, setError] = useState(null);
+ const [editing, setEditing] = useState(false);
+ const [saving, setSaving] = useState(false);
+ const [uploadingPicture, setUploadingPicture] = useState(false);
const [editForm, setEditForm] = useState({
first_name: "",
last_name: "",
@@ -136,48 +157,48 @@ export function ProfilePage() {
profile_picture_url: "",
bio: "",
work_phone: "",
- })
+ });
- const busy = saving || uploadingPicture
+ const busy = saving || uploadingPicture;
const loadProfile = async () => {
- setLoading(true)
- setError(null)
+ setLoading(true);
+ setError(null);
try {
- const res = await getTeamMe()
- setProfile(res.data.data)
+ const res = await getTeamMe();
+ setProfile(res.data.data);
} catch (err) {
- console.error("Failed to fetch profile", err)
- setProfile(null)
- setError("Failed to load profile. Please try again later.")
+ console.error("Failed to fetch profile", err);
+ setProfile(null);
+ setError("Failed to load profile. Please try again later.");
} finally {
- setLoading(false)
+ setLoading(false);
}
- }
+ };
useEffect(() => {
- void loadProfile()
- }, [])
+ void loadProfile();
+ }, []);
const startEditing = () => {
- if (!profile) return
- setEditForm(profileToEditForm(profile))
- setUploadingPicture(false)
- setEditing(true)
- }
+ if (!profile) return;
+ setEditForm(profileToEditForm(profile));
+ setUploadingPicture(false);
+ setEditing(true);
+ };
const handleSave = async () => {
- if (!profile) return
+ if (!profile) return;
- const firstName = editForm.first_name.trim()
- const lastName = editForm.last_name.trim()
+ const firstName = editForm.first_name.trim();
+ const lastName = editForm.last_name.trim();
if (!firstName || !lastName) {
- toast.error("First name and last name are required")
- return
+ toast.error("First name and last name are required");
+ return;
}
- setSaving(true)
+ setSaving(true);
try {
const res = await updateTeamMe({
first_name: firstName,
@@ -188,26 +209,26 @@ export function ProfilePage() {
profile_picture_url: editForm.profile_picture_url.trim(),
bio: editForm.bio.trim(),
work_phone: editForm.work_phone.trim(),
- })
- setProfile(res.data.data)
- setEditing(false)
- toast.success(res.data.message || "Profile updated successfully")
+ });
+ setProfile(res.data.data);
+ setEditing(false);
+ toast.success(res.data.message || "Profile updated successfully");
} catch (err) {
- console.error("Failed to update profile", err)
- notifyApiError(err, "Failed to update profile")
+ console.error("Failed to update profile", err);
+ notifyApiError(err, "Failed to update profile");
} finally {
- setSaving(false)
+ setSaving(false);
}
- }
+ };
- if (loading) return
+ if (loading) return ;
if (error || !profile) {
return (
-
-
+
+
-
+
@@ -224,224 +245,286 @@ export function ProfilePage() {
- )
+ );
}
- const fullName = `${profile.first_name} ${profile.last_name}`.trim()
- const initials = `${profile.first_name?.[0] ?? ""}${profile.last_name?.[0] ?? ""}`.toUpperCase()
- const isActive = profile.status.toLowerCase() === "active"
+ const fullName = `${profile.first_name} ${profile.last_name}`.trim();
+ const initials =
+ `${profile.first_name?.[0] ?? ""}${profile.last_name?.[0] ?? ""}`.toUpperCase();
const handleProfileUpdate = (nextProfile: TeamMeProfile) => {
- setProfile(nextProfile)
+ setProfile(nextProfile);
setEditForm((prev) => ({
...prev,
profile_picture_url: nextProfile.profile_picture_url ?? "",
- }))
- }
+ }));
+ };
return (
-
-
-
-
Account
-
My profile
-
- Your team account details from the admin directory.
-
-
-
-
+
+
+ My Profile
+
-
-
-
-
-
-
-
-
{fullName}
-
{displayValue(profile.job_title)}
+ {/* Hero */}
+
+
+
+
+
+
+ {fullName}
+
+
+
+ {formatRoleLabel(profile.team_role)}
+
+ {profile.job_title?.trim() && (
+
+ {profile.job_title}
+
+ )}
+
+ {profile.email_verified ? "Verified" : "Unverified"}
+
-
-
- {formatStatusLabel(profile.status)}
-
-
- {profile.email_verified ? "Email verified" : "Email not verified"}
-
-
- {profile.bio?.trim() ? (
- {profile.bio.trim()}
- ) : null}
+
-
-
-
- Work details
-
-
-
-
-
-
-
-
+ {/* Personal Information */}
+
+
+
-
-
- Contact
-
-
-
-
- {displayValue(profile.email)}
-
-
-
-
{displayValue(profile.phone_number)}
-
- {profile.work_phone?.trim() ? (
-
-
-
- Work:
- {profile.work_phone.trim()}
-
-
- ) : null}
-
-
+ {/* Work Details */}
+
+
+
+
+
+
+
+
-
-
- Account activity
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ {/* Account Activity */}
+
+
+
+
+
+
+
+
+ {/* Edit dialog */}