feat: stabilize chat realtime, dashboard insights, and account flows#57
feat: stabilize chat realtime, dashboard insights, and account flows#570x3EF8 wants to merge 1 commit intohallofcodes:masterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the chat experience with improved conversation ordering and richer UI (badges/media viewing), and adds database-level cascade deletes to support safe conversation deletion.
Changes:
- Add DM sorting controls (newest/oldest/A–Z/Z–A), message search, and revamped chat layout with left/right sidebars.
- Restore/standardize rank badge styling/animations by moving badge CSS into
app/globals.cssand using class-based badges + icons. - Add a Supabase migration to enforce
ON DELETE CASCADEformessagesandconversation_participantswhen deleting a conversation.
Reviewed changes
Copilot reviewed 8 out of 10 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| supabase/migrations/20260327100000_cascade_conversation_delete.sql | Adds cascade FK constraints for conversation cleanup on delete. |
| package.json | Bumps @fortawesome/react-fontawesome to support updated icon usage. |
| package-lock.json | Updates lockfile to reflect dependency bump and npm resolution changes. |
| app/globals.css | Centralizes badge keyframes/styles so they’re shared across UI. |
| app/components/dashboard/Navbar.tsx | Changes default sidebar collapse behavior (desktop now collapsed). |
| app/components/chat/Player.tsx | Adds hint-hiding helper (currently introduces a duplicate declaration). |
| app/components/chat/Messages.tsx | Adds media navigation controls + updated badge rendering with icons. |
| app/components/chat/Conversations.tsx | Updates conversation list item layout/labels/initials. |
| app/components/LeaderboardTable.tsx | Removes inline injected badge CSS now that globals provide styles. |
| app/components/Chat.tsx | Major chat UI refactor: sorting/search, sidebars, media viewer, deletion flow, badge icon mapping. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const hideHint = () => { | ||
| if (hintTimeoutRef.current) window.clearTimeout(hintTimeoutRef.current); | ||
| setActiveHint(null); | ||
| setHintPos(null); | ||
| }; | ||
|
|
There was a problem hiding this comment.
hideHint is declared twice in this component (there is another const hideHint = ... later in the file). This will cause a TypeScript compile error due to redeclaration. Remove one of the declarations and keep a single hideHint implementation.
| const hideHint = () => { | |
| if (hintTimeoutRef.current) window.clearTimeout(hintTimeoutRef.current); | |
| setActiveHint(null); | |
| setHintPos(null); | |
| }; |
app/components/Chat.tsx
Outdated
| @@ -1,23 +1,49 @@ | |||
| "use client"; | |||
| "use client"; | |||
There was a problem hiding this comment.
There is a leading BOM/zero-width character before the "use client" directive. Next.js requires the directive to be the very first bytes in the file; the BOM can prevent the component from being treated as a client component. Remove the BOM so the file starts exactly with "use client";.
| "use client"; | |
| "use client"; |
| @@ -1,4 +1,4 @@ | |||
| import { User } from "@supabase/supabase-js"; | |||
| import { User } from "@supabase/supabase-js"; | |||
There was a problem hiding this comment.
This file starts with a BOM/zero-width character before the first import. While it may not break runtime behavior, it commonly causes noisy diffs and occasional tooling issues. Please remove the BOM so the file begins with a normal import ....
| import { User } from "@supabase/supabase-js"; | |
| import { User } from "@supabase/supabase-js"; |
app/components/dashboard/Navbar.tsx
Outdated
| // default to collapsed on desktop too | ||
| setCollapsed(true); | ||
| setMobileHidden(false); |
There was a problem hiding this comment.
This change makes the sidebar default to collapsed on desktop as well as mobile. Since the PR is focused on chat ordering/cascade delete, this looks like an unrelated UX change; if it is intentional, it should be called out in the PR description (or moved to a separate PR) to avoid surprising behavior changes.
app/components/chat/Messages.tsx
Outdated
| @@ -1,4 +1,4 @@ | |||
| "use client"; | |||
| "use client"; | |||
There was a problem hiding this comment.
There is a leading BOM/zero-width character before the "use client" directive. Next.js requires the directive to be the very first bytes in the file; the BOM can prevent the component from being treated as a client component. Remove the BOM so the file starts exactly with "use client";.
| "use client"; | |
| "use client"; |
app/components/Chat.tsx
Outdated
| const [showModal, setShowModal] = useState(false); | ||
| const [search, setSearch] = useState(""); | ||
| const [allUsers, setAllUsers] = useState<ChatUser[]>([]); | ||
| const [search, setSearch] = useState(""); const [messageSearch, setMessageSearch] = useState(""); const [allUsers, setAllUsers] = useState<ChatUser[]>([]); |
There was a problem hiding this comment.
These state declarations appear to have been accidentally concatenated onto a single line, which hurts readability and makes future diffs harder to review. Please split them into separate const declarations on their own lines.
| const [search, setSearch] = useState(""); const [messageSearch, setMessageSearch] = useState(""); const [allUsers, setAllUsers] = useState<ChatUser[]>([]); | |
| const [search, setSearch] = useState(""); | |
| const [messageSearch, setMessageSearch] = useState(""); | |
| const [allUsers, setAllUsers] = useState<ChatUser[]>([]); |
app/components/Chat.tsx
Outdated
| faEllipsisVertical, | ||
| faFlag, | ||
| faLock, | ||
| faGhost, |
There was a problem hiding this comment.
Several icons are imported here but never referenced in the file (e.g. faEllipsisVertical, faFlag, faLock). This will fail linting in many configurations and adds noise. Remove unused imports or wire them up where intended.
| faEllipsisVertical, | |
| faFlag, | |
| faLock, | |
| faGhost, |
app/components/Chat.tsx
Outdated
| const allMediaAttachments = messages | ||
| .flatMap((m) => m.attachments || []) | ||
| .filter( | ||
| (a) => a?.mimetype?.startsWith("image/") || a?.mimetype?.startsWith("video/") | ||
| ) | ||
| .reverse(); |
There was a problem hiding this comment.
allMediaAttachments is rebuilt (including a .reverse()) on every render. With long message histories this can become a noticeable cost. Consider memoizing this derived list with useMemo (and potentially sharing the media-viewer logic with Messages to avoid duplicated implementations).
mrepol742
left a comment
There was a problem hiding this comment.
Please ammend the commit to prevent dirty commits/records from the git history.
There was a problem hiding this comment.
the spacing for these files are necessary to ensure its readable
There was a problem hiding this comment.
Addressed in commit f49ed2f. I reformatted this migration with clearer spacing/newlines for readability.
There was a problem hiding this comment.
the spacing for these files are necessary to ensure its readable
There was a problem hiding this comment.
Addressed in commit f49ed2f. I reformatted this migration with clearer spacing/newlines for readability.
There was a problem hiding this comment.
the spacing for these files are necessary to ensure its readable
There was a problem hiding this comment.
Addressed in commit f49ed2f. I reformatted this migration with clearer spacing/newlines for readability.
There was a problem hiding this comment.
the spacing for these files are necessary to ensure its readable
There was a problem hiding this comment.
Addressed in commit f49ed2f. I reformatted this migration with clearer spacing/newlines for readability.
There was a problem hiding this comment.
the spacing for these files are necessary to ensure its readable
There was a problem hiding this comment.
Addressed in commit f49ed2f. I reformatted this migration with clearer spacing/newlines for readability.
supabase/migrations/20260329133000_add_chat_presence_and_read_tracking.sql
Show resolved
Hide resolved
There was a problem hiding this comment.
the supabase/.temp folder is already ignored and unnecessary to be written.
There was a problem hiding this comment.
Addressed in commit f49ed2f. I removed the unnecessary supabase/.temp ignore noise and kept the .gitignore clean.
Consolidates PR hallofcodes#57 changes into a clean commit history. Includes reviewer follow-ups for chat presence, BOM cleanup, migration readability, and lint/build fixes.
Refines PR hallofcodes#57 into a single clean commit covering chat, dashboard, landing, settings, and migration updates. Includes reviewer follow-ups for BOM cleanup, component fixes, migration readability, and history hygiene.
There was a problem hiding this comment.
This browser check is required to ensure the client is not using puppeter or dummy browser for automation.
There was a problem hiding this comment.
the spacing for these files are necessary to ensure its readable
There was a problem hiding this comment.
Please make sure to aligned with the project designed and avoid using 3rd party or inlined SVG. For this SVG Back button,please sure the FontAwesome Chevron Left.
There was a problem hiding this comment.
Please make sure to aligned with the project designed and avoid using 3rd party or inlined SVG. For this SVG Back button,please sure the FontAwesome Chevron Left.
There was a problem hiding this comment.
the route file (e.g. route.ts) should stay focused on handling the request/response lifecycle (GET, POST, etc.), not business logic or data transformation. Please refractor this to util folder.
There was a problem hiding this comment.
the 'best practices' is should not be there as it should be part of FAQ.
<div className="glass-card p-5 border-t-4 border-indigo-500/40">
<h3 className="text-xs font-semibold text-indigo-300 uppercase tracking-widest mb-3">
Best Practices
</h3>
<div className="space-y-2 text-xs md:text-sm text-gray-400 leading-relaxed">
<p>Rotate API keys periodically and avoid sharing them in screenshots.</p>
<p>Use a strong password and reset it immediately if account activity looks unusual.</p>
<p>After changing your API key, run a dashboard sync to refresh your metrics.</p>
</div>
</div>- changing the api should not forced the system to update the coding metrics to avoid API call and charges in vercel and supabase
- rotating the api keys periodically is not ideal as if the API key rotates the user needs to update the API key not just in our system but also on his/her devices and other 3rd party services connected or integrated to Wakatime.
- in terms of using a strong password, supabase automatically checks the password strength and if the password is common or in data leaks.
Refines PR hallofcodes#57 into a single clean commit covering chat, dashboard, landing, settings, and migration updates. Includes reviewer follow-ups for BOM cleanup, component fixes, migration readability, and history hygiene.
Refines PR hallofcodes#57 into a single clean commit covering chat, dashboard, landing, settings, and migration updates. Includes reviewer follow-ups for BOM cleanup, component fixes, migration readability, and history hygiene.
Refines PR hallofcodes#57 into a single clean commit covering chat, dashboard, landing, settings, and migration updates. Includes reviewer follow-ups for BOM cleanup, component fixes, migration readability, and history hygiene.
Refines PR hallofcodes#57 into a single clean commit covering chat, dashboard, landing, settings, and migration updates. Includes reviewer follow-ups for BOM cleanup, component fixes, migration readability, and history hygiene.
Refines PR hallofcodes#57 into a single clean commit covering chat, dashboard, landing, settings, and migration updates. Includes reviewer follow-ups for BOM cleanup, component fixes, migration readability, and history hygiene.
Refines PR hallofcodes#57 into a single clean commit covering chat, dashboard, landing, settings, and migration updates. Includes reviewer follow-ups for BOM cleanup, component fixes, migration readability, and history hygiene.
Refines PR hallofcodes#57 into a single clean commit covering chat, dashboard, landing, settings, and migration updates. Includes reviewer follow-ups for BOM cleanup, component fixes, migration readability, and history hygiene.
45f23e4 to
5b9f4cd
Compare
Summary
Review Follow-ups Addressed
Commit History