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

Release #103

Open
wants to merge 194 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
194 commits
Select commit Hold shift + click to select a range
932d03a
feat(login): add basic login functionality with fake form validation
Linkgls Aug 22, 2024
f797f74
revert: delete the login function
Linkgls Aug 22, 2024
01ad03f
feat: Add new components and enums as templates
Mirrorgo Aug 28, 2024
2fc1aac
chore: update pnpm lock
Mirrorgo Aug 28, 2024
b5b7060
Merge pull request #34 from DemocracyDevelopers/feature/link-frontend
Linkgls Aug 29, 2024
827c250
chore: modify the dashboard page and add the pnpm-lock ignore
Linkgls Aug 29, 2024
c16f6d0
Merge pull request #35 from DemocracyDevelopers/feature/link-frontend
Linkgls Aug 29, 2024
50f5d40
chore: update .gitignore to include pnpm-lock.yaml
Linkgls Aug 29, 2024
2c8b83e
Update page.tsx
xYoung0507 Aug 29, 2024
a9ec66f
chore: Remove unused import in dashboard page component
Linkgls Aug 29, 2024
a8b2816
Merge pull request #37 from DemocracyDevelopers/feature/init-xy2
Mirrorgo Aug 30, 2024
2829ca9
Merge pull request #36 from DemocracyDevelopers/feature/test-kwj
Mirrorgo Aug 30, 2024
ef2714c
Merge branch 'release' into feature/main-page
Mirrorgo Sep 1, 2024
881affa
chore: update git ignore
Mirrorgo Sep 1, 2024
9c9c3ee
Merge pull request #40 from DemocracyDevelopers/feature/main-page
Mirrorgo Sep 1, 2024
f9c8643
docs: add lucide, mdi, and iconfont to the project for icons
Mirrorgo Sep 1, 2024
f1e6f9c
feat: Add icons to InnerComponent
Mirrorgo Sep 1, 2024
d9e13eb
Merge pull request #41 from DemocracyDevelopers/feature/main-page
Mirrorgo Sep 3, 2024
375d6ac
feat: support jest and add a demo
Mirrorgo Sep 5, 2024
a32604e
Merge pull request #42 from DemocracyDevelopers/feature/jest-env
Mirrorgo Sep 5, 2024
d264352
chore: Add uploader component for file uploads in dashboard page
Linkgls Sep 6, 2024
dea84be
feat: add mdi && add sample fetch
Mirrorgo Sep 11, 2024
babc74b
Merge pull request #43 from DemocracyDevelopers/feature/icon
Mirrorgo Sep 11, 2024
7650838
feat: basic node
Mirrorgo Sep 12, 2024
288bac9
feat: use icon with createRoot
Mirrorgo Sep 12, 2024
4156aed
feat: use foreignObject and svg inline to use svg in tsx file
Mirrorgo Sep 12, 2024
bba172f
feat: enhance tree visualization with collapsible nodes and improved …
Mirrorgo Sep 23, 2024
57b405e
feat: add dropdown menu for tree settings and refactor tree component
Mirrorgo Sep 27, 2024
6a4ec6e
refactor(uploader): Modify Uploader component to accept className prop
Linkgls Sep 27, 2024
9c3a8db
Merge branch 'release' into feature/link-frontend
Mirrorgo Sep 27, 2024
992e8c3
Merge pull request #45 from DemocracyDevelopers/feature/link-frontend
Mirrorgo Sep 27, 2024
f90e59c
feat: add candidate list bar and search dropdown components; integrat…
Mirrorgo Sep 27, 2024
f3f3326
Merge branch 'release' into feature/svg-text
Mirrorgo Sep 27, 2024
cd9d045
fix(tooltip): update tooltip component to use latest Radix UI version…
Mirrorgo Sep 27, 2024
e5cfb3c
feat(search-dropdown): replace img with Image component for candidate…
Mirrorgo Sep 27, 2024
2ab4131
feat: build the sample page, move the header to layout file and adjus…
ylimezhang Sep 27, 2024
97edb98
Merge pull request #46 from DemocracyDevelopers/feature/svg-text
Mirrorgo Sep 28, 2024
dfe5b7c
Merge pull request #47 from DemocracyDevelopers/feature/sample-page
ylimezhang Sep 28, 2024
b4b0a6d
feat: add tutorial link to align with the prototype
ylimezhang Sep 28, 2024
fc1da99
feat: build initial frame of dashboard
ylimezhang Sep 28, 2024
abd1d85
feat: change the color to predefined avatar in global components
ylimezhang Sep 28, 2024
8479d19
Merge branch 'test/emily-test' into feature/sample-dashboard-page
ylimezhang Sep 28, 2024
e3a7b4e
feature: add tutorial pages
lvyl9909 Sep 29, 2024
edfcf36
feature: finish tutorial pages
lvyl9909 Sep 29, 2024
15f875f
feat: AssertionsDetailsModal added
Auroraphile Sep 30, 2024
a8ef8e1
Merge pull request #50 from DemocracyDevelopers/feature/dashboard-kwj
Auroraphile Sep 30, 2024
d4be2e5
Added icons to buttons and updated content alignment in AssertionTable
xYoung0507 Sep 30, 2024
002d1e2
fix: upload for vercel
Auroraphile Sep 30, 2024
94940a3
fix: make codes fit the typescript style.
Auroraphile Sep 30, 2024
2992e96
Merge pull request #51 from DemocracyDevelopers/feature/sample-dashbo…
Auroraphile Sep 30, 2024
c84b1a3
Merge branch 'feature/sample-dashboard-page' of https://github.com/De…
xYoung0507 Sep 30, 2024
8abf78c
feat:explain assertions and constructed output tree json format for r…
clliu13 Sep 30, 2024
750c441
feat(step-by-step): enhance StepByStep component with dynamic step si…
Mirrorgo Oct 1, 2024
e59ad4a
Merge branch 'feature/link-frontend' into test/linsheng_test
Linkgls Oct 1, 2024
14b506f
feat: Add Copilot configuration file
Linkgls Oct 1, 2024
08d1b8a
feat: Add Copilot configuration file
Linkgls Oct 1, 2024
2f5988c
feat(candidate-list): make avatar optional and enhance CandidateListB…
Mirrorgo Oct 2, 2024
7e76db8
feat(step-by-step): update step indicator background color based on s…
Mirrorgo Oct 2, 2024
b0612ec
Merge pull request #52 from DemocracyDevelopers/feature/sample-dashbo…
Auroraphile Oct 2, 2024
fa1c804
feat: support mock data, add some avatar color manage methods
Auroraphile Oct 2, 2024
150204c
feat: add format validation and cross-checking
fuxingz Oct 3, 2024
c7d5cc9
Merge pull request #53 from 2656990zfx/feature/explain-assertions-zfx
fuxingz Oct 3, 2024
8640d79
refactor: Modify Uploader component to accept className prop
Linkgls Oct 3, 2024
bca2252
feat(candidate-list): replace avatar property with color for candidates
Mirrorgo Oct 3, 2024
dee3b19
feat: Add @radix-ui/react-alert-dialog and @radix-ui/react-progress d…
Linkgls Oct 3, 2024
8f32e2b
feat(carousel): add Embla carousel component with navigation controls
Mirrorgo Oct 3, 2024
36d5fe6
feat: add change color method
xYoung0507 Oct 3, 2024
6542ef7
feat: add change color method
xYoung0507 Oct 3, 2024
d000d8e
refactor: Modify Uploader component to accept max width prop
Linkgls Oct 3, 2024
fac196c
Merge pull request #54 from DemocracyDevelopers/feature/svg-text
Mirrorgo Oct 3, 2024
5845b4b
feat: support mock data, add some avatar color manage methods
Auroraphile Oct 5, 2024
de54c8a
Merge branch 'release' into feature/sample-dashboard-page
Auroraphile Oct 5, 2024
5c667f1
feat: add a floatingmenu for tutorial pages
lvyl9909 Oct 5, 2024
4dc2ba6
Merge pull request #55 from DemocracyDevelopers/feature/sample-dashbo…
Mirrorgo Oct 5, 2024
230873b
feat: add pruning functionality to explain_process
fuxingz Oct 5, 2024
fb46d85
feat: refactor Avatar component styles, update AssertionTable to FC, …
Mirrorgo Oct 5, 2024
8d5608b
Merge pull request #57 from 2656990zfx/feature/explain-assertions-zfx
fuxingz Oct 5, 2024
d79117b
fix: clean up formatting and comments in SearchDropdown component
Mirrorgo Oct 5, 2024
8e9401c
Merge branch 'release' into feature/explain-assertions-zfx
fuxingz Oct 5, 2024
b68ccf6
Merge pull request #60 from DemocracyDevelopers/feature/frontend-yilin
Mirrorgo Oct 5, 2024
4037fdc
Merge branch 'release' into feature/sprint2
Mirrorgo Oct 5, 2024
7017c74
Merge pull request #58 from DemocracyDevelopers/feature/explain-asser…
Mirrorgo Oct 5, 2024
9fc2bd4
Merge branch 'release' into feature/sprint2
Mirrorgo Oct 5, 2024
93cb3c9
feature: Refactor dashboard components and integrate svg components; …
Mirrorgo Oct 6, 2024
05c364f
fix: no-unescaped-entities
Mirrorgo Oct 6, 2024
d2566a8
refactor: remove ExplainAssertionsComponent and SvgTest components; f…
Mirrorgo Oct 6, 2024
1583163
refactor: Modify Uploader component to accept max width prop and clas…
Linkgls Oct 7, 2024
1ea6883
Merge branch 'release' into test/linsheng_test
Linkgls Oct 7, 2024
65cd4ab
refactor: Modify Uploader component to accept max width prop and clas…
Linkgls Oct 7, 2024
b8981b7
refactor: Modify Dashboard component to accept max difficulty and min…
Linkgls Oct 7, 2024
808f246
refactor: Modify Uploader component to accept max width prop and clas…
Linkgls Oct 7, 2024
a06f3f4
refactor: Modify explainAssertions function to accept inputText inste…
Linkgls Oct 7, 2024
c01658f
refactor: Modify Uploader component to accept max width prop and clas…
Linkgls Oct 8, 2024
963d85d
refactor: Modify explainAssertions function to accept inputText inste…
Linkgls Oct 8, 2024
f76f004
refactor: Modify ExplainAssertionsComponent and Uploader component
Linkgls Oct 8, 2024
6339dd8
Merge pull request #63 from DemocracyDevelopers/feature/link-frontend
Linkgls Oct 8, 2024
ed4cf41
feat: support load data from zestand.
Auroraphile Oct 8, 2024
dd26f44
refactor: Modify Uploader component to accept max width prop and clas…
Linkgls Oct 8, 2024
08aee47
Refactor Uploader component to accept max width prop and className prop
Linkgls Oct 8, 2024
41b8faa
Merge pull request #64 from DemocracyDevelopers/feature/link-frontend
Auroraphile Oct 8, 2024
95729aa
Merge branch 'release' into feature/sprint2
Mirrorgo Oct 8, 2024
34fd061
fix import image
Mirrorgo Oct 8, 2024
2cf75e3
Merge pull request #61 from DemocracyDevelopers/feature/sprint2
Mirrorgo Oct 8, 2024
d16bce2
Refactor Dashboard component: Remove logo and title from page
Linkgls Oct 8, 2024
cc387f1
fix: onTree structure
clliu13 Oct 8, 2024
8186f62
Merge pull request #66 from DemocracyDevelopers/feature/explain-asser…
Mirrorgo Oct 8, 2024
edd7e7a
feat: 16 colors for avatar
Auroraphile Oct 8, 2024
9748472
Merge branch 'test/weijia-test' into feature/avatar
Auroraphile Oct 8, 2024
309abef
Merge pull request #67 from DemocracyDevelopers/feature/avatar
Auroraphile Oct 8, 2024
8dd07e9
feat: 16 colors for avatar
Auroraphile Oct 8, 2024
1eafc6b
Merge remote-tracking branch 'origin/feature/avatar' into feature/avatar
Auroraphile Oct 8, 2024
5cedb58
Merge pull request #68 from DemocracyDevelopers/feature/avatar
Auroraphile Oct 8, 2024
8ae4c10
fix: delete the ' in content
Auroraphile Oct 8, 2024
07d50be
Merge pull request #69 from DemocracyDevelopers/feature/avatar
Auroraphile Oct 8, 2024
bec08d6
fix: commit some error
Auroraphile Oct 8, 2024
7135633
fix: delete useless files
Auroraphile Oct 8, 2024
42ffb9c
fix: delete useless files
Auroraphile Oct 8, 2024
35c6b5c
feat: use MultiWinnerData from zustand , update some comments, store …
Mirrorgo Oct 8, 2024
3694ead
feat: Remove unused import and use real data
Mirrorgo Oct 8, 2024
f1215aa
feat: Update Tree component styling
Mirrorgo Oct 8, 2024
842bb98
Refactor SampleSelector and Uploader components
Linkgls Oct 9, 2024
ebb8962
feat: merge from release
Auroraphile Oct 9, 2024
cedde8f
feat: merge from test
Auroraphile Oct 9, 2024
2cc955d
Merge pull request #70 from DemocracyDevelopers/feature/sprint2
Auroraphile Oct 9, 2024
93d45b0
feat: merge from test
Auroraphile Oct 9, 2024
fc470ab
Merge pull request #74 from DemocracyDevelopers/feature/avatar
Mirrorgo Oct 9, 2024
db443f7
Refactor SampleSelector component to update sample file URLs
Linkgls Oct 9, 2024
d9aace7
Merge branch 'release' into feature/link-frontend
Linkgls Oct 9, 2024
ef9700c
feat: fix cut
fuxingz Oct 9, 2024
ead7a47
Refactor SampleSelector component to update sample file URLs
Linkgls Oct 9, 2024
f646f98
Merge pull request #75 from DemocracyDevelopers/feature/explain-asser…
Mirrorgo Oct 9, 2024
06bfeec
feat: Add cut property to TreeNode interface and update Tree componen…
Mirrorgo Oct 9, 2024
c57a4c7
feat: Add cut marker to Tree component
Mirrorgo Oct 9, 2024
4e3599d
Merge pull request #76 from DemocracyDevelopers/feature/link-frontend
Mirrorgo Oct 9, 2024
e72e831
Merge branch 'release' into feature/sprint2
Mirrorgo Oct 9, 2024
77fd1c0
fix: wrong winner in dashboard card
Auroraphile Oct 9, 2024
1aff129
Merge pull request #77 from DemocracyDevelopers/feature/sprint2
Auroraphile Oct 9, 2024
79adfb0
Merge pull request #79 from DemocracyDevelopers/feature/avatar
Mirrorgo Oct 9, 2024
660d472
Refactor Dashboard component to update CSS class and add tutorial button
Linkgls Oct 9, 2024
e8a06d2
Merge pull request #80 from DemocracyDevelopers/feature/link-frontend
ylimezhang Oct 9, 2024
de46894
chore: add link to tutorial in sample page and change background colo…
ylimezhang Oct 9, 2024
2a1e2c7
Merge pull request #81 from DemocracyDevelopers/feature/sample-dashbo…
Mirrorgo Oct 9, 2024
dee9af2
fix: search bar for winner and winner switcher
Mirrorgo Oct 9, 2024
991570d
feat: support EllipsisText for tree components and candidate list bar
Mirrorgo Oct 9, 2024
f78e325
Merge branch 'release' into feature/sprint2
Mirrorgo Oct 10, 2024
6a27aec
add unit tests
Jiamin-Gu Oct 10, 2024
b2e15d7
Merge branch 'release' into feature/test_jg2
Jiamin-Gu Oct 10, 2024
d7d96f1
delete svg part
Jiamin-Gu Oct 10, 2024
c6c68bd
Delete the parts that are irrelevant to the logic
Jiamin-Gu Oct 10, 2024
50e1cc2
Focus only on the logic part
Jiamin-Gu Oct 10, 2024
49d8e46
Merge pull request #82 from DemocracyDevelopers/feature/sprint2
Mirrorgo Oct 10, 2024
ffe9bbc
Merge pull request #84 from DemocracyDevelopers/feature/test_jg2
Mirrorgo Oct 10, 2024
0f565c2
feat: add previous step button "back"
Mirrorgo Oct 10, 2024
4494656
Merge pull request #85 from DemocracyDevelopers/feature/sprint2
Mirrorgo Oct 10, 2024
09840ba
fix: change winnername to winner in candidateList
Auroraphile Oct 10, 2024
612a678
Merge pull request #88 from DemocracyDevelopers/feature/sample-avatar
Mirrorgo Oct 11, 2024
fed1600
feat: add a toggle sidebar menu and search function(can only search t…
lvyl9909 Oct 11, 2024
0719e52
fix: fix some bug
lvyl9909 Oct 11, 2024
5ed8bb5
Merge pull request #89 from DemocracyDevelopers/feature/yilin2
Mirrorgo Oct 11, 2024
848b2ac
feat: fix cut
fuxingz Oct 12, 2024
8d5bf72
Merge pull request #90 from DemocracyDevelopers/feature/explain-asser…
Mirrorgo Oct 12, 2024
2df10e6
feat: add Assertion content on elimination tree
Mirrorgo Oct 12, 2024
ff68bb8
Merge branch 'release' into feature/sprint2
Mirrorgo Oct 12, 2024
2be32b4
feat: add information icon and create the tut and tc reusable compone…
ylimezhang Oct 12, 2024
d047163
Merge remote-tracking branch 'origin/release'
ylimezhang Oct 12, 2024
affbfae
feat: support hidden for cut tree
Mirrorgo Oct 12, 2024
dae8f91
fix: change the description text for tree
ylimezhang Oct 12, 2024
c9c7c73
feat: add support for resetting hidden nodes in elimination tree
Mirrorgo Oct 12, 2024
4d23e00
Merge pull request #94 from DemocracyDevelopers/feature/sample-dashbo…
Mirrorgo Oct 12, 2024
a819a4c
Merge branch 'release' into feature/sprint2
Mirrorgo Oct 12, 2024
a5ca5ef
fix: use tooltip component from shadcn instead
ylimezhang Oct 12, 2024
a96ba49
feat: add highlight circle for the selected candidate and integrate i…
ylimezhang Oct 12, 2024
c6b101c
feat: update applied assertion button text in elimination tree
Mirrorgo Oct 12, 2024
8cc9458
Merge pull request #95 from DemocracyDevelopers/feature/sprint2
Mirrorgo Oct 12, 2024
115e7ce
Merge remote-tracking branch 'origin/release'
ylimezhang Oct 12, 2024
8fb922e
chore: change the search bar text
ylimezhang Oct 12, 2024
63b5f38
fix: change the selected candidate id to selected winner id
ylimezhang Oct 12, 2024
9e300c1
fix: commented the option for now, make the avatar text smaller and a…
ylimezhang Oct 12, 2024
eeb7502
Merge pull request #98 from DemocracyDevelopers/feature/sample-dashbo…
Mirrorgo Oct 12, 2024
63b4bf5
feat: add loading in sample page before jumping to the dashboard
ylimezhang Oct 12, 2024
3a1b1b3
Merge remote-tracking branch 'origin/release'
ylimezhang Oct 12, 2024
9eec445
Merge pull request #100 from DemocracyDevelopers/feature/sample-dashb…
Mirrorgo Oct 12, 2024
caf7de0
feat: add a breadcrumb on each tutorial page; add a scroll listener
lvyl9909 Oct 13, 2024
403dc15
chore: delete the second-level title for get started page
lvyl9909 Oct 13, 2024
eef7458
fix: fixed get started page can not be accessed from toc
lvyl9909 Oct 13, 2024
251c124
chore: submit pnpm-lock
lvyl9909 Oct 13, 2024
e782f02
Merge branch 'release' into feature/yilin2
lvyl9909 Oct 13, 2024
62a91da
feat: add margin and difficulty in tutorial/margin
lvyl9909 Oct 13, 2024
ee8c0e5
fix: change the typed arrow to an icon arrow
lvyl9909 Oct 13, 2024
5a27c8e
chore: added a margincontainer for breadcrumb
lvyl9909 Oct 13, 2024
5bc4a96
chore: reuse tc component from upload folder
lvyl9909 Oct 14, 2024
49940dd
Merge pull request #101 from DemocracyDevelopers/feature/yilin2
ylimezhang Oct 14, 2024
a39f69d
chore: update versions of @radix-ui/react-checkbox and @radix-ui/reac…
Mirrorgo Oct 14, 2024
81b091a
Merge pull request #102 from DemocracyDevelopers/feature/sprint2
clliu13 Oct 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,10 @@ yarn-error.log*
next-env.d.ts

# vscode
.vscode
.vscode

# idea
.idea

# pnpm-lock
pnpm-lock.yaml
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
## Team Member

| Name | Roles |
|-------------|-------------------------------------|
| ----------- | ----------------------------------- |
| Aaron Lee | Technical Officer/Client Liaison |
| Emily Zhang | Project Manager/Front-end Developer |
| Yilin Lyu | Scrum Mater/Front-end Developer |
Expand All @@ -27,6 +27,10 @@
- zustand
- jest
- husky
- icons
- [lucide](https://lucide.dev/icons/)
- [mdi](https://pictogrammers.com/library/mdi/)
- [iconfont](https://www.iconfont.cn/)

# Environment and Tools

Expand Down
58 changes: 58 additions & 0 deletions app/dashboard/components/Information-icon-text.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import { useState } from "react";
import {
Tooltip,
TooltipTrigger,
TooltipContent,
TooltipProvider,
} from "@/components/ui/tooltip";
import { FaInfoCircle } from "react-icons/fa";
import Link from "next/link";

interface TooltipWithIconProps {
title: string;
linkText: string;
linkHref: string;
description: string;
}

const TooltipWithIcon: React.FC<TooltipWithIconProps> = ({
title,
linkText,
linkHref,
description,
}) => {
return (
<TooltipProvider>
<Tooltip>
<TooltipTrigger asChild>
<span className="ml-2 relative">
{/* Information Icon */}
<FaInfoCircle className="text-black cursor-pointer" size={18} />
</span>
</TooltipTrigger>

<TooltipContent
side="right"
align="center"
className="bg-white text-black rounded-lg shadow-lg p-4 w-64"
>
<div className="font-bold mb-2">{title}</div>
<div className="font-normal">
{description}{" "}
<Link
href={linkHref}
target="_blank"
rel="noopener noreferrer"
className="text-blue-500 hover:underline"
>
{linkText}
</Link>
.
</div>
</TooltipContent>
</Tooltip>
</TooltipProvider>
);
};

export default TooltipWithIcon;
50 changes: 50 additions & 0 deletions app/dashboard/components/assertion-table.tsx
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

shadcn应该有合适的table了,不需要用table标签来写

Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import React from "react";
import { Avatar } from "@/components/ui/avatar";

interface Assertion {
index: number;
content: string;
type: string;
winner: number; // 候选人的 ID
name: string; // 候选人名字
}

interface AssertionTableProps {
assertions: Assertion[];
}

const AssertionTable: React.FC<AssertionTableProps> = ({ assertions }) => {
return (
<div>
<table className="min-w-full table-auto">
<thead>
<tr>
<th className="px-4 py-2 border-b">Index</th>
<th className="px-4 py-2 border-b">Content</th>
<th className="px-4 py-2 border-b">Type</th>
</tr>
</thead>
<tbody>
{assertions.map((assertion) => (
<tr key={assertion.index}>
<td className="px-4 py-2 text-center border-b">
{assertion.index}
</td>
<td className="px-4 py-2 text-left border-b">
<div className="flex items-center justify-start">
<Avatar candidateId={assertion.winner} className="mr-2" />
<span>{assertion.content}</span>
</div>
</td>
<td className="px-4 py-2 text-center border-b">
{assertion.type}
</td>
</tr>
))}
</tbody>
</table>
</div>
);
};

export default AssertionTable;
130 changes: 130 additions & 0 deletions app/dashboard/components/assertions-details-modal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
import React, { useEffect, useState } from "react";
import { Avatar } from "@/components/ui/avatar";
import { FaInfoCircle } from "react-icons/fa";
import Link from "next/link";
import TooltipWithIcon from "@/app/dashboard/components/Information-icon-text";

// 更新 Assertion 接口,添加 candidateId 字段
interface Assertion {
index: number;
winner: number;
content: string;
type: string;
difficulty: number;
margin: number;
}

interface AssertionsDetailsModalProps {
isOpen: boolean;
onClose: () => void;
assertions: Assertion[];
maxDifficulty: number;
minMargin: number;
}

const AssertionsDetailsModal: React.FC<AssertionsDetailsModalProps> = ({
isOpen,
onClose,
assertions,
maxDifficulty,
minMargin,
}) => {
const [isTooltipVisible, setTooltipVisible] = useState(false);
useEffect(() => {
if (isOpen) {
document.body.style.overflow = "hidden";
} else {
document.body.style.overflow = "auto";
}
}, [isOpen]);

if (!isOpen) return null;
return (
<div className="fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-30">
<div className="bg-white rounded-lg max-w-3xl w-full mx-4 p-6 relative">
{/* 关闭按钮 */}
<button
onClick={onClose}
className="absolute top-4 right-4 text-gray-600 hover:text-gray-800"
aria-label="Close"
>
{/* SVG 图标 */}
<svg
xmlns="http://www.w3.org/2000/svg"
className="h-6 w-6"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={2}
d="M6 18L18 6M6 6l12 12"
/>
</svg>
</button>

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

关闭按钮应该lucide里面有,不需要自己找svg图标

<h2 className="text-2xl font-bold mb-4 flex items-center relative">
Assertions Details
<TooltipWithIcon
title="Need Help?"
description="For detailed guidance on understanding the assertion attributes, please refer to our"
linkText="Tutorial"
linkHref="/tutorial"
/>
</h2>
<div className="mb-4">
<p className="text-gray-700 font-bold">
<span className="font-semibold">Maximum Difficulty:</span>{" "}
{maxDifficulty}{" "}
<span className="font-semibold">Minimum Margin:</span> {minMargin}
</p>
</div>
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

不需要用这么多 {“ ”}, 应该有其他方案


<div className="overflow-x-auto">
<table className="min-w-full table-auto">
<thead>
<tr>
<th scope="col" className="px-4 py-2 border-b text-left">
Index
</th>
<th scope="col" className="px-4 py-2 border-b text-left">
Content
</th>
<th scope="col" className="px-4 py-2 border-b text-left">
Type
</th>
<th scope="col" className="px-4 py-2 border-b text-left">
Difficulty
</th>
<th scope="col" className="px-4 py-2 border-b text-left">
Margin
</th>
</tr>
</thead>
<tbody>
{assertions.map((assertion) => (
<tr key={assertion.index}>
<td className="px-4 py-2 border-b">{assertion.index}</td>
<td className="px-4 py-2 text-left border-b">
<div className="flex items-center justify-start">
{/* 使用 Avatar 组件,传入 candidateId */}
<Avatar candidateId={assertion.winner} className="mr-2" />
<span>{assertion.content}</span>
</div>
</td>
<td className="px-4 py-2 border-b">{assertion.type}</td>
<td className="px-4 py-2 border-b">{assertion.difficulty}</td>
<td className="px-4 py-2 border-b">{assertion.margin}</td>
</tr>
))}
</tbody>
</table>
</div>
</div>
</div>
);
};
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

用shadcn自带的表格,不要用table


export default AssertionsDetailsModal;
56 changes: 56 additions & 0 deletions app/dashboard/components/avatar-assign-color.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
//avatar-assign-color.tsx
import React, { useEffect, useMemo, useState } from "react";
import useMultiWinnerDataStore from "@/store/multi-winner-data";
import { AvatarColor } from "@/utils/avatar-color";

interface AvatarProps {
onComplete: () => void;
}

const AvatarAssignColor: React.FC<AvatarProps> = ({ onComplete }) => {
const { candidateList, setCandidateList } = useMultiWinnerDataStore();
const avatarColor = useMemo(() => new AvatarColor(), []);
const [hasCompleted, setHasCompleted] = useState(false);

useEffect(() => {
if (hasCompleted) return;

console.log("candidateList:", candidateList);

if (candidateList.length === 0) {
onComplete();
setHasCompleted(true);
return;
}

let hasUpdated = false;

const updatedCandidates = candidateList.map((candidate, index) => {
if (!candidate.color) {
hasUpdated = true;
const color = avatarColor.getColor(index);
return { ...candidate, color };
}
return candidate;
});

if (hasUpdated) {
setCandidateList(updatedCandidates);
}

onComplete();
setHasCompleted(true);
}, [candidateList, avatarColor, setCandidateList, onComplete, hasCompleted]);

return (
<div>
{candidateList.map((candidate) => (
<div key={candidate.id} style={{ backgroundColor: candidate.color }}>
{candidate.name}
</div>
))}
</div>
);
};

export default AvatarAssignColor;
21 changes: 21 additions & 0 deletions app/dashboard/components/card.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React from "react";

interface CardProps {
title: string;
value: string | number;
icon?: React.ReactNode;
}

const Card: React.FC<CardProps> = ({ title, value, icon }) => {
return (
<div className="border border-gray-300 rounded-lg p-6 flex items-center justify-between w-full max-w-sm">
<div>
<h3 className="text-gray-600 text-lg font-medium">{title}</h3>
<p className="text-3xl font-bold">{value}</p>
</div>
{icon && <div className="text-gray-400 text-3xl">{icon}</div>}
</div>
);
};

export default Card;
Loading
Loading