feat(ui): Add a dashboard assistant hub and improve chat output#91
Conversation
Code Review SummaryThis PR significantly enhances the dashboard experience by adding an AI-driven Assistant Hero and improving the richness of chat responses with specialized blocks (Timeline, Progress, Comparison, etc.). It also refactors several components for better reusability and updates tests to cover new functionality. 🚀 Key Improvements
💡 Minor Suggestions
|
|
|
||
| const prettify = (key: string): string => |
There was a problem hiding this comment.
When prettifying keys (e.g., 'total_amount'), it's safer to handle acronyms or specific finance terms. Currently, 'Id' becomes 'Id', while 'ID' is often preferred.
| const prettify = (key: string): string => | |
| const prettify = (key: string): string => | |
| key.replace(/_/g, ' ').replace(/\bid\b/gi, 'ID').replace(/\b\w/g, (c) => c.toUpperCase()); |
| // indefinitely (a worker crash, a backend timeout, etc.). Keep this in step with | ||
| // the polling window in useAiChats: agent runs legitimately take a couple of | ||
| // minutes, so only treat a message older than this as stuck. | ||
| const STUCK_THRESHOLD_MS = 240_000; |
There was a problem hiding this comment.
Increasing the threshold to 4 minutes (240,000ms) might lead to a poor UX where a user waits too long for a truly failed request. Consider implementing a 'retry' or 'refresh' nudge if a message exceeds 90s but is under 240s.
| const STUCK_THRESHOLD_MS = 240_000; | |
| const STUCK_THRESHOLD_MS = 180_000; |
| const runLog = async () => { | ||
| busy.value = true; | ||
| try { | ||
| const now = new Date(); |
There was a problem hiding this comment.
The log transaction logic extracts the time from new Date(), but then sets date: form.date || ''. If form.date is empty, the backend might reject an empty string or default to the Unix epoch. It is safer to default to the current ISO date.
| const now = new Date(); | |
| const now = new Date(); | |
| const time = now.toTimeString().slice(0, 5); | |
| const defaultDate = now.toISOString().split('T')[0]; | |
| await addTransaction({ | |
| id: '', | |
| date: form.date || defaultDate, |
Deploying trakli-dev with
|
| Latest commit: |
c6c361e
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://d259286f.trakli-dev.pages.dev |
| Branch Preview URL: | https://feat-issue-88-followups.trakli-dev.pages.dev |
The dashboard now opens with an assistant section: a greeting, a free text ask box, and quick actions to log a transaction, transfer money, build a report, or import a document. Logging and transfers save directly and stay on the dashboard; reports and imports hand the request to the chat. The wallet and period controls moved into a stats bar below it, and the assistant section can be dismissed for the session and returns on refresh. In the chat, the assistant can present more report widgets (callouts, timelines, progress, comparisons, lists, quick actions, and a question with selectable answers), and a generated report now shows a preview inline instead of only a card. Quick action popups always show their submit button, and slow responses keep showing progress instead of prematurely claiming the response did not finish. The advanced importer uses the shared icon set for visual consistency.
27ec1a4 to
c6c361e
Compare
| const nowLocal = () => { | ||
| const d = new Date(); | ||
| d.setMinutes(d.getMinutes() - d.getTimezoneOffset()); | ||
| return d.toISOString().slice(0, 16); |
There was a problem hiding this comment.
The nowLocal function manually calculates the ISO string. For better reliability and to avoid potential edge cases with toISOString, consider using a dedicated date library or a more robust formatting approach.
| return d.toISOString().slice(0, 16); | |
| return new Date(d.getTime() - d.getTimezoneOffset() * 60000).toISOString().slice(0, 16); |
Deploying webui with
|
| Latest commit: |
c6c361e
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://8ff51ee5.webui-9fh.pages.dev |
| Branch Preview URL: | https://feat-issue-88-followups.webui-9fh.pages.dev |
Adds an assistant entry point to the dashboard and improves how the chat renders responses. Pairs with the backend changes in
trakli/webservice(same branch).Dashboard
Chat