Skip to content

Commit 5e50806

Browse files
committed
fix(docs): only show red connection dot after 5s disconnect
No green/syncing dots — only a red indicator appears after 5 seconds of disconnection. Connected state shows no dot at all.
1 parent 6f6dcac commit 5e50806

2 files changed

Lines changed: 20 additions & 23 deletions

File tree

apps/web/src/features/docs/DocsEditorPage.tsx

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -88,30 +88,24 @@ const SIDEBAR_TABS = [
8888
];
8989

9090
function EditorFAB({
91-
connectionStatus,
91+
showDisconnected,
9292
sidebarOpen,
9393
onToggleSidebar,
9494
}: {
95-
connectionStatus: 'connected' | 'syncing' | 'disconnected';
95+
showDisconnected: boolean;
9696
sidebarOpen: boolean;
9797
onToggleSidebar: () => void;
9898
}) {
99-
const statusColors = {
100-
connected: 'bg-emerald-500',
101-
syncing: 'bg-amber-500 animate-pulse',
102-
disconnected: 'bg-red-500',
103-
};
104-
10599
return (
106100
<button
107101
className={`fixed bottom-6 right-6 w-12 h-12 rounded-full flex items-center justify-center bg-white/85 dark:bg-grey-900/85 backdrop-blur-xl border border-black/8 dark:border-white/10 shadow-lg cursor-pointer z-[150] transition-all hover:bg-white/95 dark:hover:bg-grey-800/95 hover:shadow-xl active:scale-95 [&_svg]:w-[22px] [&_svg]:h-[22px] [&_svg]:text-grey-700 dark:[&_svg]:text-grey-300 ${sidebarOpen ? 'bg-secondary-100 dark:bg-secondary-600/25 border-secondary-400 dark:border-secondary-600 z-[250] [&_svg]:text-secondary-700 dark:[&_svg]:text-secondary-400' : ''}`}
108102
onClick={onToggleSidebar}
109103
aria-label="Seitenleiste ein-/ausblenden"
110104
>
111105
<FiSidebar />
112-
<span
113-
className={`absolute top-0.5 right-0.5 w-2 h-2 rounded-full border-[1.5px] border-white/90 dark:border-grey-900/90 ${statusColors[connectionStatus]}`}
114-
/>
106+
{showDisconnected && (
107+
<span className="absolute top-0.5 right-0.5 w-2 h-2 rounded-full border-[1.5px] border-white/90 dark:border-grey-900/90 bg-red-500" />
108+
)}
115109
</button>
116110
);
117111
}
@@ -306,6 +300,20 @@ function EditorContent() {
306300

307301
const initialContent = useMemo(() => docData?.content || '', [docData?.content]);
308302

303+
const [showDisconnected, setShowDisconnected] = useState(false);
304+
useEffect(() => {
305+
if (isConnected) {
306+
setShowDisconnected(false);
307+
return;
308+
}
309+
const timer = setTimeout(() => setShowDisconnected(true), 5000);
310+
return () => clearTimeout(timer);
311+
}, [isConnected]);
312+
313+
const connectionStatus: 'disconnected' | undefined = showDisconnected
314+
? 'disconnected'
315+
: undefined;
316+
309317
if (docIsLoading) {
310318
return <div className="flex items-center justify-center h-full" />;
311319
}
@@ -325,8 +333,6 @@ function EditorContent() {
325333
</div>
326334
);
327335
}
328-
329-
const connectionStatus = !isConnected ? 'disconnected' : !isSynced ? 'syncing' : 'connected';
330336
const localUser = getLocalUser();
331337

332338
return (
@@ -352,7 +358,7 @@ function EditorContent() {
352358

353359
{isEmbedded ? (
354360
<EditorFAB
355-
connectionStatus={connectionStatus}
361+
showDisconnected={showDisconnected}
356362
sidebarOpen={sidebarOpen}
357363
onToggleSidebar={toggleSidebar}
358364
/>

packages/shared/src/components/EditorTopBar/EditorTopBar.css

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -142,15 +142,6 @@
142142
flex-shrink: 0;
143143
}
144144

145-
.status-dot.connected {
146-
background: #10b981;
147-
}
148-
149-
.status-dot.syncing {
150-
background: #f59e0b;
151-
animation: editorTopBarPulse 1.5s ease-in-out infinite;
152-
}
153-
154145
.status-dot.disconnected {
155146
background: #ef4444;
156147
}

0 commit comments

Comments
 (0)