Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

SettingsRouteScreen.tsx

700 lines24.5 KB

1import { useAuth, useUser } from "@clerk/expo";
2import { useAtomSet, useAtomValue } from "@effect/atom-react";
3import Constants from "expo-constants";
4import * as Notifications from "expo-notifications";
5import { useNavigation } from "@react-navigation/native";
6import { NativeStackScreenOptions } from "../../native/StackHeader";
7import { SymbolView } from "../../components/AppSymbol";
8import * as Effect from "effect/Effect";
9import { AsyncResult } from "effect/unstable/reactivity";
10import { useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
11import { Alert, Linking, Platform, Pressable, ScrollView, View } from "react-native";
12import { useSafeAreaInsets } from "react-native-safe-area-context";
13​
14import {
15 isAtomCommandInterrupted,
16 reportAtomCommandResult,
17 settleAsyncResult,
18 settlePromise,
19 squashAtomCommandFailure,
20} from "@t3tools/client-runtime/state/runtime";
21import { AndroidScreenHeader } from "../../components/AndroidScreenHeader";
22import { AppText as Text } from "../../components/AppText";
23import { supportsAgentAwarenessPush } from "../agent-awareness/capabilities";
24import { setLiveActivityUpdatesEnabled } from "../agent-awareness/liveActivityPreferences";
25import { requestAgentNotificationPermission } from "../agent-awareness/notificationPermissions";
26import {
27 getAgentAwarenessRegistrationStatus,
28 refreshAgentAwarenessRegistration,
29 subscribeAgentAwarenessRegistrationStatus,
30} from "../agent-awareness/remoteRegistration";
31import { refreshManagedRelayEnvironments } from "../cloud/managedRelayState";
32import { hasCloudPublicConfig, resolveRelayClerkTokenOptions } from "../cloud/publicConfig";
33import { withNativeGlassHeaderItem } from "../layout/native-glass-header-items";
34import { WorkspaceSidebarToolbar } from "../layout/workspace-sidebar-toolbar";
35import { runtime } from "../../lib/runtime";
36import { mobilePreferencesAtom, updateMobilePreferencesAtom } from "../../state/preferences";
37import { useThreadListV2Enabled } from "../threads/use-thread-list-v2-enabled";
38import {
39 type AppUpdateCheckState,
40 isAppUpdateCheckAvailable,
41 registerHiddenUpdateTap,
42 runAppUpdateCheck,
43} from "../updates/app-updates";
44import { useSavedRemoteConnections } from "../../state/use-remote-environment-registry";
45import { SettingsRow } from "./components/SettingsRow";
46import { SettingsSection } from "./components/SettingsSection";
47import { SettingsSwitchRow } from "./components/SettingsSwitchRow";
48import { resolveAgentAwarenessPlatformPresentation } from "./SettingsRouteScreen.logic";
49​
50type NotificationStatus = "checking" | "enabled" | "disabled" | "unsupported";
51type LiveActivityStatus = "checking" | "enabled" | "disabled" | "signed-out" | "linking";
52​
53// Reflects whether the relay actually accepted this device's registration.
54// The notification and Live Activity switches are gated on this so they can
55// never read as enabled when the device cannot receive anything (e.g. the
56// registration request timed out).
57function useDeviceRegistered(): boolean {
58 const status = useSyncExternalStore(
59 subscribeAgentAwarenessRegistrationStatus,
60 getAgentAwarenessRegistrationStatus,
61 () => "unknown" as const,
62 );
63 return status === "registered";
65​
66export function SettingsRouteScreen() {
67 const navigation = useNavigation();
68​
69 return (
70 <>
71 <WorkspaceSidebarToolbar />
72 {Platform.OS === "android" ? (
73 <>
74 {/* Android renders its own in-screen header instead of the native bar. */}
75 <NativeStackScreenOptions options={{ headerShown: false }} />
76 <AndroidScreenHeader title="Settings" onBack={() => navigation.goBack()} />
77 </>
78 ) : (
79 <NativeStackScreenOptions
80 options={{
81 unstable_headerRightItems:
82 Platform.OS === "ios"
83 ? () => [
84 withNativeGlassHeaderItem({
85 accessibilityLabel: "Close settings",
86 icon: { name: "xmark", type: "sfSymbol" } as const,
87 identifier: "settings-close",
88 label: "",
89 onPress: () => navigation.goBack(),
90 type: "button",
91 }),
92 ]
93 : undefined,
94 }}
95 />
96 )}
97 {hasCloudPublicConfig() ? <ConfiguredSettingsRouteScreen /> : <LocalSettingsRouteScreen />}
98 </>
99 );
101​
102function LocalSettingsRouteScreen() {
103 const insets = useSafeAreaInsets();
104 const { savedConnectionsById } = useSavedRemoteConnections();
105 const environmentCount = Object.keys(savedConnectionsById).length;
106​
107 return (
108 <View collapsable={false} className="flex-1 bg-sheet">
109 <ScrollView
110 contentInsetAdjustmentBehavior="automatic"
111 showsVerticalScrollIndicator={false}
112 className="flex-1"
113 contentContainerClassName="gap-6 px-5 pt-4"
114 contentContainerStyle={{
115 paddingBottom: Math.max(insets.bottom, 18) + 18,
116 }}
117 >
118 <SettingsSection title="Configuration">
119 <SettingsRow
120 icon="desktopcomputer"
121 label="Environments"
122 value={`${environmentCount}`}
123 target="SettingsEnvironments"
124 />
125 </SettingsSection>
126​
127 <GeneralSettingsSection />
128​
129 <SettingsSection title="Appearance">
130 <SettingsRow icon="paintbrush" label="Appearance" target="SettingsAppearance" />
131 </SettingsSection>
132​
133 <LegacySettingsSection />
134​
135 <ArchivedThreadsSettingsSection />
136​
137 <AppSettingsSection />
138 </ScrollView>
139 </View>
140 );
142​
143function ConfiguredSettingsRouteScreen() {
144 const preferencesResult = useAtomValue(mobilePreferencesAtom);
145 const savePreferences = useAtomSet(updateMobilePreferencesAtom);
146 const agentAwarenessPushAvailable = supportsAgentAwarenessPush();
147 const agentAwarenessPlatform = resolveAgentAwarenessPlatformPresentation(Platform.OS);
148 const insets = useSafeAreaInsets();
149 const navigation = useNavigation();
150 const { getToken, isLoaded, isSignedIn } = useAuth({ treatPendingAsSignedOut: false });
151 const { user } = useUser();
152 const { savedConnectionsById } = useSavedRemoteConnections();
153 const [notificationStatus, setNotificationStatus] = useState<NotificationStatus>("checking");
154 const [liveActivityStatus, setLiveActivityStatus] = useState<LiveActivityStatus>("checking");
155 const deviceRegistered = useDeviceRegistered();
156 const liveActivitiesPreferenceEnabled = AsyncResult.isSuccess(preferencesResult)
157 ? preferencesResult.value.liveActivitiesEnabled !== false
158 : true;
159​
160 const connections = useMemo(() => Object.values(savedConnectionsById), [savedConnectionsById]);
161 const environmentCount = connections.length;
162 const accountLabel = useMemo(() => {
163 if (!isLoaded) return "Checking";
164 if (!isSignedIn) return "Sign in";
165 return user?.primaryEmailAddress?.emailAddress ?? "Signed in";
166 }, [isLoaded, isSignedIn, user?.primaryEmailAddress?.emailAddress]);
167​
168 const refreshNotifications = useCallback(async () => {
169 if (process.env.EXPO_OS !== "ios") {
170 setNotificationStatus("unsupported");
171 return;
172 }
173 const result = await settlePromise(() => Notifications.getPermissionsAsync());
174 if (result._tag === "Failure") {
175 reportAtomCommandResult(result, { label: "notification permission refresh" });
176 setNotificationStatus("disabled");
177 return;
178 }
179 setNotificationStatus(result.value.granted ? "enabled" : "disabled");
180 }, []);
181​
182 useEffect(() => {
183 void refreshNotifications();
184 }, [refreshNotifications]);
185​
186 useEffect(() => {
187 if (!isLoaded) {
188 setLiveActivityStatus("checking");
189 return;
190 }
191 if (!isSignedIn) {
192 setLiveActivityStatus("signed-out");
193 return;
194 }
195 if (!AsyncResult.isSuccess(preferencesResult)) {
196 if (AsyncResult.isFailure(preferencesResult)) {
197 reportAtomCommandResult(preferencesResult, { label: "live activity preference load" });
198 setLiveActivityStatus("enabled");
199 } else {
200 setLiveActivityStatus("checking");
201 }
202 return;
203 }
204 setLiveActivityStatus(
205 preferencesResult.value.liveActivitiesEnabled === false ? "disabled" : "enabled",
206 );
207 }, [isLoaded, isSignedIn, preferencesResult]);
208​
209 const requestNotifications = useCallback(async () => {
210 const result = await settleAsyncResult(() =>
211 runtime.runPromiseExit(
212 requestAgentNotificationPermission.pipe(
213 Effect.tap((permission) =>
214 permission.type === "granted" ? refreshAgentAwarenessRegistration() : Effect.void,
215 ),
216 ),
217 ),
218 );
219 if (result._tag === "Failure") {
220 if (!isAtomCommandInterrupted(result)) {
221 const error = squashAtomCommandFailure(result);
222 Alert.alert(
223 "Notifications unavailable",
224 error instanceof Error ? error.message : "Could not request notification permission.",
225 );
226 }
227 return;
228 }
229 if (result.value.type === "granted") {
230 setNotificationStatus("enabled");
231 // Permission alone is not enough: the switch stays off until the relay
232 // registration succeeds, so tell the user the truth about which happened.
233 if (getAgentAwarenessRegistrationStatus() === "registered") {
234 Alert.alert(
235 "Notifications enabled",
236 "Live Activity notifications are enabled for this device.",
237 );
238 } else {
239 Alert.alert(
240 "Couldn't finish enabling notifications",
241 "Notification access was granted, but this device could not be registered with T3 Connect. Notifications will start once registration succeeds.",
242 );
243 }
244 return;
245 }
246 if (result.value.type === "unsupported") {
247 setNotificationStatus("unsupported");
248 Alert.alert(
249 "Notifications unavailable",
250 "Live Activity notifications are only available on iOS.",
251 );
252 return;
253 }
254 setNotificationStatus("disabled");
255 if (result.value.canAskAgain) {
256 Alert.alert("Notifications disabled", "Notifications were not enabled.");
257 return;
258 }
259 Alert.alert(
260 "Notifications disabled",
261 "Notifications were denied for this app. Open Settings to enable them.",
262 [
263 { text: "Cancel", style: "cancel" },
264 { text: "Open Settings", onPress: () => void Linking.openSettings() },
265 ],
266 );
267 }, []);
268​
269 const promptSignIn = useCallback(() => {
270 Alert.alert(
271 "Sign in to T3 Connect",
272 "Live Activity updates require T3 Connect so relay can deliver updates to this device.",
273 [
274 { text: "Cancel", style: "cancel" },
275 {
276 text: "Continue",
277 onPress: () => navigation.navigate("SettingsSheet", { screen: "SettingsAuth" }),
278 },
279 ],
280 );
281 }, [navigation]);
282​
283 const linkEnvironments = useCallback(async () => {
284 if (!isSignedIn) {
285 promptSignIn();
286 return;
287 }
288​
289 setLiveActivityStatus("linking");
290 const tokenResult = await settlePromise(() => getToken(resolveRelayClerkTokenOptions()));
291 if (tokenResult._tag === "Failure") {
292 setLiveActivityStatus("disabled");
293 const error = squashAtomCommandFailure(tokenResult);
294 Alert.alert(
295 "Live Activities unavailable",
296 error instanceof Error ? error.message : "Could not enable Live Activity updates.",
297 );
298 return;
299 }
300 if (!tokenResult.value) {
301 promptSignIn();
302 setLiveActivityStatus("signed-out");
303 return;
304 }
305​
306 const updateResult = await settleAsyncResult(() =>
307 runtime.runPromiseExit(
308 setLiveActivityUpdatesEnabled({
309 enabled: true,
310 previousEnabled: liveActivitiesPreferenceEnabled,
311 clerkToken: tokenResult.value,
312 connections,
313 }),
314 ),
315 );
316 if (updateResult._tag === "Failure") {
317 setLiveActivityStatus("disabled");
318 if (!isAtomCommandInterrupted(updateResult)) {
319 const error = squashAtomCommandFailure(updateResult);
320 Alert.alert(
321 "Live Activities unavailable",
322 error instanceof Error ? error.message : "Could not enable Live Activity updates.",
323 );
324 }
325 return;
326 }
327​
328 savePreferences({ liveActivitiesEnabled: true });
329 refreshManagedRelayEnvironments();
330 setLiveActivityStatus("enabled");
331 // The environment link can succeed while this device's own registration
332 // (the push-to-start token the relay needs) has not — don't claim Live
333 // Activities are live until the device is actually registered.
334 if (getAgentAwarenessRegistrationStatus() === "registered") {
335 Alert.alert(
336 "Live Activities enabled",
337 environmentCount > 0
338 ? `${environmentCount} environment${environmentCount === 1 ? "" : "s"} linked for Live Activity updates.`
339 : "Live Activity updates are enabled. Add an environment to start receiving updates.",
340 );
341 } else {
342 Alert.alert(
343 "Couldn't finish enabling Live Activities",
344 "This device could not be registered with T3 Connect, so Live Activities won't appear yet. They'll start once registration succeeds.",
345 );
346 }
347 }, [
348 connections,
349 environmentCount,
350 getToken,
351 isSignedIn,
352 liveActivitiesPreferenceEnabled,
353 promptSignIn,
354 savePreferences,
355 ]);
356​
357 const handleDeviceNotificationsChange = useCallback(
358 (enabled: boolean) => {
359 if (enabled) {
360 void requestNotifications();
361 return;
362 }
363​
364 Alert.alert(
365 "Disable notifications",
366 "Notification permission is controlled by iOS. Open Settings to disable notifications for T3 Code.",
367 [
368 { text: "Cancel", style: "cancel" },
369 { text: "Open Settings", onPress: () => void Linking.openSettings() },
370 ],
371 );
372 },
373 [requestNotifications],
374 );
375​
376 const handleLiveActivitiesChange = useCallback(
377 (enabled: boolean) => {
378 if (!enabled) {
379 setLiveActivityStatus("disabled");
380 void (async () => {
381 let token: string | null = null;
382 if (isSignedIn) {
383 const tokenResult = await settlePromise(() =>
384 getToken(resolveRelayClerkTokenOptions()),
385 );
386 if (tokenResult._tag === "Failure") {
387 reportAtomCommandResult(tokenResult, {
388 label: "live activity disable token lookup",
389 });
390 return;
391 }
392 token = tokenResult.value;
393 }
394​
395 const updateResult = await settleAsyncResult(() =>
396 runtime.runPromiseExit(
397 setLiveActivityUpdatesEnabled({
398 enabled: false,
399 previousEnabled: liveActivitiesPreferenceEnabled,
400 clerkToken: token,
401 connections,
402 }),
403 ),
404 );
405 if (updateResult._tag === "Failure") {
406 setLiveActivityStatus("enabled");
407 reportAtomCommandResult(updateResult, {
408 label: "live activity disable",
409 });
410 return;
411 }
412 savePreferences({ liveActivitiesEnabled: false });
413 refreshManagedRelayEnvironments();
414 })();
415 return;
416 }
417​
418 if (!isSignedIn) {
419 promptSignIn();
420 return;
421 }
422​
423 void linkEnvironments();
424 },
425 [
426 connections,
427 getToken,
428 isSignedIn,
429 linkEnvironments,
430 liveActivitiesPreferenceEnabled,
431 promptSignIn,
432 savePreferences,
433 ],
434 );
435​
436 const openAccount = useCallback(() => {
437 if (!isLoaded) return;
438 navigation.navigate("SettingsSheet", { screen: "SettingsAuth" });
439 }, [isLoaded, navigation]);
440​
441 return (
442 <View collapsable={false} className="flex-1 bg-sheet">
443 <ScrollView
444 contentInsetAdjustmentBehavior="automatic"
445 showsVerticalScrollIndicator={false}
446 className="flex-1"
447 contentContainerClassName="gap-6 px-5 pt-4"
448 contentContainerStyle={{
449 paddingBottom: Math.max(insets.bottom, 18) + 18,
450 }}
451 >
452 <View className="gap-3">
453 <SettingsSection title="Account">
454 <SettingsRow
455 icon="person.crop.circle"
456 label="T3 Account"
457 value={accountLabel}
458 onPress={openAccount}
459 />
460 </SettingsSection>
461 <Text className="px-2 text-sm text-foreground-muted">
462 T3 Code works locally without signing in. Cloud features are optional.
463 </Text>
464 </View>
465​
466 <SettingsSection title="Configuration">
467 <SettingsRow
468 icon="desktopcomputer"
469 label="Environments"
470 value={`${environmentCount}`}
471 target="SettingsEnvironments"
472 />
473 <SettingsSwitchRow
474 icon="bell.badge"
475 label="Device Notifications"
476 disabled={
477 !agentAwarenessPlatform.supported ||
478 !agentAwarenessPushAvailable ||
479 notificationStatus === "checking" ||
480 notificationStatus === "unsupported"
481 }
482 subtitle={agentAwarenessPlatform.subtitle}
483 // Only reads as on when this device is actually registered with the
484 // relay; otherwise notifications cannot be delivered regardless of
485 // the local iOS permission.
486 value={
487 agentAwarenessPushAvailable && notificationStatus === "enabled" && deviceRegistered
488 }
489 onValueChange={handleDeviceNotificationsChange}
490 />
491 <SettingsSwitchRow
492 disabled={
493 !agentAwarenessPlatform.supported ||
494 !agentAwarenessPushAvailable ||
495 !isLoaded ||
496 liveActivityStatus === "checking" ||
497 liveActivityStatus === "linking"
498 }
499 icon="bolt.circle"
500 label="Live Activity Updates"
501 subtitle={agentAwarenessPlatform.subtitle}
502 // Same gate: a saved preference is meaningless until the device
503 // registration the relay needs to push updates has succeeded.
504 value={
505 agentAwarenessPushAvailable &&
506 (liveActivityStatus === "enabled" || liveActivityStatus === "linking") &&
507 deviceRegistered
508 }
509 onValueChange={handleLiveActivitiesChange}
510 />
511 </SettingsSection>
512​
513 <GeneralSettingsSection />
514​
515 <SettingsSection title="Appearance">
516 <SettingsRow icon="paintbrush" label="Appearance" target="SettingsAppearance" />
517 </SettingsSection>
518​
519 <LegacySettingsSection />
520​
521 <ArchivedThreadsSettingsSection />
522​
523 <AppSettingsSection />
524 </ScrollView>
525 </View>
526 );
528​
529function GeneralSettingsSection() {
530 const preferencesResult = useAtomValue(mobilePreferencesAtom);
531 const savePreferences = useAtomSet(updateMobilePreferencesAtom);
532 const autoSettleOnMerge =
533 !AsyncResult.isSuccess(preferencesResult) ||
534 preferencesResult.value.autoSettleOnMerge !== false;
535​
536 return (
537 <SettingsSection title="General">
538 <SettingsRow icon="folder" label="Project Grouping" target="SettingsProjectGrouping" />
539 <SettingsSwitchRow
540 icon="arrow.triangle.branch"
541 label="Auto-settle merged threads"
542 value={autoSettleOnMerge}
543 onValueChange={(value) => savePreferences({ autoSettleOnMerge: value })}
544 />
545 <SettingsRow icon="chart.bar.xaxis" label="Usage" target="SettingsUsage" />
546 </SettingsSection>
547 );
549​
550/**
551 * Device-local legacy toggles. Mobile has no client-settings sync, so this is
552 * the counterpart of web's Settings → General → Legacy features backed by
553 * mobile preferences.
554 */
555function LegacySettingsSection() {
556 const savePreferences = useAtomSet(updateMobilePreferencesAtom);
557 const preferences = useAtomValue(mobilePreferencesAtom);
558 const threadListV2Enabled = useThreadListV2Enabled();
559 const planModeEnabled =
560 AsyncResult.isSuccess(preferences) && preferences.value.planModeEnabled === true;
561​
562 return (
563 <View className="gap-3">
564 <SettingsSection title="Legacy">
565 <SettingsSwitchRow
566 icon="sidebar.left"
567 label="Legacy Thread List"
568 value={!threadListV2Enabled}
569 onValueChange={(value) => savePreferences({ legacyThreadListEnabled: value })}
570 />
571 <SettingsSwitchRow
572 icon="hammer"
573 label="Plan Mode"
574 value={planModeEnabled}
575 onValueChange={(value) => savePreferences({ planModeEnabled: value })}
576 />
577 </SettingsSection>
578 <Text className="px-2 text-sm text-foreground-muted">
579 Opt into retired interfaces kept for compatibility. Plan Mode restores the Build/Plan
580 control; otherwise every task runs in Build mode.
581 </Text>
582 </View>
583 );
585​
586function AppSettingsSection() {
587 const [updateState, setUpdateState] = useState<AppUpdateCheckState>("idle");
588 const updateInFlight = useRef(false);
589 const hiddenUpdateTapCount = useRef(0);
590​
591 const version = Constants.expoConfig?.version ?? "0.0.0";
592 // Fall back to "production" to match resolveAppVariant in app.config.ts, so a
593 // missing variant never mislabels a production build as development.
594 const variant = (Constants.expoConfig?.extra?.appVariant as string | undefined) ?? "production";
595 const variantLabel = variant === "production" ? "" : capitalize(variant);
596 const versionLabel = variantLabel ? `${version} · ${variantLabel}` : version;
597 const updateCheckAvailable = isAppUpdateCheckAvailable();
598 const busy =
599 updateState === "checking" || updateState === "downloading" || updateState === "restarting";
600​
601 // "Up to date" is a transient acknowledgement, not a state worth persisting —
602 // return the version row to its normal, deliberately quiet state.
603 useEffect(() => {
604 if (updateState !== "current") return;
605 const timer = setTimeout(() => setUpdateState("idle"), 3000);
606 return () => clearTimeout(timer);
607 }, [updateState]);
608​
609 const checkForUpdate = useCallback(async () => {
610 // `disabled={busy}` only takes effect on the next render, so two taps in the
611 // same frame would both get through. The ref closes that window.
612 if (updateInFlight.current) return;
613 updateInFlight.current = true;
614 try {
615 // The user asked for this restart by tapping the version row, so it may
616 // apply immediately instead of prompting.
617 await runAppUpdateCheck({
618 applyMode: "immediate",
619 onFailure: (message) => Alert.alert("Update failed", message),
620 onStateChange: setUpdateState,
621 });
622 } finally {
623 updateInFlight.current = false;
624 }
625 }, []);
626​
627 const handleVersionPress = useCallback(() => {
628 if (!updateCheckAvailable || updateInFlight.current) return;
629 const tap = registerHiddenUpdateTap(hiddenUpdateTapCount.current);
630 hiddenUpdateTapCount.current = tap.nextCount;
631 if (tap.shouldCheck) {
632 void checkForUpdate();
633 }
634 }, [checkForUpdate, updateCheckAvailable]);
635​
636 const statusLabel =
637 updateState === "checking"
638 ? "Checking…"
639 : updateState === "downloading"
640 ? "Downloading…"
641 : // "ready" appears only when this check joined an in-flight background-mode
642 // check; that download installs at the next backgrounding.
643 updateState === "ready"
644 ? "Update ready"
645 : updateState === "restarting"
646 ? "Restarting…"
647 : updateState === "current"
648 ? "Up to date"
649 : null;
650​
651 const versionRow = (
652 <View className="flex-row items-center gap-4 p-4">
653 <SymbolView
654 name="info.circle"
655 size={22}
656 tintColorClassName={"accent-icon"}
657 type="monochrome"
658 weight="regular"
659 />
660 <Text className="flex-1 text-lg text-foreground">Version</Text>
661 <View className="items-end">
662 <Text className="text-lg text-foreground-muted">{versionLabel}</Text>
663 {statusLabel ? (
664 <Text className="text-xs text-foreground-muted/70">{statusLabel}</Text>
665 ) : null}
666 </View>
667 </View>
668 );
669​
670 return (
671 <SettingsSection title="App">
672 <SettingsRow icon="internaldrive" label="Client Storage" target="SettingsClientStorage" />
673 <SettingsRow icon="doc.text" label="Legal" fullScreenTarget="SettingsLegal" />
674 {updateCheckAvailable ? (
675 <Pressable
676 accessibilityLabel={`Version ${versionLabel}`}
677 accessibilityRole="text"
678 disabled={busy}
679 onPress={handleVersionPress}
680 >
681 {versionRow}
682 </Pressable>
683 ) : (
684 versionRow
685 )}
686 </SettingsSection>
687 );
689​
690function capitalize(value: string): string {
691 return value.length > 0 ? value.charAt(0).toUpperCase() + value.slice(1) : value;
693​
694function ArchivedThreadsSettingsSection() {
695 return (
696 <SettingsSection title="Threads">
697 <SettingsRow icon="archivebox" label="Archived Threads" target="SettingsArchive" />
698 </SettingsSection>
699 );