-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:hust-open-atom-club/TranslateProject
- Loading branch information
Showing
13 changed files
with
3,008 additions
and
15,809 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
|
||
import { Bar, type BarConfig } from '@ant-design/charts' | ||
import type { CountItem } from '@utils/getStatusCount' | ||
|
||
|
||
type Props = { | ||
data: CountItem[] | ||
} | ||
|
||
export default function StatusChart({ data }: Props) { | ||
|
||
const config: BarConfig = { | ||
data: data.filter(x => x.status !== 'proofreading'), | ||
xField: 'desc', | ||
yField: 'count', | ||
colorField: 'desc', | ||
label: { | ||
text: 'count', | ||
position: 'inside' | ||
}, | ||
axis: { | ||
y: false, | ||
x: { | ||
tick: false, | ||
line: false, | ||
labelAutoHide: false, | ||
labelFontSize: 16, | ||
labelSpacing: 16, | ||
} | ||
}, | ||
theme: 'academy', | ||
tooltip: (k: CountItem) => k.count, | ||
legend: false | ||
} | ||
|
||
return ( | ||
<div style={{ | ||
height: '200px' | ||
}}> | ||
<Bar {...config}></Bar> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { STATUS_LIST } from "@config"; | ||
import type { CollectionEntry } from "astro:content"; | ||
|
||
|
||
export type CountItem = { | ||
status: string; | ||
desc: string; | ||
count: number; | ||
} | ||
|
||
const getStatusCount = (posts: CollectionEntry<"posts">[]) => { | ||
return STATUS_LIST.map(u => ({ | ||
status: u.status, | ||
desc: u.tabText, | ||
count: posts.filter(x => x.data.status === u.status).length | ||
})) as CountItem[]; | ||
}; | ||
|
||
export default getStatusCount; |
Oops, something went wrong.