Skip to content

Commit b925075

Browse files
committed
feat: update i18n(complexityRating & dataStructureVis)
1 parent e7f1600 commit b925075

File tree

5 files changed

+283
-142
lines changed

5 files changed

+283
-142
lines changed

src/complexityRating/index.jsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from "react";
22
import { Button, Table } from "antd";
3-
3+
import { t } from "../locales";
44
import "./index.less";
55

66
// | 数据规模 | 算法可接受时间复杂度 |
@@ -15,17 +15,17 @@ import "./index.less";
1515
// | <=10^14 | $O(\sqrt{n})$ |
1616
// | - | $O(logn)$ |
1717

18-
const columns = [
18+
const getColumns = () => [
1919
{
2020
key: "size",
2121
dataIndex: "size",
22-
title: "数据规模",
22+
title: t("Locale.complexityQuickCheck.dataScale"),
2323
align: "center",
2424
},
2525
{
2626
key: "complexity",
2727
dataIndex: "complexity",
28-
title: "算法可接受时间复杂度",
28+
title: t("Locale.complexityQuickCheck.timeComplexity"),
2929
align: "center",
3030
render: (t) => {
3131
if (t === "O(sqrt(n))")
@@ -82,10 +82,10 @@ export default function ComplexityRating() {
8282
href="https://lucifer.ren/blog/2020/12/21/shuati-silu3/"
8383
target="_blank"
8484
>
85-
不懂为什么?点这里
85+
{t("Locale.complexityQuickCheck.tips")}
8686
</Button>
8787

88-
<Table columns={columns} dataSource={data} />
88+
<Table columns={getColumns()} dataSource={data} />
8989
</div>
9090
);
9191
}

src/dataStructureVis/data.js

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
import treeLevel2 from "../db/dataStructureVis/tree-level-2";
2+
import treeLevel3 from "../db/dataStructureVis/tree-level-3";
3+
import treeLevel4 from "../db/dataStructureVis/tree-level-4";
4+
import trigeminal from "../db/dataStructureVis/trigeminal";
5+
import graph1 from "../db/dataStructureVis/graph-1";
6+
import recurTree1 from "../db/dataStructureVis/recur-tree-1.js";
7+
import array1 from "../db/dataStructureVis/array-1.js";
8+
import board1 from "../db/dataStructureVis/board-1.js";
9+
import official from "../db/dataStructureVis/leetcode-official";
10+
import calm from "../db/dataStructureVis/calm";
11+
12+
export const initialDataSource = {
13+
presets: [
14+
{
15+
title: "力扣官方",
16+
data: official,
17+
desc: "力扣官方题解主题(持续更新)",
18+
type: "leetcode-official",
19+
typeName: "力扣官方",
20+
},
21+
{
22+
title: "calm",
23+
data: calm,
24+
desc: "稳重色系(目前只完成了树,后续更新其他数据结构)",
25+
type: "theme",
26+
typeName: "色系",
27+
},
28+
{
29+
title: "二层二叉树",
30+
data: treeLevel2,
31+
desc: "",
32+
cover: "",
33+
type: "tree",
34+
typeName: "树",
35+
},
36+
{
37+
title: "三层二叉树",
38+
data: treeLevel3,
39+
desc: "",
40+
cover: "",
41+
type: "tree",
42+
typeName: "树",
43+
},
44+
{
45+
title: "四层二叉树",
46+
data: treeLevel4,
47+
desc: "",
48+
cover: "",
49+
type: "tree",
50+
typeName: "树",
51+
},
52+
{
53+
title: "三叉树",
54+
data: trigeminal,
55+
desc: "",
56+
cover: "",
57+
type: "tree",
58+
typeName: "树",
59+
},
60+
{
61+
title: "递归树",
62+
data: recurTree1,
63+
desc: "",
64+
cover: "",
65+
type: "tree",
66+
typeName: "树",
67+
},
68+
{
69+
title: "简单数组",
70+
data: array1,
71+
desc: "",
72+
cover: "",
73+
type: "array",
74+
typeName: "数组",
75+
},
76+
{
77+
title: "简单二维矩阵",
78+
data: board1,
79+
desc: "",
80+
cover: "",
81+
type: "board",
82+
typeName: "二维矩阵(或邻接矩阵)",
83+
},
84+
{
85+
title: "简单图",
86+
data: graph1,
87+
desc: "",
88+
cover: "",
89+
type: "graph",
90+
typeName: "图",
91+
},
92+
],
93+
custom: [],
94+
};
95+
96+
export const initialDataSourceEn = {
97+
presets: [
98+
{
99+
title: "LeetCode Official",
100+
data: official,
101+
desc: "Official LeetCode solution topics (continuously updated)",
102+
type: "leetcode-official",
103+
typeName: "LeetCode Official",
104+
},
105+
{
106+
title: "Calm",
107+
data: calm,
108+
desc: "Serene color scheme (currently only completed for trees, more data structures to be updated)",
109+
type: "theme",
110+
typeName: "Color Scheme",
111+
},
112+
{
113+
title: "Binary Tree - Level 2",
114+
data: treeLevel2,
115+
desc: "",
116+
cover: "",
117+
type: "tree",
118+
typeName: "Tree",
119+
},
120+
{
121+
title: "Binary Tree - Level 3",
122+
data: treeLevel3,
123+
desc: "",
124+
cover: "",
125+
type: "tree",
126+
typeName: "Tree",
127+
},
128+
{
129+
title: "Binary Tree - Level 4",
130+
data: treeLevel4,
131+
desc: "",
132+
cover: "",
133+
type: "tree",
134+
typeName: "Tree",
135+
},
136+
{
137+
title: "Ternary Tree",
138+
data: trigeminal,
139+
desc: "",
140+
cover: "",
141+
type: "tree",
142+
typeName: "Tree",
143+
},
144+
{
145+
title: "Recursive Tree",
146+
data: recurTree1,
147+
desc: "",
148+
cover: "",
149+
type: "tree",
150+
typeName: "Tree",
151+
},
152+
{
153+
title: "Simple Array",
154+
data: array1,
155+
desc: "",
156+
cover: "",
157+
type: "array",
158+
typeName: "Array",
159+
},
160+
{
161+
title: "Simple 2D Matrix",
162+
data: board1,
163+
desc: "",
164+
cover: "",
165+
type: "board",
166+
typeName: "2D Matrix (or Adjacency Matrix)",
167+
},
168+
{
169+
title: "Simple Graph",
170+
data: graph1,
171+
desc: "",
172+
cover: "",
173+
type: "graph",
174+
typeName: "Graph",
175+
},
176+
],
177+
custom: [],
178+
};

0 commit comments

Comments
 (0)