Merge remote-tracking branch 'origin/main'

# Conflicts:
#	package.json
#	pnpm-lock.yaml
This commit is contained in:
2026-06-02 17:22:07 +08:00
15 changed files with 1425 additions and 1118 deletions
+2
View File
@@ -0,0 +1,2 @@
# Redux Persistence Location
VITE_REDUX_STORAGE=local
+27
View File
@@ -0,0 +1,27 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
commit-message:
prefix: "chore: "
groups:
dependency-updates:
patterns: ["*"]
update-types: ["minor", "patch"]
ignore:
- dependency-name: "@types/node"
update-types: ["version-update:semver-major"]
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
+5 -5
View File
@@ -27,15 +27,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v4
uses: actions/setup-node@v6
with:
node-version: '20'
- name: Setup pnpm
uses: pnpm/action-setup@v4
uses: pnpm/action-setup@v5
with:
version: latest
@@ -45,7 +45,7 @@ jobs:
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
@@ -62,7 +62,7 @@ jobs:
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
uses: actions/upload-pages-artifact@v4
with:
path: './dist'
+1 -48
View File
@@ -1,50 +1,3 @@
# 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,
},
})
```
This template provides a minimal setup to get React working in Vite.
-44
View File
@@ -1,44 +0,0 @@
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"
import react from "eslint-plugin-react"
export default tseslint.config(
{ ignores: ["dist"] },
{
extends: [
js.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
...tseslint.configs.stylisticTypeChecked,
],
files: ["**/*.{ts,tsx}"],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
parserOptions: {
project: ["./tsconfig.node.json", "./tsconfig.app.json"],
tsconfigRootDir: import.meta.dirname,
},
},
plugins: {
"react-hooks": reactHooks,
"react-refresh": reactRefresh,
react,
},
rules: {
...reactHooks.configs.recommended.rules,
"react-refresh/only-export-components": [
"warn",
{ allowConstantExport: true },
],
...react.configs.recommended.rules,
...react.configs['jsx-runtime'].rules,
"@typescript-eslint/no-unused-vars": 0
},
settings: {
react: { version: "19.1" },
},
},
)
+5 -4
View File
@@ -12,19 +12,20 @@
"predeploy": "pnpm build"
},
"dependencies": {
"@reduxjs/toolkit": "^2.12.0",
"@tailwindcss/vite": "^4.3.0",
"@reduxjs/toolkit": "^2.11.2",
"@tailwindcss/vite": "^4.2.2",
"axios": "^1.16.1",
"moment": "^2.30.1",
"dayjs": "^1.11.20",
"react": "^19.2.6",
"react-dom": "^19.2.6",
"react-redux": "^9.3.0",
"react-router": "^7.16.0",
"react-router-dom": "^7.16.0",
"redux-persist": "^6.0.0",
"tailwindcss": "^4.3.0"
},
"devDependencies": {
"@eslint/js": "^10.0.1",
"@eslint/js": "^9.39.1",
"@types/node": "^25.9.1",
"@types/react": "^19.2.15",
"@types/react-dom": "^19.2.3",
+1308 -983
View File
File diff suppressed because it is too large Load Diff
+6
View File
@@ -0,0 +1,6 @@
import dayjs from "dayjs"
import duration from "dayjs/plugin/duration"
dayjs.extend(duration)
console.log("Global Dayjs plugins initialised.")
+1
View File
@@ -0,0 +1 @@
import "./dayjs"
@@ -1,16 +1,16 @@
import { Outlet, Link } from "react-router-dom"
import { useMemo, useState } from "react"
import moment from "moment"
import { useMemo } from "react"
import dayjs from "dayjs"
/**
* Main application component that serves as the root layout.
* Uses React Router's Outlet to render child routes.
*/
export default function App() {
const today = useMemo(() => moment(), [])
export default function HeroLayout() {
const today = useMemo(() => dayjs(), [])
return (
<div className="min-h-screen bg-gray-50">
<div className="min-h-screen bg-gray-50 flex flex-col">
{/* Navigation Header */}
<header className="bg-white shadow-sm border-b">
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
@@ -45,7 +45,7 @@ export default function App() {
</header>
{/* Main Content Area */}
<main className="max-w-7xl mx-auto py-6 sm:px-6 lg:px-8">
<main className="max-w-7xl mx-auto py-6 sm:px-6 lg:px-8 grow">
<div className="px-4 py-6 sm:px-0">
<Outlet />
</div>
+9 -5
View File
@@ -1,8 +1,10 @@
import { StrictMode } from "react"
import { createRoot } from "react-dom/client"
import { Provider } from "react-redux"
import { Provider as ReduxProvider } from "react-redux"
import { PersistGate } from "redux-persist/integration/react"
import { RouterProvider } from "react-router-dom"
import store from "@/store"
import "@/init"
import store, { persistor } from "@/store"
import router from "@/router"
import "./index.css"
@@ -12,8 +14,10 @@ import "./index.css"
*/
createRoot(document.getElementById("root")!).render(
<StrictMode>
<Provider store={store}>
<RouterProvider router={router} />
</Provider>
<ReduxProvider store={store}>
<PersistGate persistor={persistor} loading={null}>
<RouterProvider router={router} />
</PersistGate>
</ReduxProvider>
</StrictMode>,
)
+15 -8
View File
@@ -1,9 +1,16 @@
import { ComponentType } from "react"
import { createBrowserRouter } from "react-router-dom"
import App from "@/App"
import ErrorPage from "@/components/error-page"
import HomePage from "@/page/home"
import AboutPage from "@/page/about"
import ContactPage from "@/page/contact"
import HeroLayout from "@/layout/hero-layout"
function lazy<T extends { default: ComponentType<unknown> }>(importer: () => Promise<T>) {
return async () => {
const module = await importer()
return {
Component: module.default,
}
}
}
/**
* Main application router configuration using React Router v6.
@@ -13,20 +20,20 @@ const router = createBrowserRouter(
[
{
path: "/",
element: <App />,
element: <HeroLayout />,
errorElement: <ErrorPage />,
children: [
{
index: true,
element: <HomePage />,
lazy: lazy(() => import("@/page/home")),
},
{
path: "about",
element: <AboutPage />,
lazy: lazy(() => import("@/page/about")),
},
{
path: "contact",
element: <ContactPage />,
lazy: lazy(() => import("@/page/contact")),
},
],
},
+39 -14
View File
@@ -1,22 +1,47 @@
import { configureStore } from "@reduxjs/toolkit"
import { configureStore, combineReducers } from "@reduxjs/toolkit"
import { useDispatch, useSelector } from "react-redux"
import authReducer from "./auth-slice.ts"
import {
persistStore,
persistReducer,
FLUSH,
REHYDRATE,
PAUSE,
PERSIST,
PURGE,
REGISTER,
} from "redux-persist"
import createWebStorage from "redux-persist/es/storage/createWebStorage"
import authReducer from "./auth-slice"
/**
* The Redux store instance for the application.
*
* This store is configured using [`configureStore`](https://redux-toolkit.js.org/api/configureStore)
* from <code>@reduxjs/toolkit</code>. It combines various slice reducers into
* a single root redux.
*/
const store = configureStore({
reducer: {
auth: authReducer,
},
const storage = createWebStorage(import.meta.env.VITE_REDUX_STORAGE ?? "local")
const persistConfig = {
key: "root",
storage,
whitelist: ["auth"],
// blacklist: ['department'],
}
const rootReducer = combineReducers({
auth: authReducer,
})
const persistedReducer = persistReducer(persistConfig, rootReducer)
const store = configureStore({
reducer: persistedReducer,
middleware: (getDefaultMiddleware) =>
getDefaultMiddleware({
serializableCheck: {
ignoredActions: [FLUSH, REHYDRATE, PAUSE, PERSIST, PURGE, REGISTER],
},
}),
})
export const persistor = persistStore(store)
export default store
export type RootState = ReturnType<typeof store.getState>
export type RootState = ReturnType<typeof rootReducer>
export type AppDispatch = typeof store.dispatch
export type AppStore = typeof store
+1 -1
View File
@@ -1,6 +1,6 @@
/// <reference types="vite/client" />
interface ImportMetaEnv {
// todo add env properties here
readonly VITE_REDUX_STORAGE: "local" | "session"
}
interface ImportMeta {