aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/client/components/SyncStatusIndicator.tsx
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-01-04 17:43:59 +0900
committernsfisis <nsfisis@gmail.com>2026-01-04 19:09:58 +0900
commitf8e4be9b36a16969ac53bd9ce12ce8064be10196 (patch)
treeb2cf350d2e2e52803ff809311effb40da767d859 /src/client/components/SyncStatusIndicator.tsx
parente1c9e5e89bb91bca2586470c786510c3e1c03826 (diff)
downloadkioku-f8e4be9b36a16969ac53bd9ce12ce8064be10196.tar.gz
kioku-f8e4be9b36a16969ac53bd9ce12ce8064be10196.tar.zst
kioku-f8e4be9b36a16969ac53bd9ce12ce8064be10196.zip
refactor(client): migrate state management from React Context to Jotai
Replace AuthProvider and SyncProvider with Jotai atoms for more granular state management and better performance. This migration: - Creates atoms for auth, sync, decks, cards, noteTypes, and study state - Uses atomFamily for parameterized state (e.g., cards by deckId) - Introduces StoreInitializer component for subscription initialization - Updates all components and pages to use useAtomValue/useSetAtom - Updates all tests to use Jotai Provider with createStore pattern 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'src/client/components/SyncStatusIndicator.tsx')
-rw-r--r--src/client/components/SyncStatusIndicator.tsx17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/client/components/SyncStatusIndicator.tsx b/src/client/components/SyncStatusIndicator.tsx
index dd1a77d..4bb3ff5 100644
--- a/src/client/components/SyncStatusIndicator.tsx
+++ b/src/client/components/SyncStatusIndicator.tsx
@@ -6,11 +6,22 @@ import {
faSpinner,
} from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { useSync } from "../stores";
-import { SyncStatus } from "../sync";
+import { useAtomValue } from "jotai";
+import {
+ isOnlineAtom,
+ isSyncingAtom,
+ lastErrorAtom,
+ pendingCountAtom,
+ SyncStatus,
+ syncStatusAtom,
+} from "../atoms";
export function SyncStatusIndicator() {
- const { isOnline, isSyncing, pendingCount, lastError, status } = useSync();
+ const isOnline = useAtomValue(isOnlineAtom);
+ const isSyncing = useAtomValue(isSyncingAtom);
+ const pendingCount = useAtomValue(pendingCountAtom);
+ const lastError = useAtomValue(lastErrorAtom);
+ const status = useAtomValue(syncStatusAtom);
const getStatusText = (): string => {
if (!isOnline) {