mirror of
https://github.com/SECTL/SecScore.git
synced 2026-07-19 19:04:23 +08:00
feat: 添加 lint:fix 脚本并优化代码格式
refactor(components): 调整窗口控制图标大小和样式 style: 统一代码格式和缩进 fix(App): 修复路径比较逻辑的空格问题
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
"scripts": {
|
||||
"format": "prettier --write .",
|
||||
"lint": "eslint --cache .",
|
||||
"lint:fix": "eslint --cache . --fix",
|
||||
"typecheck:node": "tsc --noEmit -p tsconfig.node.json --composite false",
|
||||
"typecheck:web": "tsc --noEmit -p tsconfig.web.json --composite false",
|
||||
"typecheck": "pnpm -s typecheck:node && pnpm -s typecheck:web",
|
||||
|
||||
@@ -86,7 +86,8 @@ const api = {
|
||||
return () => ipcRenderer.removeListener('app:navigate', subscription)
|
||||
},
|
||||
toggleDevTools: () => ipcRenderer.invoke('window:toggle-devtools'),
|
||||
windowResize: (width: number, height: number) => ipcRenderer.invoke('window:resize', width, height),
|
||||
windowResize: (width: number, height: number) =>
|
||||
ipcRenderer.invoke('window:resize', width, height),
|
||||
|
||||
// Logger
|
||||
queryLogs: (lines?: number) => ipcRenderer.invoke('log:query', lines),
|
||||
|
||||
@@ -3,13 +3,19 @@ import { Layout, Space, Button, Tag, Loading } from 'tdesign-react'
|
||||
import { Routes, Route, Navigate } from 'react-router-dom'
|
||||
import { WindowControls } from './WindowControls'
|
||||
|
||||
const Home = lazy(() => import('./Home').then(m => ({ default: m.Home })))
|
||||
const StudentManager = lazy(() => import('./StudentManager').then(m => ({ default: m.StudentManager })))
|
||||
const Settings = lazy(() => import('./Settings').then(m => ({ default: m.Settings })))
|
||||
const ReasonManager = lazy(() => import('./ReasonManager').then(m => ({ default: m.ReasonManager })))
|
||||
const ScoreManager = lazy(() => import('./ScoreManager').then(m => ({ default: m.ScoreManager })))
|
||||
const Leaderboard = lazy(() => import('./Leaderboard').then(m => ({ default: m.Leaderboard })))
|
||||
const SettlementHistory = lazy(() => import('./SettlementHistory').then(m => ({ default: m.SettlementHistory })))
|
||||
const Home = lazy(() => import('./Home').then((m) => ({ default: m.Home })))
|
||||
const StudentManager = lazy(() =>
|
||||
import('./StudentManager').then((m) => ({ default: m.StudentManager }))
|
||||
)
|
||||
const Settings = lazy(() => import('./Settings').then((m) => ({ default: m.Settings })))
|
||||
const ReasonManager = lazy(() =>
|
||||
import('./ReasonManager').then((m) => ({ default: m.ReasonManager }))
|
||||
)
|
||||
const ScoreManager = lazy(() => import('./ScoreManager').then((m) => ({ default: m.ScoreManager })))
|
||||
const Leaderboard = lazy(() => import('./Leaderboard').then((m) => ({ default: m.Leaderboard })))
|
||||
const SettlementHistory = lazy(() =>
|
||||
import('./SettlementHistory').then((m) => ({ default: m.SettlementHistory }))
|
||||
)
|
||||
|
||||
const { Content } = Layout
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ export const Home: React.FC<{ canEdit: boolean }> = ({ canEdit }) => {
|
||||
])
|
||||
|
||||
if (stuRes.success) {
|
||||
const enrichedStudents = (stuRes.data as student[]).map(s => ({
|
||||
const enrichedStudents = (stuRes.data as student[]).map((s) => ({
|
||||
...s,
|
||||
pinyinName: pinyin(s.name, { toneType: 'none' }).toLowerCase(),
|
||||
pinyinFirst: getFirstLetter(s.name)
|
||||
@@ -120,7 +120,11 @@ export const Home: React.FC<{ canEdit: boolean }> = ({ canEdit }) => {
|
||||
if (pyLower.includes(q0)) return true
|
||||
|
||||
const q1 = q0.replace(/\s+/g, '')
|
||||
if (q1 && (nameLower.replace(/\s+/g, '').includes(q1) || pyLower.replace(/\s+/g, '').includes(q1))) return true
|
||||
if (
|
||||
q1 &&
|
||||
(nameLower.replace(/\s+/g, '').includes(q1) || pyLower.replace(/\s+/g, '').includes(q1))
|
||||
)
|
||||
return true
|
||||
|
||||
try {
|
||||
const m0 = match(s.name, q0)
|
||||
@@ -167,7 +171,7 @@ export const Home: React.FC<{ canEdit: boolean }> = ({ canEdit }) => {
|
||||
|
||||
const groups: Record<string, student[]> = {}
|
||||
sortedStudents.forEach((s) => {
|
||||
const key = sortType === 'alphabet' ? (s.pinyinFirst || '#') : getSurname(s.name)
|
||||
const key = sortType === 'alphabet' ? s.pinyinFirst || '#' : getSurname(s.name)
|
||||
if (!groups[key]) groups[key] = []
|
||||
groups[key].push(s)
|
||||
})
|
||||
@@ -312,7 +316,6 @@ export const Home: React.FC<{ canEdit: boolean }> = ({ canEdit }) => {
|
||||
border: '1px solid var(--ss-border-color)',
|
||||
overflow: 'visible'
|
||||
}}
|
||||
hover
|
||||
>
|
||||
{rankBadge && (
|
||||
<div
|
||||
@@ -382,7 +385,9 @@ export const Home: React.FC<{ canEdit: boolean }> = ({ canEdit }) => {
|
||||
<div
|
||||
key={group.key}
|
||||
style={{ marginBottom: '32px' }}
|
||||
ref={(el) => (groupRefs.current[group.key] = el)}
|
||||
ref={(el) => {
|
||||
groupRefs.current[group.key] = el
|
||||
}}
|
||||
>
|
||||
{group.key !== 'all' && (
|
||||
<div
|
||||
@@ -391,7 +396,6 @@ export const Home: React.FC<{ canEdit: boolean }> = ({ canEdit }) => {
|
||||
fontWeight: 'bold',
|
||||
color: 'var(--ss-text-main)',
|
||||
marginBottom: '16px',
|
||||
paddingLeft: '4px',
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
gap: '8px',
|
||||
|
||||
@@ -109,7 +109,11 @@ export function TitleBar({ children }: TitleBarProps): React.JSX.Element {
|
||||
onClick={maximize}
|
||||
style={{ width: '46px', height: '32px', borderRadius: 0 }}
|
||||
>
|
||||
{isMaximized ? <FullscreenExitIcon /> : <RectangleIcon />}
|
||||
{isMaximized ? (
|
||||
<FullscreenExitIcon style={{ transform: 'scale(0.5)' }} />
|
||||
) : (
|
||||
<RectangleIcon />
|
||||
)}
|
||||
</Button>
|
||||
<Button
|
||||
variant="text"
|
||||
|
||||
@@ -56,7 +56,11 @@ export function WindowControls(): React.JSX.Element {
|
||||
onClick={maximize}
|
||||
style={{ width: '46px', height: '32px', borderRadius: 0 }}
|
||||
>
|
||||
{isMaximized ? <FullscreenExitIcon /> : <RectangleIcon />}
|
||||
{isMaximized ? (
|
||||
<FullscreenExitIcon />
|
||||
) : (
|
||||
<RectangleIcon style={{ transform: 'scale(0.7)' }} />
|
||||
)}
|
||||
</Button>
|
||||
<Button
|
||||
variant="text"
|
||||
|
||||
Reference in New Issue
Block a user