-
Notifications
You must be signed in to change notification settings - Fork 2
hooks
All custom React hooks catalogued with purpose. See Architecture for how hooks fit with stores and services.
Purpose: Returns current sync status, pending changes count, last sync time for a repo.
Returns: { isDirty, unpushedCount, lastSyncAt, isSyncing }
Source: src/hooks/useGitRepoStatus.ts
Purpose: Returns whether a git operation is currently in flight (blocks the floating git button).
Returns: boolean
Source: src/hooks/useGitBusy.ts
Purpose: Returns foreground sync settings — whether auto-sync is enabled, sync interval.
Returns: { autoSyncEnabled, syncInterval }
Source: src/hooks/useForegroundSyncSettings.ts
Purpose: Returns health status of foreground sync — any failures, error messages.
Returns: { hasError, errorMessage, lastErrorAt }
Source: src/hooks/useForegroundSyncHealth.ts
Purpose: Returns aggregated sync status across all repos — total pending changes, any conflicts.
Returns: { totalUnpushed, conflictCount, isAnySyncing }
Source: src/hooks/useAllReposStatus.ts
Purpose: React Query hooks for git host API calls — repo list, branches, commits.
Returns: TanStack Query results for useRepoList, useBranches, useCommits, etc.
Source: src/hooks/useGitHostQueries.ts
Purpose: React Query hooks specifically for GitHub API — issues, PRs, notifications.
Returns: TanStack Query results for GitHub-specific queries.
Source: src/hooks/useGitHubQueries.ts
Purpose: Manages background sync registration and lifecycle — registers expo-background-task.
Returns: { isRegistered, lastSyncAt }
Source: src/hooks/useBackgroundSync.ts
Purpose: Probes an AI provider to check availability — configured, credentials valid, quota remaining. Returns an Availability result.
Returns: Availability — { kind: 'available' } | { kind: 'unavailable', reason: { code, message } }
Source: src/hooks/useProviderAvailability.ts
Purpose: Wires RecognizedTextService to AIMemoryIndexService for chat recall — saves, lists, and deletes OCR text indexed from canvas images.
Returns: { saveRecognition, listRecognitions, deleteRecognition, isLoading, error }
Source: src/hooks/useRecognitionIndexing.ts
Purpose: Long-press gesture (500ms) on canvas region — composes atlas, encodes tiles to PNG, sends to vision model, stores result in draftStore for user accept/discard.
Returns: Gesture handler bindings for long-press
Source: src/hooks/useLongPressForVision.ts
Purpose: Detects device form factor — phone vs tablet, portrait vs landscape, screen dimensions.
Returns: { isTablet, isLandscape, screenWidth, screenHeight }
Source: src/hooks/useResponsive.ts
Purpose: Returns Pro status and opens the paywall if a Pro feature is accessed by a free user.
Returns: { isPro, status, loading, openPaywall }
Source: src/hooks/useProGate.ts
Purpose: Navigates away from a Pro-only screen if user is not Pro. Used to guard Pro screens.
Returns: { canAccess }
Source: src/hooks/useProScreenGuard.ts
Purpose: Safe back navigation — confirms if there are unsaved changes before navigating back.
Returns: () => void — a single function that safely navigates back; falls back to MainTabs if no previous screen is available.
Source: src/hooks/useSafeBack.ts
Purpose: Detects current network connectivity status.
Returns: { isConnected, isExpensive, isInternetReachable }
Source: src/hooks/useNetworkStatus.ts
Purpose: Access account store — list of connected GitHub/GitLab/Gitea accounts.
Returns: { accounts, activeAccount, addAccount, removeAccount }
Source: src/hooks/useAccounts.ts
Note: This hook is currently a stub — it returns hardcoded { accounts: [], activeAccount: null } without consuming any context. Account management is handled via AccountStorage service directly.
Purpose: Generic hook for filtering entities — notes, todos, canvases.
Returns: { filtered, setFilter, clearFilter }
Source: src/hooks/useEntityFilter.ts
Purpose: Generic hook for loading and managing a list of entities with pagination.
Returns: { entities, isLoading, error, loadMore, refresh }
Source: src/hooks/useEntityList.ts
Purpose: Returns all unique tags used in notes for the given repo (for tag autocomplete).
Returns: string[]
Source: src/hooks/useNoteTags.ts
Purpose: Manages undo/redo stack for note editor — stores change history.
Returns: { undo, redo, canUndo, canRedo, pushChange }
Source: src/hooks/useUndoRedo.ts
Purpose: Applies hard word-wrap to text input at a configurable column width.
Returns: Text with hard wraps applied
Source: src/hooks/useHardWrap.ts
Purpose: Returns today's philosopher quote from DailyQuoteService.
Returns: { quote, author, source, isLoading }
Source: src/hooks/useDailyQuote.ts
Purpose: Displays an alert when foreground sync encounters a failure.
Returns: { hasSyncedThisSession }
Source: src/hooks/useForegroundSyncAlert.ts
Purpose: Subscribes to git refresh events (checkout, commit, pull) for reactive UI updates.
Returns: { lastRefreshAt: number | null }
Source: src/hooks/useGitRefreshEvent.ts
- Services — Services called by hooks
- Stores — Zustand stores accessed by hooks
- Architecture — Hook context