Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
48 changes: 13 additions & 35 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,52 +12,30 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc

- name: Use Yarn 4
run: corepack enable

- name: Inject Environment Variables
run: |
echo "PUBLIC_API_URL=${{ vars.PUBLIC_API_URL }}" >> .env

- name: Build
run: yarn install --immutable && yarn build

- name: Upload Build Artifacts
uses: actions/upload-artifact@v4
with:
name: dist-files
path: dist/
retention-days: 1

deploy-cloudflare:
runs-on: ubuntu-latest
needs: build
permissions:
contents: read
deployments: write
name: Deploy to Cloudflare Pages
steps:
- name: Download Build Artifacts
uses: actions/download-artifact@v4
with:
name: dist-files
path: dist/

- name: Deploy to Cloudflare Pages
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy dist --project-name=fcc-cms-6b4t
gitHubToken: ${{ secrets.GITHUB_TOKEN }}

deploy-qcloud:
deploy-eo:
runs-on: ubuntu-latest
needs: build
permissions:
Expand All @@ -71,7 +49,7 @@ jobs:
with:
name: dist-files
path: dist/

- name: Deploy to QCloud Pages
id: deploy
run: |
Expand All @@ -81,7 +59,7 @@ jobs:
else
edgeone pages deploy ./dist -n fcc-dashboard -e preview -t ${{ secrets.QCLOUD_PAGES_TOKEN }} 2>&1 | tee deploy.log
fi

- name: Extract Preview URL
id: extract-url
run: |
Expand All @@ -100,22 +78,22 @@ jobs:
echo "Deploy log not found"
echo "preview_url=" >> $GITHUB_OUTPUT
fi

- name: Comment on PR
if: github.event_name == 'pull_request' && steps.extract-url.outputs.preview_url != ''
uses: actions/github-script@v7
with:
script: |
const previewUrl = '${{ steps.extract-url.outputs.preview_url }}';
const comment = `🚀 **预览部署完成!**

📱 **预览地址**: ${previewUrl}

> 此预览链接将在部署完成后可用,请稍等片刻再访问。

---
*由 GitHub Actions 自动生成*`;

github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
lts/iron
lts/krypton
4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"tabWidth": 2,
"printWidth": 120
}
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@

- **前端框架**: React 19 + TypeScript
- **构建工具**: Rsbuild
- **UI 组件库**: Mantine + Ant Design + Tailwind CSS
- **UI 组件库**: Ant Design + Tailwind CSS
- **状态管理**: Zustand + TanStack Query
- **表单处理**: Mantine Form + Zod
- **表单处理**: React Hook Form + Zod
- **路由**: React Router DOM
- **样式**: Tailwind CSS + PostCSS

## 开发环境要求

- Node.js 18+
- Yarn 4.4.1+
- Node.js 22+
- Yarn 4.6.1+

## 快速开始

Expand Down Expand Up @@ -84,4 +84,4 @@ src/
├── types/ # TypeScript 类型定义
├── utils/ # 工具函数
└── styles/ # 样式文件
```
```
69 changes: 29 additions & 40 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,54 +4,43 @@
"version": "1.0.0",
"scripts": {
"build": "rsbuild build",
"check": "biome check --write",
"check": "prettier --check",
"dev": "rsbuild dev --open",
"format": "biome format --write",
"format": "prettier . --write",
"preview": "rsbuild preview"
},
"dependencies": {
"@ant-design/v5-patch-for-react-19": "^1.0.3",
"@hello-pangea/dnd": "^18.0.1",
"@mantine/core": "^8.1.2",
"@mantine/dates": "^8.1.2",
"@mantine/dropzone": "^8.1.2",
"@mantine/form": "^8.1.2",
"@mantine/hooks": "^8.1.2",
"@mantine/notifications": "^8.1.2",
"@tabler/icons-react": "^3.34.0",
"@tailwindcss/forms": "^0.5.10",
"@tanstack/react-query": "^5.81.5",
"antd": "^5.26.3",
"axios": "^1.10.0",
"@hookform/resolvers": "^5.2.2",
"@tabler/icons-react": "^3.36.1",
"@tanstack/react-query": "^5.90.17",
"antd": "^6.2.0",
"axios": "^1.13.2",
"clsx": "^2.1.1",
"cos-js-sdk-v5": "^1.10.1",
"dayjs": "^1.11.13",
"es-toolkit": "^1.39.6",
"lodash": "^4.17.21",
"mantine-form-zod-resolver": "^1.3.0",
"nanoid": "^5.1.5",
"nuqs": "^2.4.3",
"react": "^19.1.0",
"react-dom": "^19.1.0",
"react-hook-form": "^7.60.0",
"react-router-dom": "^7.6.3",
"swr": "^2.3.4",
"tailwind-merge": "^2.6.0",
"zod": "^3.25.74",
"zustand": "^5.0.6"
"dayjs": "^1.11.19",
"es-toolkit": "^1.44.0",
"nanoid": "^5.1.6",
"nuqs": "^2.8.6",
"react": "^19.2.3",
"react-dom": "^19.2.3",
"react-hook-form": "^7.71.1",
"react-router-dom": "^7.12.0",
"swr": "^2.3.8",
"tailwind-merge": "^3.4.0",
"zod": "^4.3.5",
"zustand": "^5.0.10"
},
"devDependencies": {
"@rsbuild/core": "1.4.3",
"@rsbuild/plugin-react": "1.3.3",
"@rsbuild/plugin-svgr": "^1.2.0",
"@types/lodash": "^4.17.20",
"@types/node": "^22.16.0",
"@types/react": "^19.1.8",
"@types/react-dom": "^19.1.6",
"postcss-preset-mantine": "^1.18.0",
"postcss-simple-vars": "^7.0.1",
"tailwindcss": "^3.4.17",
"typescript": "^5.8.3"
"@rsbuild/core": "1.7.2",
"@rsbuild/plugin-react": "1.4.3",
"@rsbuild/plugin-svgr": "^1.2.4",
"@tailwindcss/postcss": "^4.1.18",
"@types/node": "^22.19.7",
"@types/react": "^19.2.8",
"@types/react-dom": "^19.2.3",
"prettier": "3.8.0",
"tailwindcss": "^4.1.18",
"typescript": "^5.9.3"
},
"packageManager": "yarn@4.4.1"
}
12 changes: 1 addition & 11 deletions postcss.config.cjs
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
module.exports = {
plugins: {
tailwindcss: {},
"postcss-preset-mantine": {},
"postcss-simple-vars": {
variables: {
"mantine-breakpoint-xs": "36em",
"mantine-breakpoint-sm": "48em",
"mantine-breakpoint-md": "62em",
"mantine-breakpoint-lg": "75em",
"mantine-breakpoint-xl": "88em",
},
},
"@tailwindcss/postcss": {},
},
};
2 changes: 1 addition & 1 deletion rsbuild.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ export default defineConfig({
define: publicVars,
},
html: {
title: "FCC Dashboard",
title: "FCC 工作间",
},
});
6 changes: 1 addition & 5 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,11 @@ import { Navigate } from "react-router-dom";
import useAuthStore from "@/stores/auth";
import "@/api/interceptors";

import FullScreenLoading from "@/components/Loading";
import FullScreenLoading from "@/components/Layout/FullScreenLoading";
import DashboardLayout from "@/pages/dashboard/layout";

import "@/styles/global.css";

import "@mantine/core/styles.css";
import "@mantine/dates/styles.css";
import "@mantine/notifications/styles.css";

const App = () => {
const { user, _hasHydrated } = useAuthStore();

Expand Down
26 changes: 20 additions & 6 deletions src/api/auth/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
import Axios from "@/api";
import { z } from "zod";

import type { User } from "@/types/User";
import { InferZodType } from "@/types/common";

export async function login(data: { email: string; password: string }) {
const res = await Axios.post<{ token: string; user: User }>(
"/auth/login",
data
);
return res.data;
export const UpdatePasswordApiBody = z.object({
newPassword: z.string().min(8, "密码长度至少为8位"),
});
export class AuthAPI {
static async login(data: { email: string; password: string }) {
const res = await Axios.post<{ token: string; user: User }>("/auth/login", data);
return res.data;
}

static async getCurrentUser() {
const res = await Axios.get<User>("/auth/me");
return res.data;
}

static async updatePassword(body: InferZodType<typeof UpdatePasswordApiBody>) {
const res = await Axios.post<User>("/auth/update-password", body);
return res.data;
}
}
Loading