Compare commits
26 Commits
1.2.2
..
b91855095b
| Author | SHA1 | Date | |
|---|---|---|---|
|
b91855095b
|
|||
|
1f30f70f21
|
|||
|
13242deb6c
|
|||
|
3b5153f386
|
|||
|
5502643466
|
|||
|
5790750124
|
|||
|
26bca96575
|
|||
| 381ccae5fd | |||
|
752e64f259
|
|||
|
84a2a2ffea
|
|||
| fd2352b6ad | |||
| 0efcf75221 | |||
| 0479744ce5 | |||
| af58edbafd | |||
| 1a16199f2f | |||
|
9b2d527576
|
|||
|
d663cc5d20
|
|||
|
5d84cf0589
|
|||
|
84fa103555
|
|||
|
ff967da485
|
|||
| 6271b22708 | |||
|
6e18d2efa9
|
|||
|
5803d057fd
|
|||
| 22da81a102 | |||
| a8959c28ec | |||
| e4acb7fd6f |
@@ -0,0 +1,21 @@
|
||||
# ENVIRONMENT CONFIGURATION TEMPLATE
|
||||
#
|
||||
# This file serves as a template for environment variables.
|
||||
# DO NOT include any sensitive data (passwords, API keys, etc.) in this file.
|
||||
#
|
||||
# INSTRUCTIONS
|
||||
# 1. Copy this file to `.env`, `.env.development`, or `.env.production` depending on your
|
||||
# target environment.
|
||||
# 2. Replace the placeholder values with your actual configuration.
|
||||
# 3. Alternatively, ensure these variables are defined within your system's environment
|
||||
# settings before running the application.
|
||||
|
||||
# The base URL fot the backend API service.
|
||||
# Ensure this matches your Spring Boot server address (e.g., http://localhost:8080).
|
||||
VITE_API_BASE_URL=/api
|
||||
|
||||
# Determines where Redux state is persisted on the client side.
|
||||
# Available options:
|
||||
# - `local`: Persists data in LocalStorage (remains after closing the browser).
|
||||
# - `session`: Persists data in SessionStorage (cleared when the tab is closed).
|
||||
VITE_REDUX_STORAGE=local
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
name: Upload Release Assets
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [created] # 仅当创建 Release 之后触发
|
||||
|
||||
jobs:
|
||||
build-and-upload:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
# 必须授予权限以允许 Action 修改 Release
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Create archive
|
||||
run: |
|
||||
TAG_NAME=${{ github.event.release.tag_name }}
|
||||
tar -czvf "website-dist-${TAG_NAME}.tar.gz" --exclude=".git*" --exclude=".github*" .
|
||||
|
||||
- name: Upload Release Asset
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
# 上传刚才生成的 tar.gz 文件
|
||||
files: dist-${{ github.event.release.tag_name }}.tar.gz
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -66,8 +66,6 @@ pnpm preview
|
||||
```text
|
||||
src/
|
||||
components/ Shared UI components
|
||||
data/ Modification code dataset
|
||||
init/ Application initialisation
|
||||
layout/ Route layouts
|
||||
page/ Route pages
|
||||
router/ Router configuration
|
||||
|
||||
Generated
+2798
File diff suppressed because it is too large
Load Diff
+10
-11
@@ -8,23 +8,21 @@
|
||||
"build": "tsc -b && vite build",
|
||||
"build:tar": "pnpm build && tar -czf dist.tar.gz dist",
|
||||
"lint": "eslint .",
|
||||
"preview": "vite preview",
|
||||
"deploy": "pnpm build && gh-pages -d dist",
|
||||
"predeploy": "pnpm build"
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ant-design/cssinjs": "^2.1.2",
|
||||
"@reduxjs/toolkit": "^2.11.2",
|
||||
"@tailwindcss/vite": "^4.2.4",
|
||||
"@tanstack/react-virtual": "^3.13.24",
|
||||
"antd": "^6.3.6",
|
||||
"axios": "^1.15.2",
|
||||
"antd": "^6.3.7",
|
||||
"axios": "^1.16.0",
|
||||
"dayjs": "^1.11.20",
|
||||
"react": "^19.2.5",
|
||||
"react-dom": "^19.2.5",
|
||||
"react": "^19.2.6",
|
||||
"react-dom": "^19.2.6",
|
||||
"react-redux": "^9.2.0",
|
||||
"react-router": "^7.14.2",
|
||||
"react-router-dom": "^7.14.2",
|
||||
"react-router": "^7.15.0",
|
||||
"react-router-dom": "^7.15.0",
|
||||
"redux-persist": "^6.0.0",
|
||||
"tailwindcss": "^4.2.4"
|
||||
},
|
||||
@@ -33,10 +31,11 @@
|
||||
"@types/react": "^19.2.14",
|
||||
"@types/react-dom": "^19.2.3",
|
||||
"@vitejs/plugin-react": "^6.0.1",
|
||||
"globals": "^17.5.0",
|
||||
"globals": "^17.6.0",
|
||||
"prettier": "^3.8.3",
|
||||
"typescript": "~6.0.3",
|
||||
"vite": "^8.0.10"
|
||||
"vite": "^8.0.11",
|
||||
"vite-plugin-port-checker": "^1.0.1"
|
||||
},
|
||||
"pnpm": {
|
||||
"ignoredBuiltDependencies": [
|
||||
|
||||
Generated
+454
-698
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,2 @@
|
||||
allowBuilds:
|
||||
esbuild: false
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 275 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 320 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 238 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.2 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 19 KiB |
+7
-11
@@ -1,23 +1,19 @@
|
||||
[
|
||||
"枪口",
|
||||
"左导轨",
|
||||
"右导轨",
|
||||
"枪管",
|
||||
"左贴片",
|
||||
"右贴片",
|
||||
"上导轨",
|
||||
"上贴片",
|
||||
"下导轨",
|
||||
"贴片",
|
||||
"瞄准镜",
|
||||
"战术设备",
|
||||
"增高座瞄具",
|
||||
"侧瞄具",
|
||||
"枪托",
|
||||
"托腮板",
|
||||
"枪托套件",
|
||||
"后握把",
|
||||
"前握把",
|
||||
"导轨脚架",
|
||||
"弹匣座",
|
||||
"前握把",
|
||||
"后握把",
|
||||
"后握贴片",
|
||||
"握把座",
|
||||
"弹匣",
|
||||
"托腮板"
|
||||
"弹匣座"
|
||||
]
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
# 《三角洲行动游戏指南》最终用户许可协议
|
||||
|
||||
> 最近更新日期: 2026年5月6日
|
||||
|
||||
感谢您访问《三角洲行动游戏指南》(以下简称“本站”)。在访问或使用本站前,请您务必仔细阅读本协议。
|
||||
|
||||
## 第一条:项目性质与声明
|
||||
|
||||
本站是由《三角洲行动》游戏玩家开发的兴趣爱好项目,与游戏官方(包括但不限于腾讯、琳恩工作室等)不存在任何形式的关联、授权或代理关系。
|
||||
|
||||
本站仅旨在为玩家提供游戏资讯、攻略及技术性指南,不保证资讯的绝对实时性与准确性。
|
||||
|
||||
## 第二条:内容版权说明
|
||||
|
||||
本站部分指南、攻略及图片素材提取、整理自哔哩哔哩、抖音等视频平台的公开视频,本站均会标注原作者信息或来源。相关内容的知识产权归原作者所有。
|
||||
|
||||
由本站开发者原创或邀请的高手提供的特约稿件,其版权归本站或原提供者所有。
|
||||
|
||||
严禁任何个人或组织在未经本站或原作者授权的情况下,将本站内容用于商业牟利。
|
||||
|
||||
## 第三条:免责声明
|
||||
|
||||
游戏机制可能随版本更新而变动,因参考本站指南而产生的任何游戏结果(如战绩波动、游戏内损失等),本站概不负责。
|
||||
|
||||
来源标注中可能包含指向第三方平台的链接,本站不对第三方平台内容的合法性或安全性负责。
|
||||
|
||||
## 第四条:协议变更
|
||||
|
||||
本站保留随时修改本协议的权利。重大变更将通过站点公告形式发布。
|
||||
@@ -0,0 +1,33 @@
|
||||
# 《三角洲行动游戏指南》隐私政策
|
||||
|
||||
本隐私政策旨在向您说明在无需登录的情况下,本站如何处理与您相关的信息。
|
||||
|
||||
## 第一条:信息收集情况
|
||||
|
||||
1. **个人信息:** 由于本站采用无需登录的模式,我们不会收集您的姓名、手机号、身份证号或精确地理位置等个人敏感数据。
|
||||
|
||||
2. **服务器日志:** 本站未集成任何第三方流量统计工具(如 Google Analytics 或百度统计),不会主动记录您的 IP 地址或用户代理(User-agent)数据。
|
||||
|
||||
## 第二条:Cookie 的使用
|
||||
|
||||
1. **必要性 Cookie:** 本站仅使用必要的 Cookie 用于保存与后端交互所需的功能性数据(如临时会话标识或您的本地设置偏好)。
|
||||
|
||||
2. **非追踪性:** 这些 Cookie 不用于追踪您的个人跨站行为,也不会用于构建您的个人画像。
|
||||
|
||||
## 第三条:第三方广告与赞助
|
||||
|
||||
1. **现状说明:** 本站目前不包含任何商业广告,亦未开通打赏或赞助入口。
|
||||
|
||||
2. **未来规划:** 考虑到运营成本,本站保留未来接入广告服务或赞助链接的权利。届时,广告商可能会根据其自身的隐私政策使用 Cookie。一旦此类功能上线,我们将同步更新本政策。
|
||||
|
||||
## 第四条:数据安全
|
||||
|
||||
我们致力于保护站点的运行安全,防止现有数据被非法篡改或泄露。
|
||||
|
||||
## 第五条:联系我们
|
||||
|
||||
若您对本协议或内容版权有任何疑问,请通过以下方式联系:
|
||||
|
||||
开发者: Zihlu Wang、Xingyao Fan
|
||||
|
||||
联系渠道: [GitHub](https://github.com/zihluwang/delta-force-guide-web)
|
||||
@@ -33,4 +33,33 @@ html, body {
|
||||
.mod-codes-grid {
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
|
||||
.nav-item {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.nav-item::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 0;
|
||||
background: linear-gradient(to top, #22ffa7, transparent);
|
||||
transition: height 0.2s ease-in-out;
|
||||
opacity: 0.35;
|
||||
pointer-events: none;
|
||||
|
||||
}
|
||||
|
||||
.nav-item:hover::after,
|
||||
.nav-item.active::after {
|
||||
height: 80%; /* 向上打光的高度,可以调整 */
|
||||
}
|
||||
|
||||
.nav-item:hover,
|
||||
.nav-item.active {
|
||||
color: white;
|
||||
}
|
||||
@@ -1,10 +1,11 @@
|
||||
import { Outlet, Link } from "react-router-dom"
|
||||
import { Outlet, Link, NavLink } from "react-router-dom"
|
||||
import { useMemo } from "react"
|
||||
import dayjs from "dayjs"
|
||||
import { Dropdown } from "antd"
|
||||
import { AuthApi } from "@/api"
|
||||
import { useAppDispatch, useAppSelector } from "@/store"
|
||||
import { useAppDispatch, useAppSelector } from "@/store/hooks"
|
||||
import { clearCurrentUser } from "@/store/auth-slice"
|
||||
import { useState } from 'react';
|
||||
|
||||
/**
|
||||
* Main application component that serves as the root layout.
|
||||
@@ -14,6 +15,7 @@ export default function HeroLayout() {
|
||||
const today = useMemo(() => dayjs(), [])
|
||||
const user = useAppSelector((state) => state.auth.user)
|
||||
const dispatch = useAppDispatch()
|
||||
const [isDropdownOpen, setIsDropdownOpen] = useState(false);
|
||||
|
||||
async function handleLogout() {
|
||||
try {
|
||||
@@ -24,30 +26,34 @@ export default function HeroLayout() {
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="bg-gray-50">
|
||||
<div className="bg-gray-50 ">
|
||||
{/* Navigation Header */}
|
||||
<header className="bg-white shadow-sm border-b">
|
||||
<div className="max-w-screen-2xl mx-auto px-4 sm:px-6 lg:px-10">
|
||||
<div className="flex justify-between items-center h-16">
|
||||
<header className="bg-white shadow-sm border-b bg-[url('/nav_bg.png')] bg-cover bg-center">
|
||||
<div className="max-w-screen-2xl mx-auto px-4 sm:px-6 lg:px-10 h-full">
|
||||
<div className="flex justify-between items-center h-20">
|
||||
<div className="flex items-center">
|
||||
<h1 className="text-xl font-semibold text-gray-900">
|
||||
三角洲行动改枪码库
|
||||
</h1>
|
||||
<h1 className="text-xl font-semibold text-white">《三角洲》指南</h1>
|
||||
</div>
|
||||
<nav className="flex space-x-8">
|
||||
<Link
|
||||
<nav className="flex h-full">
|
||||
<NavLink
|
||||
to="/firearms"
|
||||
className="text-gray-500 hover:text-gray-900 px-3 py-2 rounded-md text-sm font-medium"
|
||||
className={({ isActive }) =>
|
||||
`nav-item inline-flex items-center px-10 h-full text-base font-medium transition-all duration-200 ${isActive ? 'active' : ''
|
||||
} text-gray-500 hover:text-white`
|
||||
}
|
||||
>
|
||||
武器列表
|
||||
</Link>
|
||||
<Link
|
||||
</NavLink>
|
||||
<NavLink
|
||||
to="/mod-codes"
|
||||
className="text-gray-500 hover:text-gray-900 px-3 py-2 rounded-md text-sm font-medium"
|
||||
className={({ isActive }) =>
|
||||
`nav-item inline-flex items-center px-10 h-full text-base font-medium transition-all duration-200 ${isActive ? 'active' : ''
|
||||
} text-gray-500 hover:text-white`
|
||||
}
|
||||
>
|
||||
改枪码
|
||||
</Link>
|
||||
{user ? (
|
||||
</NavLink>
|
||||
{/* {user ? (
|
||||
<Dropdown
|
||||
trigger={["hover"]}
|
||||
menu={{
|
||||
@@ -61,14 +67,14 @@ export default function HeroLayout() {
|
||||
],
|
||||
}}
|
||||
>
|
||||
<span className="cursor-pointer text-gray-700 px-3 py-2 rounded-md text-sm font-medium">
|
||||
<span className="nav-item inline-flex items-center px-10 h-full text-base font-medium text-gray-500 hover:text-white cursor-pointer">
|
||||
{user.username}
|
||||
</span>
|
||||
</Dropdown>
|
||||
) : (
|
||||
<Link
|
||||
to="/login"
|
||||
className="text-gray-500 hover:text-gray-900 px-3 py-2 rounded-md text-sm font-medium"
|
||||
className="nav-item inline-flex items-center px-10 h-full text-base font-medium transition-all duration-200 text-gray-500 hover:text-white"
|
||||
>
|
||||
登录
|
||||
</Link>
|
||||
@@ -77,10 +83,10 @@ export default function HeroLayout() {
|
||||
href="https://github.com/zihluwang/delta-force-firearm-modification-codes"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="text-gray-500 hover:text-gray-900 px-3 py-2 rounded-md text-sm font-medium"
|
||||
className="nav-item inline-flex items-center px-10 h-full text-lg font-medium transition-all duration-200 text-gray-500 hover:text-white"
|
||||
>
|
||||
GitHub
|
||||
</a>
|
||||
</a> */}
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
@@ -94,13 +100,114 @@ export default function HeroLayout() {
|
||||
</main>
|
||||
|
||||
{/* Footer */}
|
||||
<footer className="bg-white border-t">
|
||||
<div className="max-w-screen-2xl mx-auto py-4 px-4 sm:px-6 lg:px-10">
|
||||
<p className="text-center text-sm text-gray-500">
|
||||
© 2024-{today.year()} Zihlu Wang 和 OnixByte。使用 React 与 TypeScript 构建。
|
||||
</p>
|
||||
<footer className="bg-black border-t border-gray-800">
|
||||
<div className="max-w-screen-2xl mx-auto px-4 sm:px-6 lg:px-10 py-8">
|
||||
|
||||
|
||||
|
||||
<div className="flex flex-wrap justify-center items-center gap-x-6 gap-y-10 text-sm">
|
||||
|
||||
<div
|
||||
className="relative"
|
||||
onMouseEnter={() => setIsDropdownOpen(true)}
|
||||
onMouseLeave={() => setIsDropdownOpen(false)}
|
||||
>
|
||||
<button
|
||||
className="flex items-center gap-1.5 text-gray-400 hover:text-white transition-colors duration-200 focus:outline-none"
|
||||
aria-label="GitHub 仓库"
|
||||
>
|
||||
<img
|
||||
src="/github-logo.png"
|
||||
alt=""
|
||||
className="w-5 h-5 opacity-80"
|
||||
/>
|
||||
<span>GitHub</span>
|
||||
<svg
|
||||
className={`w-3 h-3 transition-transform duration-200 ${isDropdownOpen ? 'rotate-180' : ''}`}
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M19 9l-7 7-7-7" />
|
||||
</svg>
|
||||
</button>
|
||||
{isDropdownOpen && (
|
||||
<div className="absolute top-full left-2/3 -translate-x-1/2 w-18 bg-gray-950 border border-gray-700 rounded-lg shadow-xl py-1 z-20 opacity-60">
|
||||
<a
|
||||
href="https://github.com/zihluwang/frontend-repo"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="block px-4 py-2 text-sm text-gray-300 hover:bg-gray-800 hover:text-white transition-colors"
|
||||
>
|
||||
前端
|
||||
</a>
|
||||
<a
|
||||
href="https://github.com/zihluwang/backend-repo"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="block px-4 py-2 text-sm text-gray-300 hover:bg-gray-800 hover:text-white transition-colors"
|
||||
>
|
||||
后端
|
||||
</a>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<span className="text-gray-700 select-none">•</span>
|
||||
<Link
|
||||
to="/"
|
||||
className="flex items-center gap-1.5 text-gray-400 hover:text-white transition-colors duration-200"
|
||||
>
|
||||
<img src="/footer-1.png" alt="" className="w-8 w-8 opacity-80" />
|
||||
EULA
|
||||
</Link>
|
||||
<span className="text-gray-700 select-none">•</span>
|
||||
<Link
|
||||
to="/"
|
||||
className="flex items-center gap-1.5 text-gray-400 hover:text-white transition-colors duration-200"
|
||||
>
|
||||
<img src="/footer-2.png" alt="" className="w-8 w-8 opacity-80" />
|
||||
隐私政策
|
||||
</Link>
|
||||
<span className="text-gray-700 select-none">•</span>
|
||||
{user ? (
|
||||
<Dropdown
|
||||
trigger={["hover"]}
|
||||
menu={{
|
||||
items: [
|
||||
{
|
||||
key: "logout",
|
||||
label: "退出登录",
|
||||
danger: true,
|
||||
onClick: handleLogout,
|
||||
},
|
||||
],
|
||||
}}
|
||||
>
|
||||
<span className="nav-item inline-flex items-center px-10 h-full text-base font-medium text-gray-500 hover:text-white cursor-pointer">
|
||||
{user.username}
|
||||
</span>
|
||||
</Dropdown>
|
||||
) : (
|
||||
<Link
|
||||
to="/login"
|
||||
className="flex items-center gap-1.5 text-gray-400 hover:text-white transition-colors duration-200"
|
||||
>
|
||||
<img src="../../public/footer-3.png" alt="" className="w-8 w-8 opacity-80" />
|
||||
登录
|
||||
</Link>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="border-t border-gray-800 my-6" />
|
||||
<div className="text-center text-xs text-gray-500">
|
||||
<p>
|
||||
© 2024-{today.year()} Zihlu Wang 和 OnixByte。使用 React 与 TypeScript 构建。
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Link } from "react-router-dom"
|
||||
import { FirearmApi } from "@/api"
|
||||
import FirearmCreateModal from "@/components/firearm-create-modal"
|
||||
import FirearmEditModal from "@/components/firearm-edit-modal"
|
||||
import { useAppSelector } from "@/store"
|
||||
import { useAppSelector } from "@/store/hooks"
|
||||
import { Firearm, FirearmType } from "@/types"
|
||||
import { Button, Card, Col, Pagination, Popconfirm, Row, Select, Tag, Typography, App } from "antd"
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import { useState } from "react"
|
||||
import { useNavigate } from "react-router-dom"
|
||||
import { App, Button, Card, Form, Input, Typography } from "antd"
|
||||
import { AuthApi } from "@/api"
|
||||
import { useAppDispatch } from "@/store"
|
||||
import { useAppDispatch } from "@/store/hooks"
|
||||
import { setCurrentUser } from "@/store/auth-slice"
|
||||
import { LoginRequest } from "@/types"
|
||||
|
||||
|
||||
@@ -16,10 +16,10 @@ import { Link, useSearchParams } from "react-router-dom"
|
||||
import { ModificationApi, TagApi } from "@/api"
|
||||
import ModificationCreateModal from "@/components/modification-create-modal"
|
||||
import ModificationEditModal from "@/components/modification-edit-modal"
|
||||
import { useAppSelector } from "@/store"
|
||||
import { useAppSelector } from "@/store/hooks"
|
||||
import { Modification } from "@/types"
|
||||
|
||||
const pageSize = 12
|
||||
const pageSize = 10
|
||||
|
||||
export default function ModCodesPage() {
|
||||
const user = useAppSelector((state) => state.auth.user)
|
||||
@@ -56,7 +56,7 @@ export default function ModCodesPage() {
|
||||
page: page - 1,
|
||||
size: pageSize,
|
||||
sortBy: "id",
|
||||
direction: "ASC",
|
||||
direction: "DESC",
|
||||
firearmId,
|
||||
tags: selectedTags,
|
||||
}).then((pagedData) => {
|
||||
|
||||
@@ -13,6 +13,8 @@ function lazy<T extends { default: ComponentType<unknown> }>(importer: () => Pro
|
||||
}
|
||||
}
|
||||
|
||||
const hydrateFallbackElement = <div className="px-4 py-6 text-gray-500">页面加载中...</div>
|
||||
|
||||
/**
|
||||
* Main application router configuration using React Router v6.
|
||||
* Defines all routes and their corresponding components.
|
||||
@@ -22,11 +24,13 @@ const router = createBrowserRouter(
|
||||
{
|
||||
path: "/",
|
||||
element: <HeroLayout />,
|
||||
hydrateFallbackElement,
|
||||
errorElement: <ErrorPage />,
|
||||
children: [
|
||||
{
|
||||
index: true,
|
||||
lazy: lazy(() => import("@/page/firearms")),
|
||||
|
||||
},
|
||||
{
|
||||
path: "firearms",
|
||||
@@ -40,6 +44,7 @@ const router = createBrowserRouter(
|
||||
},
|
||||
{
|
||||
element: <EmptyLayout />,
|
||||
hydrateFallbackElement,
|
||||
errorElement: <ErrorPage />,
|
||||
children: [
|
||||
{
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
import { useDispatch, useSelector } from "react-redux"
|
||||
import type { AppDispatch, RootState } from "./index"
|
||||
|
||||
export const useAppDispatch = useDispatch.withTypes<AppDispatch>()
|
||||
export const useAppSelector = useSelector.withTypes<RootState>()
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { configureStore, combineReducers } from "@reduxjs/toolkit"
|
||||
import { useDispatch, useSelector } from "react-redux"
|
||||
import {
|
||||
persistStore,
|
||||
persistReducer,
|
||||
@@ -46,5 +45,3 @@ export type RootState = ReturnType<typeof rootReducer>
|
||||
export type AppDispatch = typeof store.dispatch
|
||||
export type AppStore = typeof store
|
||||
|
||||
export const useAppDispatch = useDispatch.withTypes<AppDispatch>()
|
||||
export const useAppSelector = useSelector.withTypes<RootState>()
|
||||
|
||||
Vendored
+8
@@ -1,6 +1,14 @@
|
||||
/// <reference types="vite/client" />
|
||||
interface ImportMetaEnv {
|
||||
/**
|
||||
* Redux persistent storage location, use `local` for local storage and `session` for
|
||||
* session storage
|
||||
*/
|
||||
readonly VITE_REDUX_STORAGE: "local" | "session"
|
||||
|
||||
/**
|
||||
* Backend API Base URL
|
||||
*/
|
||||
readonly VITE_API_BASE_URL: string
|
||||
}
|
||||
|
||||
|
||||
+37
-10
@@ -2,23 +2,50 @@ import { fileURLToPath, URL } from "node:url"
|
||||
import { defineConfig } from "vite"
|
||||
import react from "@vitejs/plugin-react"
|
||||
import tailwindcss from "@tailwindcss/vite"
|
||||
import portChecker from "vite-plugin-port-checker"
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [react(), tailwindcss()],
|
||||
plugins: [react(), tailwindcss(), portChecker()],
|
||||
base: "/",
|
||||
build: {
|
||||
rolldownOptions: {
|
||||
output: {
|
||||
manualChunks(id) {
|
||||
if (!id.includes("node_modules")) {
|
||||
return
|
||||
}
|
||||
|
||||
if (id.includes("react-router")) {
|
||||
return "router-vendor"
|
||||
}
|
||||
|
||||
if (id.includes("redux") || id.includes("immer")) {
|
||||
return "redux-vendor"
|
||||
}
|
||||
|
||||
if (id.includes("/node_modules/@ant-design/")) {
|
||||
return "ant-design-vendor"
|
||||
}
|
||||
|
||||
if (id.includes("/node_modules/rc-")) {
|
||||
return "antd-rc-vendor"
|
||||
}
|
||||
|
||||
if (
|
||||
id.includes("/node_modules/react/") ||
|
||||
id.includes("/node_modules/react-dom/") ||
|
||||
id.includes("/node_modules/scheduler/")
|
||||
) {
|
||||
return "react-vendor"
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
"@": fileURLToPath(new URL("./src", import.meta.url)),
|
||||
},
|
||||
},
|
||||
server: {
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: 'http://localhost:8080',
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/api/, '')
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user