Skip to content

Commit 07be7a5

Browse files
author
lucifer
committed
feat: 可视化数据结构
1 parent 9c7ba11 commit 07be7a5

File tree

17 files changed

+12921
-35
lines changed

17 files changed

+12921
-35
lines changed

.github/deploy.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# This is a basic workflow to help you get started with Actions
2+
name: deploy
3+
4+
# Controls when the action will run. Triggers the workflow on push or pull request
5+
# events but only for the master branch
6+
on:
7+
release:
8+
types: [published]
9+
10+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
11+
jobs:
12+
# This workflow contains a single job called "build"
13+
build:
14+
# The type of runner that the job will run on
15+
runs-on: ubuntu-latest
16+
# Steps represent a sequence of tasks that will be executed as part of the job
17+
steps:
18+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
19+
- name: Checkout
20+
uses: actions/checkout@v2 # If you're using actions/checkout@v2 you must set persist-credentials to false in most cases for the deployment to work correctly.
21+
with:
22+
persist-credentials: false
23+
24+
# Runs a single command using the runners shell
25+
- name: Install and Build
26+
run: |
27+
npm install
28+
npm run-script build
29+
# Copy Files
30+
- name: Copy CNAME and 404.html
31+
run: |
32+
cp ./docs/CNAME ./dist/CNAME
33+
cp ./dist/index.html ./dist/404.html
34+
# Deploy to GitHub Pages
35+
- name: Deploy
36+
uses: peaceiris/actions-gh-pages@v3
37+
with:
38+
personal_token: ${{ secrets.PERSONAL_TOKEN }}
39+
publish_dir: ./dist
40+
publish_branch: gh-pages
41+
42+
merge:
43+
runs-on: ubuntu-latest
44+
steps:
45+
- name: Commit to repository
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.github_token }}
48+
COMMIT_MSG: |
49+
<commited by Github Action>
50+
skip-checks: true
51+
run: |
52+
git clone https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git repo
53+
cd repo
54+
# Hard-code user configuration
55+
git config user.email "[email protected]"
56+
git config user.name "lucifer's bot"
57+
git merge origin/dev
58+
git push origin master

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"private": true,
55
"dependencies": {
66
"@ant-design/icons": "^4.2.2",
7+
"@excalidraw/excalidraw": "^0.2.0",
78
"@testing-library/jest-dom": "^4.2.4",
89
"@testing-library/react": "^9.3.2",
910
"@testing-library/user-event": "^7.1.2",

public/index.html

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
<!DOCTYPE html>
22
<html lang="en">
3-
<head>
4-
<meta charset="utf-8" />
5-
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
6-
<meta name="viewport" content="width=device-width, initial-scale=1" />
7-
<meta name="theme-color" content="#000000" />
8-
<meta
9-
name="description"
10-
content="Web site created using create-react-app"
11-
/>
12-
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
13-
<!--
3+
<head>
4+
<meta charset="utf-8" />
5+
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1" />
7+
<meta name="theme-color" content="#000000" />
8+
<meta
9+
name="description"
10+
content="Web site created using create-react-app"
11+
/>
12+
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
13+
<!--
1414
manifest.json provides metadata used when your web app is installed on a
1515
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
1616
-->
17-
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
18-
<!--
17+
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
18+
<!--
1919
Notice the use of %PUBLIC_URL% in the tags above.
2020
It will be replaced with the URL of the `public` folder during the build.
2121
Only files inside the `public` folder can be referenced from the HTML.
@@ -24,12 +24,12 @@
2424
work correctly both with client-side routing and a non-root public URL.
2525
Learn how to configure a non-root public URL by running `npm run build`.
2626
-->
27-
<title>React App</title>
28-
</head>
29-
<body>
30-
<noscript>You need to enable JavaScript to run this app.</noscript>
31-
<div id="root"></div>
32-
<!--
27+
<title>React App</title>
28+
</head>
29+
<body>
30+
<noscript>You need to enable JavaScript to run this app.</noscript>
31+
<div id="root"></div>
32+
<!--
3333
This HTML file is a template.
3434
If you open it directly in the browser, you will see an empty page.
3535
@@ -39,5 +39,5 @@
3939
To begin the development, run `npm start` or `yarn start`.
4040
To create a production bundle, use `npm run build` or `yarn build`.
4141
-->
42-
</body>
42+
</body>
4343
</html>

src/App.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ import checkUpdate from "./checkUpdates";
2020
import "antd/dist/antd.css";
2121
import "./App.css";
2222
import CodeTemplates from "./codeTemplates/codeTemplate";
23-
import ComplexityRating from './complexityRating/index'
23+
import ComplexityRating from "./complexityRating/index";
24+
import DataStrutureVis from "./dataStructureVis/index";
2425
// import { data as a } from "./db/binary-tree";
2526

2627
const { problems, selected } = db;
@@ -103,7 +104,7 @@ function App() {
103104
const [page, setPage] = useState("");
104105
const [inLeetCode, setInLeetCode] = useState(true);
105106

106-
if (!inLeetCode) return window.open(LEETCODE_CN_URL + "/problemset/all/");
107+
// if (!inLeetCode) return window.open(LEETCODE_CN_URL + "/problemset/all/");
107108

108109
// setTimeout(() => {
109110
// const canvas = document.querySelector("#canvas");
@@ -193,9 +194,12 @@ function App() {
193194

194195
{page === "" && (
195196
<Tabs type="card">
196-
<TabPane key="app" tab="代码模板">
197+
<TabPane key="code-template" tab="代码模板">
197198
<CodeTemplates page={page} tempaltes={tempaltes}></CodeTemplates>
198199
</TabPane>
200+
<TabPane key="data-structure-vis" tab="数据结构可视化">
201+
<DataStrutureVis></DataStrutureVis>
202+
</TabPane>
199203
<TabPane key="complexityRating" tab="复杂度速查">
200204
<ComplexityRating />
201205
</TabPane>

src/dataStructureVis/index.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.update-scene {
2+
margin-top: 20px;
3+
}

0 commit comments

Comments
 (0)