-
Notifications
You must be signed in to change notification settings - Fork 350
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'openbuildxyz:main' into main
- Loading branch information
Showing
45 changed files
with
6,515 additions
and
0 deletions.
There are no files selected for viewing
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,15 @@ | ||
name: pr-valid-check | ||
on: | ||
pull_request: | ||
|
||
|
||
jobs: | ||
check_pr: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: print context | ||
run: echo ${{ github.actor }} | ||
- name: Check if all changes are in members folder | ||
run: | | ||
git diff --name-only ${{ github.event.before }} ${{ github.event.after }} | grep -v "^members/${{ github.actor }}/" |
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,23 @@ | ||
<!-- | ||
* @Author: Jason | ||
* @Date: 2024-06-04 13:27:20 | ||
* @LastEditors: Jason [email protected] | ||
* @LastEditTime: 2024-06-04 13:34:47 | ||
* @FilePath: /Web3-Frontend-Bootcamp/members/github_id/readme.md | ||
* @Description: | ||
--> | ||
# Web3 前端训练营报名 | ||
|
||
## 个人信息 | ||
|
||
* Github ID: JasonStu | ||
|
||
* Wechat ID: ****** | ||
|
||
* Openbuild Username: Xujiehong | ||
|
||
* ERC20 钱包地址: 0x3d301F2784646316b5bA594559f4aFD3D7435edf | ||
|
||
### 个人介绍 | ||
本人有8年的前端和移动端开发经验,熟悉React ReactNative Vue, 正在学习solidity, 希望加入Web3开发,一起加油. | ||
|
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,18 @@ | ||
module.exports = { | ||
root: true, | ||
env: { browser: true, es2020: true }, | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:react-hooks/recommended', | ||
], | ||
ignorePatterns: ['dist', '.eslintrc.cjs'], | ||
parser: '@typescript-eslint/parser', | ||
plugins: ['react-refresh'], | ||
rules: { | ||
'react-refresh/only-export-components': [ | ||
'warn', | ||
{ allowConstantExport: true }, | ||
], | ||
}, | ||
} |
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,24 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
dist | ||
dist-ssr | ||
*.local | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? |
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,30 @@ | ||
# React + TypeScript + Vite | ||
|
||
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. | ||
|
||
Currently, two official plugins are available: | ||
|
||
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh | ||
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh | ||
|
||
## Expanding the ESLint configuration | ||
|
||
If you are developing a production application, we recommend updating the configuration to enable type aware lint rules: | ||
|
||
- Configure the top-level `parserOptions` property like this: | ||
|
||
```js | ||
export default { | ||
// other rules... | ||
parserOptions: { | ||
ecmaVersion: 'latest', | ||
sourceType: 'module', | ||
project: ['./tsconfig.json', './tsconfig.node.json'], | ||
tsconfigRootDir: __dirname, | ||
}, | ||
} | ||
``` | ||
|
||
- Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` or `plugin:@typescript-eslint/strict-type-checked` | ||
- Optionally add `plugin:@typescript-eslint/stylistic-type-checked` | ||
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and add `plugin:react/recommended` & `plugin:react/jsx-runtime` to the `extends` list |
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,21 @@ | ||
<!-- | ||
* @Author: Jason [email protected] | ||
* @Date: 2024-06-04 14:00:18 | ||
* @LastEditors: Jason [email protected] | ||
* @LastEditTime: 2024-06-04 20:31:49 | ||
* @FilePath: /Web3-Frontend-Bootcamp/members/github_id/JasonStu/task1/TodoList-vite/index.html | ||
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE | ||
--> | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>TodoList</title> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
<script type="module" src="/src/main.tsx"></script> | ||
</body> | ||
</html> |
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,28 @@ | ||
{ | ||
"name": "todolist-vite", | ||
"private": true, | ||
"version": "0.0.0", | ||
"type": "module", | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "tsc && vite build", | ||
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", | ||
"preview": "vite preview" | ||
}, | ||
"dependencies": { | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0" | ||
}, | ||
"devDependencies": { | ||
"@types/react": "^18.2.66", | ||
"@types/react-dom": "^18.2.22", | ||
"@typescript-eslint/eslint-plugin": "^7.2.0", | ||
"@typescript-eslint/parser": "^7.2.0", | ||
"@vitejs/plugin-react-swc": "^3.5.0", | ||
"eslint": "^8.57.0", | ||
"eslint-plugin-react-hooks": "^4.6.0", | ||
"eslint-plugin-react-refresh": "^0.4.6", | ||
"typescript": "^5.2.2", | ||
"vite": "^5.2.0" | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,42 @@ | ||
#root { | ||
max-width: 1280px; | ||
margin: 0 auto; | ||
padding: 2rem; | ||
text-align: center; | ||
} | ||
|
||
.logo { | ||
height: 6em; | ||
padding: 1.5em; | ||
will-change: filter; | ||
transition: filter 300ms; | ||
} | ||
.logo:hover { | ||
filter: drop-shadow(0 0 2em #646cffaa); | ||
} | ||
.logo.react:hover { | ||
filter: drop-shadow(0 0 2em #61dafbaa); | ||
} | ||
|
||
@keyframes logo-spin { | ||
from { | ||
transform: rotate(0deg); | ||
} | ||
to { | ||
transform: rotate(360deg); | ||
} | ||
} | ||
|
||
@media (prefers-reduced-motion: no-preference) { | ||
a:nth-of-type(2) .logo { | ||
animation: logo-spin infinite 20s linear; | ||
} | ||
} | ||
|
||
.card { | ||
padding: 2em; | ||
} | ||
|
||
.read-the-docs { | ||
color: #888; | ||
} |
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,47 @@ | ||
/* | ||
* @Author: Jason [email protected] | ||
* @Date: 2024-06-04 14:00:18 | ||
* @LastEditors: Jason [email protected] | ||
* @LastEditTime: 2024-06-04 20:32:13 | ||
* @FilePath: /Web3-Frontend-Bootcamp/members/github_id/JasonStu/task1/TodoList-vite/src/App.tsx | ||
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE | ||
*/ | ||
import { useState } from "react"; | ||
import reactLogo from "./assets/react.svg"; | ||
import viteLogo from "/vite.svg"; | ||
import "./App.css"; | ||
import Header from "./component/Header"; | ||
import TodoList from "./component/ToDoList"; | ||
import AddToDo from "./component/AddToDo"; | ||
import useLocalStorage from "./Tool/localStorage"; | ||
interface ToDoItem { | ||
title: string; | ||
checked: boolean; | ||
} | ||
|
||
const App = () => { | ||
const [List, , , getItemList] = useLocalStorage("list"); | ||
|
||
const [todoList, setTodoList] = useState<ToDoItem[]>(List); | ||
|
||
const updateInfo = ()=>{ | ||
const list: ToDoItem[] = getItemList(); | ||
setTodoList(list); | ||
} | ||
|
||
return ( | ||
<> | ||
<Header /> | ||
<AddToDo | ||
onFinish={updateInfo} | ||
/> | ||
<TodoList | ||
list={todoList} | ||
|
||
onListChange={updateInfo} | ||
/> | ||
</> | ||
); | ||
}; | ||
|
||
export default App; |
50 changes: 50 additions & 0 deletions
50
members/JasonStu/task1/TodoList-vite/src/Tool/localStorage.tsx
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,50 @@ | ||
import { useState } from "react"; | ||
|
||
interface ToDoItem { | ||
title: string; | ||
checked: boolean; | ||
} | ||
|
||
const useLocalStorage = (key: string) => { | ||
|
||
const storedValue: ToDoItem[] = localStorage.getItem(key) | ||
? JSON.parse(localStorage.getItem(key) || "") | ||
: []; | ||
|
||
const [List, setList] = useState<ToDoItem[]>(storedValue); | ||
const addToDoItem = (newValue: ToDoItem) => { | ||
const updatedList = getItemList(); | ||
updatedList.push(newValue); | ||
setList(updatedList); | ||
localStorage.setItem(key, JSON.stringify(updatedList)); | ||
|
||
}; | ||
|
||
const getItemList = () => { | ||
return JSON.parse(localStorage.getItem(key) || ""); | ||
}; | ||
|
||
const updateTodoItem = (checked: boolean, index: number) => { | ||
const updatedList = getItemList(); | ||
const item = updatedList[index]; | ||
item.checked = checked; | ||
setList(updatedList); | ||
localStorage.setItem(key, JSON.stringify(updatedList)); | ||
|
||
}; | ||
|
||
|
||
const deleteTodoItem = ( index: number) => { | ||
const updatedList = getItemList(); | ||
console.log('updatedList',updatedList,index); | ||
|
||
updatedList.splice(index, 1); | ||
setList(updatedList); | ||
localStorage.setItem(key, JSON.stringify(updatedList)); | ||
|
||
}; | ||
|
||
return [List, addToDoItem, updateTodoItem, getItemList,deleteTodoItem]; | ||
}; | ||
|
||
export default useLocalStorage; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
55 changes: 55 additions & 0 deletions
55
members/JasonStu/task1/TodoList-vite/src/component/AddToDo.tsx
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,55 @@ | ||
/* | ||
* @Author: Jason [email protected] | ||
* @Date: 2024-06-04 16:53:40 | ||
* @LastEditors: Jason [email protected] | ||
* @LastEditTime: 2024-06-04 20:27:52 | ||
* @FilePath: /Web3-Frontend-Bootcamp/members/github_id/JasonStu/task1/TodoList-vite/src/component/AddToDo.tsx | ||
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE | ||
*/ | ||
import { useState } from "react"; | ||
import useLocalStorage from "../Tool/localStorage"; | ||
|
||
interface ToDoItem { | ||
title: string; | ||
checked: boolean; | ||
} | ||
|
||
const LIST_KEY = "list"; | ||
|
||
const AddToDo = (props: { onFinish: () => void}) => { | ||
const [inputValue, setInputValue] = useState(""); | ||
const [List, addToDoItem, updateTodoItem] = useLocalStorage(LIST_KEY); | ||
|
||
return ( | ||
<div style={{minWidth:'250px',display:'flex',flexDirection:'row',justifyContent:'space-between'}}> | ||
<input | ||
style={{ | ||
width:'100%', | ||
marginRight:'10px' | ||
}} | ||
value={inputValue} | ||
onChange={(e) => { | ||
setInputValue(e.target.value.trimStart()); | ||
}} | ||
/> | ||
<button | ||
onClick={() => { | ||
if (inputValue.length ===0) { | ||
return; | ||
} | ||
const item: ToDoItem = { | ||
title: inputValue, | ||
checked: false, | ||
}; | ||
addToDoItem(item); | ||
props.onFinish() | ||
setInputValue('') | ||
}} | ||
> | ||
ADD | ||
</button> | ||
</div> | ||
); | ||
}; | ||
|
||
export default AddToDo; |
9 changes: 9 additions & 0 deletions
9
members/JasonStu/task1/TodoList-vite/src/component/Header.tsx
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,9 @@ | ||
import { useEffect } from "react" | ||
|
||
|
||
const Header = ()=>{ | ||
|
||
return <h1>TodoList</h1> | ||
} | ||
|
||
export default Header |
Oops, something went wrong.