Skip to content

🧩 Split App.tsx into components, hooks, and modules - #5

Merged
GiorgosPanagopoulos merged 1 commit into
mainfrom
refactor/split-app-tsx
Aug 10, 2026
Merged

🧩 Split App.tsx into components, hooks, and modules#5
GiorgosPanagopoulos merged 1 commit into
mainfrom
refactor/split-app-tsx

Conversation

@GiorgosPanagopoulos

Copy link
Copy Markdown
Owner

Summary

Pure refactor — no behaviour change. Breaks the monolithic App.tsx (868 lines) into components, hooks, i18n, types, and an API module. App.tsx is now a thin composition root: providers, routing, layout only.

App.tsx: 868 → 86 lines

New tree

frontend/src/
├── api/
│   ├── auth.ts                 (unchanged)
│   └── chat.ts
├── components/
│   ├── chat/
│   │   ├── ChatPanel.tsx
│   │   ├── MessageBubble.tsx
│   │   ├── MessageList.tsx
│   │   ├── SuggestionChips.tsx
│   │   ├── TracePanel.tsx
│   │   ├── UploadZone.tsx
│   │   └── UsageBadge.tsx
│   ├── common/
│   │   ├── ErrorFallback.tsx
│   │   └── Icon.tsx
│   ├── inspector/
│   │   ├── BidCard.tsx
│   │   ├── DataInspector.tsx
│   │   ├── DataInspectorTabs.tsx
│   │   └── SupplierCard.tsx
│   └── layout/
│       ├── Header.tsx
│       ├── LanguageToggle.tsx
│       └── ThemeToggle.tsx
├── contexts/
│   └── AuthContext.tsx         (unchanged)
├── hooks/
│   ├── useCatalogData.ts
│   ├── useChat.ts
│   ├── useI18n.ts
│   ├── useInspectorData.ts
│   └── useTheme.ts
├── i18n/
│   └── translations.ts
├── pages/
│   └── LoginPage.tsx           (unchanged)
├── types/
│   └── index.ts
└── App.tsx                     86 lines

Verification

  • npx tsc --noEmit — clean
  • npm run lint — 0 warnings
  • npm run build — succeeds
  • docker compose up --build -d — all containers healthy
  • Manual browser pass (login, chat message + trace panel, dark/light theme, EN/GR toggle, PDF upload, pagination, tab switching) — all match prior behaviour, no console errors

State lifted out of the former AppContent: suppliers/bids into useCatalogData, rightTab into App.tsx. Required because chat and inspector cross-reference each other (empty state shows counts, a successful response switches the right panel to Results). Keeps useChat free of inspector concepts.

Break the 868-line App.tsx into a proper structure: chat/inspector/layout
components, dedicated hooks (useChat, useTheme, useI18n, useCatalogData,
useInspectorData), i18n translations, shared types, and a chat API module.
App.tsx is now a thin composition root (86 lines) with no behaviour change.
@GiorgosPanagopoulos
GiorgosPanagopoulos merged commit 3a555ae into main Aug 10, 2026
2 checks passed
@GiorgosPanagopoulos
GiorgosPanagopoulos deleted the refactor/split-app-tsx branch August 10, 2026 14:19
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