Skip to content
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

Open
wants to merge 12 commits into
base: development
Choose a base branch
from

Conversation

yukicoder0509
Copy link
Collaborator

No description provided.

Copy link

vercel bot commented Jan 20, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 29, 2025 3:28am

@@ -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({
Copy link
Contributor

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(
Copy link
Contributor

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.

Copy link
Contributor

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
Copy link
Contributor

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 "目前議題的資料還不足以產生時間軸,稍後再回來看看吧!"

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

螢幕擷取畫面 2025-01-29 112132
螢幕擷取畫面 2025-01-29 112055
I think the pure text is enough for an empty UI and the downward arrow is somehow confusing to me because there are no timelines to point to.

@@ -0,0 +1,46 @@
import { parseJsonWhileHandlingErrors } from "../transformers";

export type TimelineNode = {
Copy link
Contributor

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>}
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants