refactor: improve code quality with shared modules and theme system - #483
Merged
Conversation
- Add semantic colors (success, warning, info) to theme system - Extract shared icons.tsx and fuzzy-search.ts utilities - Replace hardcoded colors with theme variables across components - Extract ChatGroup component to eliminate sidebar duplication - Replace console.* with structured logger in Convex backend - Add text-caption size for consistent typography - Fix stale TODOs in command-palette to use TanStack Router Components updated: - chat-interface.tsx: theme colors, remove unused components - openrouter-connect-modal.tsx: theme colors - settings.tsx: theme colors, text-caption - model-selector.tsx: shared modules - command-palette.tsx: shared modules, Router fixes - app-sidebar.tsx: shared icons, ChatGroup - streaming.ts: structured logging - crons.ts: structured logging
|
🚅 Deployed to the openchat-pr-483 environment in OpenChat
|
Contributor
🚀 Preview Deployment Ready
Convex Preview Backend
🤖 Deployed automatically by GitHub Actions |
Member
Author
|
@greptile please review this PR |
Contributor
Greptile SummaryThis PR improves code quality through several refactoring efforts:
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant CommandPalette
participant Router as TanStack Router
participant Page
Note over CommandPalette: Before: window.location.href
User->>CommandPalette: Select "New Chat"
CommandPalette->>Router: navigate({ to: "/" })
Router->>Page: SPA navigation (no reload)
Note over CommandPalette: Shared modules flow
participant Icons as icons.tsx
participant Fuzzy as fuzzy-search.ts
CommandPalette->>Icons: Import PlusIcon, SearchIcon, etc.
CommandPalette->>Fuzzy: Import fuzzyMatch()
Note over Icons,Fuzzy: Also used by: app-sidebar, model-selector
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
icons.tsxandfuzzy-search.tsto reduce code duplicationChatGroupcomponent to eliminate 4 duplicate rendering blocks in sidebarconsole.*with structured logger in Convex backend (streaming.ts, crons.ts)Changes
Theme System (styles.css)
--success,--warning,--infosemantic colors with oklch values--font-size-caption(10px) for consistent small textNew Shared Modules
/apps/web/src/components/icons.tsx- Centralized icon components/apps/web/src/lib/fuzzy-search.ts- Shared fuzzy matching logicComponents Updated
chat-interface.tsxopenrouter-connect-modal.tsxsettings.tsxmodel-selector.tsxcommand-palette.tsxapp-sidebar.tsxstreaming.tscrons.tsTesting
bun run build- Web build passesbun check-types- Type check passes (only pre-existing auth.ts issues)Notes
Type errors in auth.ts/users.ts are pre-existing better-auth + convex type compatibility issues, not introduced by this PR.