-
Notifications
You must be signed in to change notification settings - Fork 0
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
Create issue timeline display modal #41
base: development
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
src/app/issues/[id]/page.tsx
Outdated
@@ -36,11 +40,15 @@ export default async function IssueView({ params }: IssueViewProps) { | |||
const auth_token = cookieStore.get("auth_token")?.value || ""; | |||
|
|||
const issue: Issue = await getIssue({ issueId, auth_token }); | |||
const timeline: getIssueTimelineResponse = await getIssueTimeline({ |
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.
Since the user may not neccesarily view the timeline, always loading the timeline data can be quite inefficient. It is recommended to delay this loading until the timeline modal has been opened, and show a loading UI while the request is being sent.
issueTitle, | ||
timeline, | ||
}: TimeLineModalProps) { | ||
const sortedTimeline = timeline.sort( |
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.
This currently results in the sort function being run on every re-render, which can be quite inefficient if the list gets long enough. Consider adding this to the post-processing of the network request or wrapping this in a useMemo
.
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.
Furthermore, I think it is worth confirming with the backend team whether we the data returned is guarentteed to be sorted, since if they already sort data, there's no point in us doing it again.
{node.description} | ||
</Timeline.Item> | ||
))} | ||
<Timeline.Item |
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 current empty UI for the timeline just features a downward arrow, consider adding text like "目前議題的資料還不足以產生時間軸,稍後再回來看看吧!"
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.
@@ -0,0 +1,46 @@ | |||
import { parseJsonWhileHandlingErrors } from "../transformers"; | |||
|
|||
export type TimelineNode = { |
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.
This should be imported from conversations.types.ts
<Modal | ||
opened={isOpen} | ||
onClose={() => setIsOpen(false)} | ||
title={<h3 className="font-bold">{`《${issueTitle}》的演進`}</h3>} |
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.
This currently causes the following error.
Error: In HTML, <h3> cannot be a child of <h2>.
This will cause a hydration error.
Consider using plain text and specify the styling using Mantine's styling API
No description provided.