mirror of
https://github.com/wassname/Open-Assistant.git
synced 2026-07-09 00:20:03 +08:00
Fix locale leaderboard after rebase
This commit is contained in:
@@ -13,6 +13,5 @@
|
||||
"sign_in": "Sign In",
|
||||
"sign_out": "Sign Out",
|
||||
"terms_of_service": "Terms of Service",
|
||||
"title": "Open Assistant",
|
||||
"last_updated_at": "Last updated at: {{val, datetime}}"
|
||||
"title": "Open Assistant"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"daily": "Daily",
|
||||
"last_updated_at": "Last updated at: {{val, datetime}}",
|
||||
"leaderboard": "Leaderboard",
|
||||
"monthly": "Monthly",
|
||||
"overall": "Overall",
|
||||
|
||||
@@ -6,19 +6,19 @@ import { get } from "src/lib/api";
|
||||
import { LeaderboardReply, LeaderboardTimeFrame } from "src/types/Leaderboard";
|
||||
import useSWRImmutable from "swr/immutable";
|
||||
|
||||
const columns = [
|
||||
const getColumns = (t) => [
|
||||
{
|
||||
Header: "Rank",
|
||||
Header: t("rank"),
|
||||
accessor: "rank",
|
||||
style: { width: "90px" },
|
||||
},
|
||||
{
|
||||
Header: "Score",
|
||||
Header: t("score"),
|
||||
accessor: "leader_score",
|
||||
style: { width: "90px" },
|
||||
},
|
||||
{
|
||||
Header: "User",
|
||||
Header: t("user"),
|
||||
accessor: "display_name",
|
||||
},
|
||||
];
|
||||
@@ -27,11 +27,13 @@ const columns = [
|
||||
* Presents a grid of leaderboard entries with more detailed information.
|
||||
*/
|
||||
const LeaderboardGridCell = ({ timeFrame }: { timeFrame: LeaderboardTimeFrame }) => {
|
||||
const { t } = useTranslation();
|
||||
const { t } = useTranslation(["leaderboard", "common"]);
|
||||
const { data: reply } = useSWRImmutable<LeaderboardReply>(`/api/leaderboard?time_frame=${timeFrame}`, get, {
|
||||
revalidateOnMount: true,
|
||||
});
|
||||
|
||||
const columns = useMemo(() => getColumns(t), [t]);
|
||||
|
||||
const { getTableProps, getTableBodyProps, headerGroups, rows, prepareRow } = useTable({
|
||||
columns,
|
||||
data: reply?.leaderboard ?? [],
|
||||
|
||||
Reference in New Issue
Block a user