Skip to content

refactor(frontend): split hooks/ into shared, scanner, admin (Phase 5)#21

Merged
revtex merged 1 commit intodevfrom
refactor/frontend-hooks-reorg
Apr 25, 2026
Merged

refactor(frontend): split hooks/ into shared, scanner, admin (Phase 5)#21
revtex merged 1 commit intodevfrom
refactor/frontend-hooks-reorg

Conversation

@revtex
Copy link
Copy Markdown
Owner

@revtex revtex commented Apr 25, 2026

Summary

Phase 5 of the directory restructure plan. Pure file moves with import-path updates and new barrel index files; no runtime behaviour change.

File moves (15 files, all tracked as renames)

hooks/shared/

  • useAuthInit.ts (+ .test.tsx)
  • useTheme.ts
  • useTokenRefresh.ts (+ .test.tsx)
  • useWebSocket.ts

hooks/scanner/

  • useScanner.ts
  • useAudioPlayer.ts
  • useTGSelectionSync.ts
  • useActiveUnit.ts

hooks/admin/

  • useAdminWebSocket.ts
  • useAdminWsOps.ts
  • useAdminActivity.ts
  • useAdminLogs.ts
  • useWsQuery.ts

New barrel files

Added index.ts in each subfolder plus a root hooks/index.ts as a safety net. Per the plan, callers should prefer specific paths (@/hooks/shared/useTheme); the root barrel is only there as a fallback.

Import updates

All 31 @/hooks/* import sites across components, pages, intra-hook references, and test vi.mock calls have been updated to specific paths.

Verification

  • pnpm exec tsc --noEmit — clean
  • pnpm test -- --run — 188/188 pass
  • Pre-existing eslint error in services/downloadFilename.ts is unchanged from dev (out of scope)

Phase progress

CHANGELOG

One bullet appended under [Unreleased] ### Changed.

Phase 5 of the directory restructure plan. Pure file moves with
import-path updates and new barrel index files; no runtime behaviour
change.

Moves (15 files, all tracked as renames):
- hooks/{useAuthInit,useTheme,useTokenRefresh,useWebSocket}.* -> hooks/shared/
- hooks/{useScanner,useAudioPlayer,useTGSelectionSync,useActiveUnit}.ts -> hooks/scanner/
- hooks/{useAdminWebSocket,useAdminWsOps,useAdminActivity,useAdminLogs,useWsQuery}.ts -> hooks/admin/

Added barrel index.ts in each subfolder plus hooks/index.ts (root
safety net). All 31 @/hooks/* import sites across components, pages,
hooks, and tests have been updated to specific paths.

tsc --noEmit clean, 188/188 unit tests pass.
@revtex revtex merged commit 4af92e6 into dev Apr 25, 2026
7 checks passed
@revtex revtex deleted the refactor/frontend-hooks-reorg branch April 25, 2026 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant