Skip to content

Commit d0f60aa

Browse files
gantoineclaude
andcommitted
feat(discord-presence): pause preview timer and show idle when disabled
When Rich Presence is off, the in-settings preview now stops its elapsed timer, falls back to the idle state (amber pause badge), and locks the Running/Idle toggle so the dormant integration reads clearly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent df4563f commit d0f60aa

1 file changed

Lines changed: 20 additions & 10 deletions

File tree

apps/code/src/renderer/features/settings/components/sections/DiscordPresencePreview.tsx

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,17 @@ export function DiscordPresencePreview({
3535
const [running, setRunning] = useState(true);
3636
const [elapsed, setElapsed] = useState(197); // 3:17, like a session in progress
3737

38-
// Tick the elapsed timer so the card feels live, the way Discord shows it.
38+
// While enabled, tick the elapsed timer so the card feels live, the way
39+
// Discord shows it. When disabled, the integration is dormant: stop the timer
40+
// and fall back to the idle state.
3941
useEffect(() => {
42+
if (!enabled) {
43+
setRunning(false);
44+
return;
45+
}
4046
const interval = setInterval(() => setElapsed((s) => s + 1), 1000);
4147
return () => clearInterval(interval);
42-
}, []);
48+
}, [enabled]);
4349

4450
const details = showTaskTitle
4551
? `Working on "${SAMPLE_TASK_TITLE}"`
@@ -55,14 +61,18 @@ export function DiscordPresencePreview({
5561
className="border-gray-6 border-t pt-4"
5662
>
5763
<Text className="font-medium text-sm">Preview</Text>
58-
<SegmentedControl.Root
59-
size="1"
60-
value={running ? "running" : "idle"}
61-
onValueChange={(value) => setRunning(value === "running")}
62-
>
63-
<SegmentedControl.Item value="running">Running</SegmentedControl.Item>
64-
<SegmentedControl.Item value="idle">Idle</SegmentedControl.Item>
65-
</SegmentedControl.Root>
64+
<div className={enabled ? "" : "pointer-events-none opacity-50"}>
65+
<SegmentedControl.Root
66+
size="1"
67+
value={running ? "running" : "idle"}
68+
onValueChange={(value) => setRunning(value === "running")}
69+
>
70+
<SegmentedControl.Item value="running">
71+
Running
72+
</SegmentedControl.Item>
73+
<SegmentedControl.Item value="idle">Idle</SegmentedControl.Item>
74+
</SegmentedControl.Root>
75+
</div>
6676
</Flex>
6777

6878
<div

0 commit comments

Comments
 (0)