-
Notifications
You must be signed in to change notification settings - Fork 0
add links to profile on like dialog #28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -3,8 +3,9 @@ | |||||||||||
| import { useEffect } from "react"; | ||||||||||||
| import Image from "next/image"; | ||||||||||||
| import styles from "./likesDialog.module.css"; | ||||||||||||
|
|
||||||||||||
| import { useRouter } from "next/navigation"; | ||||||||||||
| export default function LikesDialog({ isOpen, onClose, likes, postId }) { | ||||||||||||
| const router = useRouter(); | ||||||||||||
| useEffect(() => { | ||||||||||||
| if (isOpen) { | ||||||||||||
| document.body.style.overflow = "hidden"; | ||||||||||||
|
|
@@ -46,7 +47,12 @@ export default function LikesDialog({ isOpen, onClose, likes, postId }) { | |||||||||||
| height={40} | ||||||||||||
| className={styles.avatar} | ||||||||||||
| /> | ||||||||||||
| <span className={styles.username}>{displayName}</span> | ||||||||||||
| <button | ||||||||||||
| className={styles.username} | ||||||||||||
| onClick={() => router.push(`/${displayName}`)} | ||||||||||||
|
||||||||||||
| onClick={() => router.push(`/${displayName}`)} | |
| onClick={() => router.push(`/${displayName}`)} | |
| aria-label={`View ${displayName}'s profile`} |
Copilot
AI
Dec 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The navigation doesn't close the dialog. When a user clicks a username, they're navigated to the profile but the dialog remains open, which creates a poor UX. Consider calling onClose() before or after the navigation: onClick={() => { onClose(); router.push(\/${displayName}`); }}`
| onClick={() => router.push(`/${displayName}`)} | |
| onClick={() => { onClose(); router.push(`/${displayName}`); }} |
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -112,7 +112,18 @@ | |||||||||||||
| .username { | ||||||||||||||
| font-size: 16px; | ||||||||||||||
| font-weight: 500; | ||||||||||||||
| background: none; | ||||||||||||||
| border: none; | ||||||||||||||
| padding: 0; | ||||||||||||||
| cursor: pointer; | ||||||||||||||
| color: #333; | ||||||||||||||
| text-align: left; | ||||||||||||||
| transition: color 0.2s; | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| .username:hover { | ||||||||||||||
| color: #7a6e60; | ||||||||||||||
| text-decoration: underline; | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
|
||||||||||||||
| .username:focus { | |
| outline: 2px solid #7a6e60; | |
| outline-offset: 2px; | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The button is missing the
type="button"attribute. Without this, the button defaults totype="submit"which could cause unexpected form submission behavior if this component is rendered within a form context. Addtype="button"to make the button's purpose explicit.