mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-08-24 16:04:03 +00:00
Nova mobile pass - viewport: viewportFit cover for iOS safe-area-inset - safe-area utilities (pb-safe, pt-safe, bottom-safe-5, scroll-fade-x) in globals.css - chat FAB pinned above iPhone home indicator; chat sidebar widths responsive across sm/md/lg with min() clamps - chat input CoT panel max-h capped via min(60dvh, 420px) - header tab strip swapped from visible scrollbar to scroll-fade-x mask + snap-x - nova empty state uses svh on mobile, dvh from sm up Add-memory modal rebuilt for mobile - mobile shell switched from fullscreen Dialog to vaul Drawer at 85svh with swipe-down dismissal and scaled background - in-modal header removed; tabs moved to the bottom of the sheet for thumb reach - four tab compactLabels: Note, Links, Files, Connections - desktop tabs now render only when !isMobile (no DOM duplication) - note/link content state lifted to parent so switching tabs preserves typed input - NoteContent snapshots initialContent via lazy useState so the editor isn't reset on every keystroke - shared Drawer base uses rounded-t-xl - removed legacy pt-4 on tab content for mobile Connections — replace expiresAt with sync-run health - new useConnectionHealth hook reads the latest sync run and matches auth-failure patterns; backend errorKind field still needed (TODO) - regex tightened so 401/403 require co-occurring auth/token/grant context; refresh_token requires expired/revoked/invalid/missing qualifier - badge label changed Disconnected -> Needs reauth - Reconnect button replaces the sync action when needsReauth, kicks off the same OAuth flow - per-row reconnect tracking via mutation.variables instead of a single shared id (no race when multiple rows clicked) - fallback toast when authLink is missing so the spinner can't get stuck - sync history panel timeline capped at max-h-260 with internal scroll - useSyncRuns no longer refetches on mount; cache (30s) actually applies, cutting N requests per modal open
95 lines
2.1 KiB
TypeScript
95 lines
2.1 KiB
TypeScript
import { cn } from "@lib/utils"
|
|
import { dmSans125ClassName } from "@/lib/fonts"
|
|
import { formatRelativeTime } from "@/components/settings/sync-utils"
|
|
|
|
function deriveStatus(
|
|
syncInProgress?: boolean,
|
|
lastSyncedAt?: number,
|
|
isExpired?: boolean,
|
|
): "syncing" | "synced" | "expired" | "idle" {
|
|
if (isExpired) return "expired"
|
|
if (syncInProgress) return "syncing"
|
|
if (lastSyncedAt) return "synced"
|
|
return "idle"
|
|
}
|
|
|
|
interface SyncStatusBadgeProps {
|
|
syncInProgress?: boolean
|
|
lastSyncedAt?: number
|
|
isExpired?: boolean
|
|
className?: string
|
|
}
|
|
|
|
export function SyncStatusBadge({
|
|
syncInProgress,
|
|
lastSyncedAt,
|
|
isExpired,
|
|
className,
|
|
}: SyncStatusBadgeProps) {
|
|
const status = deriveStatus(syncInProgress, lastSyncedAt, isExpired)
|
|
|
|
return (
|
|
<div className={cn("flex items-center gap-1.5", className)}>
|
|
<div
|
|
className={cn(
|
|
"size-[6px] rounded-full",
|
|
status === "syncing" && "bg-[#4BA0FA] animate-pulse",
|
|
status === "synced" && "bg-[#00AC3F]",
|
|
status === "expired" && "bg-[#EF4444]",
|
|
status === "idle" && "bg-[#737373]",
|
|
)}
|
|
/>
|
|
{status === "syncing" && (
|
|
<span
|
|
className={cn(
|
|
dmSans125ClassName(),
|
|
"font-medium text-[13px] tracking-[-0.13px] text-[#4BA0FA]",
|
|
)}
|
|
>
|
|
Syncing...
|
|
</span>
|
|
)}
|
|
{status === "synced" && (
|
|
<>
|
|
<span
|
|
className={cn(
|
|
dmSans125ClassName(),
|
|
"font-medium text-[13px] tracking-[-0.13px] text-[#00AC3F]",
|
|
)}
|
|
>
|
|
Synced
|
|
</span>
|
|
<div className="size-[3px] rounded-full bg-[#737373]" />
|
|
<span
|
|
className={cn(
|
|
dmSans125ClassName(),
|
|
"font-medium text-[12px] tracking-[-0.12px] text-[#737373]",
|
|
)}
|
|
>
|
|
{formatRelativeTime(lastSyncedAt)}
|
|
</span>
|
|
</>
|
|
)}
|
|
{status === "expired" && (
|
|
<span
|
|
className={cn(
|
|
dmSans125ClassName(),
|
|
"font-medium text-[13px] tracking-[-0.13px] text-[#EF4444]",
|
|
)}
|
|
>
|
|
Needs reauth
|
|
</span>
|
|
)}
|
|
{status === "idle" && (
|
|
<span
|
|
className={cn(
|
|
dmSans125ClassName(),
|
|
"font-medium text-[13px] tracking-[-0.13px] text-[#737373]",
|
|
)}
|
|
>
|
|
Waiting for first sync
|
|
</span>
|
|
)}
|
|
</div>
|
|
)
|
|
}
|