Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/migrate to shadcn UI #377

Merged
merged 39 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
0f7fd4d
feat: use vite as packager
Kilerd Oct 4, 2024
d55819e
feat: restore prettier command
Kilerd Oct 4, 2024
c8040c8
feat: integrate with shadcn/ui
Kilerd Oct 4, 2024
1cd1257
feat: new sidebar and dashboard
Kilerd Oct 5, 2024
5a14293
feat: new composed chart for report
Kilerd Oct 5, 2024
8b04a9e
feat: refactor the accounts page
Kilerd Oct 5, 2024
94c5039
feat: refactor commodity page
Kilerd Oct 5, 2024
ed310c0
feat: refactor single commodity page
Kilerd Oct 5, 2024
b45afab
feat: doucment page
Kilerd Oct 5, 2024
d539e20
feat: budget page
Kilerd Oct 5, 2024
628eaac
feat: single budget page
Kilerd Oct 5, 2024
23c3095
feat: report page
Kilerd Oct 5, 2024
2eedc10
feat: new raw edit page
Kilerd Oct 5, 2024
a539b24
feat: setting page
Kilerd Oct 5, 2024
f24039c
feat: new notification
Kilerd Oct 5, 2024
a77bbf0
feat: new transaction model
Kilerd Oct 5, 2024
d98cfda
feat: preview model and edit model
Kilerd Oct 5, 2024
008aac0
feat: new account line
Kilerd Oct 5, 2024
905e4e6
fix: no translate for breadcrumb
Kilerd Oct 5, 2024
d0931b2
batch balance page
Kilerd Oct 6, 2024
b5048be
feat: budget line
Kilerd Oct 6, 2024
a649227
feat: journal table line
Kilerd Oct 6, 2024
b5102b8
feat: journal preview model
Kilerd Oct 6, 2024
714d147
feat: account balance graph
Kilerd Oct 6, 2024
9c4bf0e
feat: dropzone
Kilerd Oct 6, 2024
322ec57
refact: remove useless dependency
Kilerd Oct 6, 2024
efb9a59
feat: add some padding for setting page
Kilerd Oct 6, 2024
a47557c
payee and narration can be clicked
Kilerd Oct 6, 2024
69fec9c
style: prettier code
Kilerd Oct 6, 2024
d22af45
feat: log scale for graph
Kilerd Oct 6, 2024
dd3a941
style: fix ts compile error
Kilerd Oct 6, 2024
4af0559
feat: make error count red
Kilerd Oct 6, 2024
88ebba0
refact: remove done todo
Kilerd Oct 6, 2024
13ee169
feat: grid for homepage
Kilerd Oct 6, 2024
8c44cdc
feat: add some missing i18n
Kilerd Oct 6, 2024
786787d
fix: update frontend dist folder after switching to vite compiler
Kilerd Oct 6, 2024
616f778
style: elide the lifetimes
Kilerd Oct 6, 2024
aa47a18
fix: update frontend dist folder after switching to vite compiler
Kilerd Oct 6, 2024
86bc9b2
chore: use stable rust toolchain for clippy
Kilerd Oct 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/build-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
with:
toolchain: ${{ matrix.rust }}
- name: fake frontend build
run: mkdir -p build
run: mkdir -p dist
working-directory: ./frontend
- name: Run test
run: cargo test --features ${{matrix.features}}
Expand Down Expand Up @@ -99,7 +99,7 @@ jobs:
with:
toolchain: stable
- name: fake frontend build
run: mkdir -p build
run: mkdir -p dist
working-directory: ./frontend
- name: Run cargo-tarpaulin
uses: actions-rs/[email protected]
Expand All @@ -123,7 +123,7 @@ jobs:
toolchain: nightly
components: rustfmt
- name: fake frontend build
run: mkdir -p build
run: mkdir -p dist
working-directory: ./frontend
- name: Format
run: cargo fmt --all -- --check
Expand All @@ -135,10 +135,10 @@ jobs:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: nightly
toolchain: stable
components: clippy
- name: fake frontend build
run: mkdir -p build
run: mkdir -p dist
working-directory: ./frontend
- name: Clippy
run: cargo clippy --all-features --all-targets -- -D warnings -D clippy::dbg_macro -A clippy::empty_docs
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
name: frontend-build
if-no-files-found: error
retention-days: 1
path: ./frontend/build
path: ./frontend/dist

publish:
name: Binary ${{ matrix.target }} (on ${{ matrix.os }})
Expand Down Expand Up @@ -109,7 +109,7 @@ jobs:
- uses: actions/download-artifact@v4
with:
name: frontend-build
path: ./frontend/build
path: ./frontend/dist

- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ zhang-frontend/.DS_Store
.env
.build_version
lconv.info
.cache
41 changes: 21 additions & 20 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

# 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?
96 changes: 50 additions & 46 deletions frontend/README.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,50 @@
# Getting Started with Create React App

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

## Available Scripts

In the project directory, you can run:

### `npm start`

Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.

The page will reload if you make edits.\
You will also see any lint errors in the console.

### `npm test`

Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

### `npm run build`

Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `npm run eject`

**Note: this is a one-way operation. Once you `eject`, you can’t go back!**

If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).
# 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 tseslint.config({
languageOptions: {
// other options...
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
},
})
```

- Replace `tseslint.configs.recommended` to `tseslint.configs.recommendedTypeChecked` or `tseslint.configs.strictTypeChecked`
- Optionally add `...tseslint.configs.stylisticTypeChecked`
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and update the config:

```js
// eslint.config.js
import react from 'eslint-plugin-react'

export default tseslint.config({
// Set the react version
settings: { react: { version: '18.3' } },
plugins: {
// Add the react plugin
react,
},
rules: {
// other rules...
// Enable its recommended rules
...react.configs.recommended.rules,
...react.configs['jsx-runtime'].rules,
},
})
```
20 changes: 20 additions & 0 deletions frontend/components.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "new-york",
"rsc": false,
"tsx": true,
"tailwind": {
"config": "tailwind.config.js",
"css": "src/global.css",
"baseColor": "zinc",
"cssVariables": true,
"prefix": ""
},
"aliases": {
"components": "@/components",
"utils": "@/lib/utils",
"ui": "@/components/ui",
"lib": "@/lib",
"hooks": "@/hooks"
}
}
29 changes: 29 additions & 0 deletions frontend/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import js from '@eslint/js'
import globals from 'globals'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import tseslint from 'typescript-eslint'

export default tseslint.config(
{ ignores: ['dist'] },
{
extends: [js.configs.recommended, ...tseslint.configs.recommended],
files: ['**/*.{ts,tsx}'],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
},
plugins: {
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
},
rules: {
...reactHooks.configs.recommended.rules,
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
'max-len': ['error', { code: 140, tabWidth: 2}],
},
},
)
17 changes: 17 additions & 0 deletions frontend/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="apple-touch-icon" href="/logo.jpg" />
<link rel="manifest" href="/manifest.json" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Zhang accounting</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
Loading
Loading