style: show lock icon for encrypted profiles

This commit is contained in:
zhom
2026-03-02 19:12:11 +04:00
parent 23d25928fc
commit 0d793e4cd8
+26 -5
View File
@@ -202,7 +202,12 @@ type TableMeta = {
getProfileLockEmail: (profileId: string) => string | undefined; getProfileLockEmail: (profileId: string) => string | undefined;
}; };
type SyncStatusDot = { color: string; tooltip: string; animate: boolean }; type SyncStatusDot = {
color: string;
tooltip: string;
animate: boolean;
encrypted: boolean;
};
function getProfileSyncStatusDot( function getProfileSyncStatusDot(
profile: BrowserProfile, profile: BrowserProfile,
@@ -215,6 +220,7 @@ function getProfileSyncStatusDot(
| undefined, | undefined,
errorMessage?: string, errorMessage?: string,
): SyncStatusDot | null { ): SyncStatusDot | null {
const encrypted = profile.sync_mode === "Encrypted";
const status = const status =
liveStatus ?? liveStatus ??
(profile.sync_mode && profile.sync_mode !== "Disabled" (profile.sync_mode && profile.sync_mode !== "Disabled"
@@ -223,12 +229,18 @@ function getProfileSyncStatusDot(
switch (status) { switch (status) {
case "syncing": case "syncing":
return { color: "bg-yellow-500", tooltip: "Syncing...", animate: true }; return {
color: "bg-yellow-500",
tooltip: "Syncing...",
animate: true,
encrypted,
};
case "waiting": case "waiting":
return { return {
color: "bg-yellow-500", color: "bg-yellow-500",
tooltip: "Waiting to sync", tooltip: "Waiting to sync",
animate: false, animate: false,
encrypted,
}; };
case "synced": case "synced":
return { return {
@@ -237,12 +249,14 @@ function getProfileSyncStatusDot(
? `Synced ${new Date(profile.last_sync * 1000).toLocaleString()}` ? `Synced ${new Date(profile.last_sync * 1000).toLocaleString()}`
: "Synced", : "Synced",
animate: false, animate: false,
encrypted,
}; };
case "error": case "error":
return { return {
color: "bg-red-500", color: "bg-red-500",
tooltip: errorMessage ? `Sync error: ${errorMessage}` : "Sync error", tooltip: errorMessage ? `Sync error: ${errorMessage}` : "Sync error",
animate: false, animate: false,
encrypted,
}; };
case "disabled": case "disabled":
if (profile.last_sync) { if (profile.last_sync) {
@@ -250,6 +264,7 @@ function getProfileSyncStatusDot(
color: "bg-gray-400", color: "bg-gray-400",
tooltip: `Sync disabled, last sync ${formatRelativeTime(profile.last_sync)}`, tooltip: `Sync disabled, last sync ${formatRelativeTime(profile.last_sync)}`,
animate: false, animate: false,
encrypted: false,
}; };
} }
return null; return null;
@@ -2303,9 +2318,15 @@ export function ProfilesDataTable({
<Tooltip> <Tooltip>
<TooltipTrigger asChild> <TooltipTrigger asChild>
<span className="flex justify-center items-center w-3 h-3"> <span className="flex justify-center items-center w-3 h-3">
<span {dot.encrypted ? (
className={`w-2 h-2 rounded-full ${dot.color}${dot.animate ? " animate-pulse" : ""}`} <LuLock
/> className={`w-3 h-3 ${dot.color.replace("bg-", "text-")}${dot.animate ? " animate-pulse" : ""}`}
/>
) : (
<span
className={`w-2 h-2 rounded-full ${dot.color}${dot.animate ? " animate-pulse" : ""}`}
/>
)}
</span> </span>
</TooltipTrigger> </TooltipTrigger>
<TooltipContent>{dot.tooltip}</TooltipContent> <TooltipContent>{dot.tooltip}</TooltipContent>