Merge remote-tracking branch 'origin/main'
# Conflicts: # package.json # pnpm-lock.yaml
This commit is contained in:
@@ -0,0 +1,2 @@
|
|||||||
|
# Redux Persistence Location
|
||||||
|
VITE_REDUX_STORAGE=local
|
||||||
@@ -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"
|
||||||
@@ -27,15 +27,15 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: '20'
|
node-version: '20'
|
||||||
|
|
||||||
- name: Setup pnpm
|
- name: Setup pnpm
|
||||||
uses: pnpm/action-setup@v4
|
uses: pnpm/action-setup@v5
|
||||||
with:
|
with:
|
||||||
version: latest
|
version: latest
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ jobs:
|
|||||||
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Setup pnpm cache
|
- name: Setup pnpm cache
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v5
|
||||||
with:
|
with:
|
||||||
path: ${{ env.STORE_PATH }}
|
path: ${{ env.STORE_PATH }}
|
||||||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||||
@@ -62,7 +62,7 @@ jobs:
|
|||||||
uses: actions/configure-pages@v5
|
uses: actions/configure-pages@v5
|
||||||
|
|
||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
uses: actions/upload-pages-artifact@v3
|
uses: actions/upload-pages-artifact@v4
|
||||||
with:
|
with:
|
||||||
path: './dist'
|
path: './dist'
|
||||||
|
|
||||||
|
|||||||
@@ -1,50 +1,3 @@
|
|||||||
# React + TypeScript + Vite
|
# React + TypeScript + Vite
|
||||||
|
|
||||||
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
This template provides a minimal setup to get React working in Vite.
|
||||||
|
|
||||||
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,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
```
|
|
||||||
@@ -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
@@ -12,19 +12,20 @@
|
|||||||
"predeploy": "pnpm build"
|
"predeploy": "pnpm build"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@reduxjs/toolkit": "^2.12.0",
|
"@reduxjs/toolkit": "^2.11.2",
|
||||||
"@tailwindcss/vite": "^4.3.0",
|
"@tailwindcss/vite": "^4.2.2",
|
||||||
"axios": "^1.16.1",
|
"axios": "^1.16.1",
|
||||||
"moment": "^2.30.1",
|
"dayjs": "^1.11.20",
|
||||||
"react": "^19.2.6",
|
"react": "^19.2.6",
|
||||||
"react-dom": "^19.2.6",
|
"react-dom": "^19.2.6",
|
||||||
"react-redux": "^9.3.0",
|
"react-redux": "^9.3.0",
|
||||||
"react-router": "^7.16.0",
|
"react-router": "^7.16.0",
|
||||||
"react-router-dom": "^7.16.0",
|
"react-router-dom": "^7.16.0",
|
||||||
|
"redux-persist": "^6.0.0",
|
||||||
"tailwindcss": "^4.3.0"
|
"tailwindcss": "^4.3.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@eslint/js": "^10.0.1",
|
"@eslint/js": "^9.39.1",
|
||||||
"@types/node": "^25.9.1",
|
"@types/node": "^25.9.1",
|
||||||
"@types/react": "^19.2.15",
|
"@types/react": "^19.2.15",
|
||||||
"@types/react-dom": "^19.2.3",
|
"@types/react-dom": "^19.2.3",
|
||||||
|
|||||||
Generated
+1308
-983
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,6 @@
|
|||||||
|
import dayjs from "dayjs"
|
||||||
|
import duration from "dayjs/plugin/duration"
|
||||||
|
|
||||||
|
dayjs.extend(duration)
|
||||||
|
|
||||||
|
console.log("Global Dayjs plugins initialised.")
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
import "./dayjs"
|
||||||
@@ -1,16 +1,16 @@
|
|||||||
import { Outlet, Link } from "react-router-dom"
|
import { Outlet, Link } from "react-router-dom"
|
||||||
import { useMemo, useState } from "react"
|
import { useMemo } from "react"
|
||||||
import moment from "moment"
|
import dayjs from "dayjs"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Main application component that serves as the root layout.
|
* Main application component that serves as the root layout.
|
||||||
* Uses React Router's Outlet to render child routes.
|
* Uses React Router's Outlet to render child routes.
|
||||||
*/
|
*/
|
||||||
export default function App() {
|
export default function HeroLayout() {
|
||||||
const today = useMemo(() => moment(), [])
|
const today = useMemo(() => dayjs(), [])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="min-h-screen bg-gray-50">
|
<div className="min-h-screen bg-gray-50 flex flex-col">
|
||||||
{/* Navigation Header */}
|
{/* Navigation Header */}
|
||||||
<header className="bg-white shadow-sm border-b">
|
<header className="bg-white shadow-sm border-b">
|
||||||
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
||||||
@@ -45,7 +45,7 @@ export default function App() {
|
|||||||
</header>
|
</header>
|
||||||
|
|
||||||
{/* Main Content Area */}
|
{/* 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">
|
<div className="px-4 py-6 sm:px-0">
|
||||||
<Outlet />
|
<Outlet />
|
||||||
</div>
|
</div>
|
||||||
+9
-5
@@ -1,8 +1,10 @@
|
|||||||
import { StrictMode } from "react"
|
import { StrictMode } from "react"
|
||||||
import { createRoot } from "react-dom/client"
|
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 { RouterProvider } from "react-router-dom"
|
||||||
import store from "@/store"
|
import "@/init"
|
||||||
|
import store, { persistor } from "@/store"
|
||||||
import router from "@/router"
|
import router from "@/router"
|
||||||
import "./index.css"
|
import "./index.css"
|
||||||
|
|
||||||
@@ -12,8 +14,10 @@ import "./index.css"
|
|||||||
*/
|
*/
|
||||||
createRoot(document.getElementById("root")!).render(
|
createRoot(document.getElementById("root")!).render(
|
||||||
<StrictMode>
|
<StrictMode>
|
||||||
<Provider store={store}>
|
<ReduxProvider store={store}>
|
||||||
<RouterProvider router={router} />
|
<PersistGate persistor={persistor} loading={null}>
|
||||||
</Provider>
|
<RouterProvider router={router} />
|
||||||
|
</PersistGate>
|
||||||
|
</ReduxProvider>
|
||||||
</StrictMode>,
|
</StrictMode>,
|
||||||
)
|
)
|
||||||
|
|||||||
+15
-8
@@ -1,9 +1,16 @@
|
|||||||
|
import { ComponentType } from "react"
|
||||||
import { createBrowserRouter } from "react-router-dom"
|
import { createBrowserRouter } from "react-router-dom"
|
||||||
import App from "@/App"
|
|
||||||
import ErrorPage from "@/components/error-page"
|
import ErrorPage from "@/components/error-page"
|
||||||
import HomePage from "@/page/home"
|
import HeroLayout from "@/layout/hero-layout"
|
||||||
import AboutPage from "@/page/about"
|
|
||||||
import ContactPage from "@/page/contact"
|
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.
|
* Main application router configuration using React Router v6.
|
||||||
@@ -13,20 +20,20 @@ const router = createBrowserRouter(
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
path: "/",
|
path: "/",
|
||||||
element: <App />,
|
element: <HeroLayout />,
|
||||||
errorElement: <ErrorPage />,
|
errorElement: <ErrorPage />,
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
index: true,
|
index: true,
|
||||||
element: <HomePage />,
|
lazy: lazy(() => import("@/page/home")),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "about",
|
path: "about",
|
||||||
element: <AboutPage />,
|
lazy: lazy(() => import("@/page/about")),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "contact",
|
path: "contact",
|
||||||
element: <ContactPage />,
|
lazy: lazy(() => import("@/page/contact")),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|||||||
+39
-14
@@ -1,22 +1,47 @@
|
|||||||
import { configureStore } from "@reduxjs/toolkit"
|
import { configureStore, combineReducers } from "@reduxjs/toolkit"
|
||||||
import { useDispatch, useSelector } from "react-redux"
|
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"
|
||||||
|
|
||||||
/**
|
const storage = createWebStorage(import.meta.env.VITE_REDUX_STORAGE ?? "local")
|
||||||
* The Redux store instance for the application.
|
|
||||||
*
|
const persistConfig = {
|
||||||
* This store is configured using [`configureStore`](https://redux-toolkit.js.org/api/configureStore)
|
key: "root",
|
||||||
* from <code>@reduxjs/toolkit</code>. It combines various slice reducers into
|
storage,
|
||||||
* a single root redux.
|
whitelist: ["auth"],
|
||||||
*/
|
// blacklist: ['department'],
|
||||||
const store = configureStore({
|
}
|
||||||
reducer: {
|
|
||||||
auth: authReducer,
|
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 default store
|
||||||
export type RootState = ReturnType<typeof store.getState>
|
export type RootState = ReturnType<typeof rootReducer>
|
||||||
export type AppDispatch = typeof store.dispatch
|
export type AppDispatch = typeof store.dispatch
|
||||||
export type AppStore = typeof store
|
export type AppStore = typeof store
|
||||||
|
|
||||||
|
|||||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/// <reference types="vite/client" />
|
/// <reference types="vite/client" />
|
||||||
interface ImportMetaEnv {
|
interface ImportMetaEnv {
|
||||||
// todo add env properties here
|
readonly VITE_REDUX_STORAGE: "local" | "session"
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ImportMeta {
|
interface ImportMeta {
|
||||||
|
|||||||
Reference in New Issue
Block a user