diff --git a/package.json b/package.json index 5bfadff..39aaade 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/preload/index.ts b/src/preload/index.ts index ca64a29..b420d3f 100644 --- a/src/preload/index.ts +++ b/src/preload/index.ts @@ -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), diff --git a/src/renderer/src/App.tsx b/src/renderer/src/App.tsx index 788a019..ba27e7d 100644 --- a/src/renderer/src/App.tsx +++ b/src/renderer/src/App.tsx @@ -17,7 +17,7 @@ function MainContent(): React.JSX.Element { // 统一路径格式进行比对,防止 / 和 /home 导致重复跳转 const currentPath = location.pathname === '/' ? '/home' : location.pathname const targetPath = route === '/' ? '/home' : route - + if (currentPath !== targetPath) { navigate(route) } diff --git a/src/renderer/src/components/ContentArea.tsx b/src/renderer/src/components/ContentArea.tsx index a811a6d..9108a5e 100644 --- a/src/renderer/src/components/ContentArea.tsx +++ b/src/renderer/src/components/ContentArea.tsx @@ -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 diff --git a/src/renderer/src/components/Home.tsx b/src/renderer/src/components/Home.tsx index d274829..25311f6 100644 --- a/src/renderer/src/components/Home.tsx +++ b/src/renderer/src/components/Home.tsx @@ -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 = {} 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 && (
= ({ canEdit }) => {
(groupRefs.current[group.key] = el)} + ref={(el) => { + groupRefs.current[group.key] = el + }} > {group.key !== 'all' && (
= ({ canEdit }) => { fontWeight: 'bold', color: 'var(--ss-text-main)', marginBottom: '16px', - paddingLeft: '4px', display: 'flex', alignItems: 'center', gap: '8px', @@ -889,4 +893,4 @@ export const Home: React.FC<{ canEdit: boolean }> = ({ canEdit }) => {
) -} \ No newline at end of file +} diff --git a/src/renderer/src/components/TitleBar.tsx b/src/renderer/src/components/TitleBar.tsx index a8322ef..2f87ff8 100644 --- a/src/renderer/src/components/TitleBar.tsx +++ b/src/renderer/src/components/TitleBar.tsx @@ -109,7 +109,11 @@ export function TitleBar({ children }: TitleBarProps): React.JSX.Element { onClick={maximize} style={{ width: '46px', height: '32px', borderRadius: 0 }} > - {isMaximized ? : } + {isMaximized ? ( + + ) : ( + + )}