feat: add browser workbench and managed local launchers

This commit is contained in:
Codex
2026-10-11 14:00:14 +08:00
parent 389b2aa3a5
commit 23f3a15a15
17 changed files with 627 additions and 0 deletions
File diff suppressed because one or more lines are too long
+9
View File
@@ -0,0 +1,9 @@
export async function api<T>(path: string, options: RequestInit = {}): Promise<T> {
const response = await fetch('/api' + path, { ...options, headers: options.body instanceof FormData ? options.headers : { 'Content-Type': 'application/json', ...options.headers } });
if (!response.ok) {
const body = await response.json().catch(() => ({ detail: `请求失败 (${response.status})` }));
throw new Error(typeof body.detail === 'string' ? body.detail : `参数无效 (${response.status})`);
}
return response.json();
}
export const post = <T,>(path: string, body: unknown = {}) => api<T>(path, { method: 'POST', body: JSON.stringify(body) });
+17
View File
@@ -0,0 +1,17 @@
import { describe, expect, it } from 'vitest';
import { display, scopeName, scoreSeries, queryString } from './format';
describe('unknown values and comparable history', () => {
it('preserves zero and marks unknown', () => {
expect(display(0)).toBe('0');
expect(display(null)).toBe('未提供');
expect(scopeName('category')).toBe('门类参考线');
});
it('keeps different score scopes separate and omits unknown totals', () => {
const result = scoreSeries([{ year: 2024, total: 310, scope: 'major' }, { year: 2025, total: 300, scope: 'category' }, { year: 2026, total: null, scope: 'major' }]);
expect(result).toHaveLength(2);
expect(result.flatMap(r => r.points)).toHaveLength(2);
});
it('encodes filters and omits empty values', () => {
expect(queryString({ keyword: '北京 大学', year: '', favorites: false })).toBe('keyword=%E5%8C%97%E4%BA%AC+%E5%A4%A7%E5%AD%A6');
});
});
+16
View File
@@ -0,0 +1,16 @@
import type { Score, Filters } from './types';
export const display = (value: unknown): string => value === null || value === undefined || value === '' ? '未提供' : String(value);
export const scopeName = (scope?: string | null) => ({ major: '专业线', discipline: '学科参考线', category: '门类参考线', unknown: '口径待核实' }[scope || ''] || '未提供');
export const modeName = (mode: string) => ({ direct: '直接连接', prefer_proxy: '优先代理', proxy_only: '严格代理', catalog: '全国招生目录', scores: '历年考情', combined: '目录 + 历年考情' }[mode] || mode);
export const statusName = (status: string) => ({ queued: '等待开始', running: '采集中', paused: '已暂停', waiting_login: '等待登录', waiting_proxy: '等待代理', completed: '已完成', partial: '部分失败', failed: '采集失败', cancelled: '已取消' }[status] || status);
export const queryString = (filters: Filters) => new URLSearchParams(Object.entries(filters).filter(([, v]) => v !== '' && v !== false).map(([k, v]) => [k, String(v)])).toString();
export function scoreSeries(scores: Score[]) {
const grouped = new Map<string, { label: string; points: { year: number; total: number }[] }>();
scores.filter(s => s.total !== null).forEach(s => {
const key = [s.scope, s.raw_code || '', s.department_name || '', s.source || '', s.note || ''].join('|');
const group = grouped.get(key) || { label: scopeName(s.scope) + (s.note ? ` · ${s.note}` : ''), points: [] };
group.points.push({ year: s.year, total: s.total! });
grouped.set(key, group);
});
return [...grouped.values()].map(g => ({ ...g, points: g.points.sort((a, b) => a.year - b.year) }));
}
+5
View File
@@ -0,0 +1,5 @@
import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
import App from './App';
import './style.css';
createRoot(document.getElementById('root')!).render(<StrictMode><App /></StrictMode>);
+243
View File
@@ -0,0 +1,243 @@
:root { font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif; color: #233a49; background: #f4f7f8; font-synthesis: none; font-size: 14px; --ink: #173142; --muted: #71828b; --teal: #17816f; --line: #e5ebee; }
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 37px; padding: 8px 13px; border: 1px solid #dce4e7; border-radius: 7px; background: white; color: #354d5b; transition: background .15s, border-color .15s; }
button:hover { background: #f3f8f7; border-color: #aec6c0; }
button:disabled, select:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--teal); border-color: var(--teal); color: white; font-weight: 600; }
button.primary:hover { background: #106c5d; }
button.text-button { background: transparent; border: 0; color: var(--teal); padding: 5px 0; min-height: 28px; }
button.icon-button { padding: 7px; border: 0; background: transparent; min-height: 30px; }
button.selected-button { color: #9a7121; border-color: #dfc68b; background: #fffbef; }
input, select, textarea { border: 1px solid #dce4e7; border-radius: 6px; padding: 9px 11px; background: white; color: #2c4352; min-width: 0; }
input::placeholder, textarea::placeholder { color: #99a6ad; }
input[type=checkbox] { accent-color: var(--teal); width: 15px; height: 15px; padding: 0; cursor: pointer; }
input[type=file] { padding: 13px; background: #f7fafb; }
textarea { resize: vertical; line-height: 1.6; }
:focus-visible { outline: 2px solid #188d7c; outline-offset: 3px; }
a { color: var(--teal); text-decoration: none; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: 28px; font-weight: 650; letter-spacing: -.7px; margin-bottom: 10px; color: var(--ink); line-height: 1.35; }
h2 { font-size: 17px; font-weight: 650; color: var(--ink); margin-bottom: 17px; }
h3 { font-size: 15px; }
p { color: var(--muted); line-height: 1.8; }
small { font-size: 12px; color: var(--muted); }
.muted { color: var(--muted); }
.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: 224px; flex-shrink: 0; background: #132b3a; color: #bacbd2; padding: 31px 19px 24px; position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; z-index: 5; }
.brand { display: flex; align-items: center; gap: 12px; color: white; padding: 0 9px; }
.brand-symbol { width: 43px; height: 45px; border: 1px solid #46616a; border-radius: 11px; display: flex; align-items: center; justify-content: center; color: #71c1af; }
.brand b { display: block; font-size: 27px; line-height: 1.15; letter-spacing: 1px; }
.brand-dot { color: #69bca8; }
.brand small { display: block; margin-top: 7px; color: #a4bac3; font-size: 11px; letter-spacing: .8px; }
.nav-label { font-size: 9px; letter-spacing: 1.3px; color: #7e9aa8; margin: 44px 13px 17px; }
nav { display: flex; flex-direction: column; gap: 7px; }
nav button { justify-content: flex-start; border: 0; min-height: 46px; padding-left: 14px; color: #b8cbd3; background: transparent; gap: 12px; }
nav button:hover { background: #1b3a4a; border: 0; }
nav button.active { background: #244a52; color: #f0fffa; }
.nav-active-dot { width: 5px; height: 5px; background: #72c6b3; border-radius: 50%; margin-left: auto; }
.sidebar-bottom { margin-top: auto; padding: 20px 13px 0; }
.local-indicator { display: flex; align-items: center; gap: 7px; font-size: 11px; color: #9bb4bf; }
.local-indicator > span { height: 6px; width: 6px; background: #62bb9d; border-radius: 50%; }
.sidebar-bottom p { font-size: 12px; color: #839fae; margin: 12px 0 24px; line-height: 1.9; }
.sidebar-version { border-top: 1px solid #2c4655; padding-top: 18px; font-size: 11px; color: #7f9ba8; display: flex; justify-content: space-between; }
.main-shell { margin-left: 224px; width: calc(100% - 224px); min-height: 100vh; display: flex; flex-direction: column; }
.topbar { height: 66px; padding: 0 35px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: white; }
.breadcrumb { display: flex; align-items: center; gap: 12px; color: #9ba8af; font-size: 12px; }
.breadcrumb span { color: #4a616f; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.local-tag { color: #638377; display: flex; align-items: center; gap: 6px; font-size: 11px; padding: 5px 9px; border-radius: 4px; background: #f0f7f3; }
main { padding: 33px 35px 28px; width: 100%; max-width: 1800px; margin: 0 auto; flex: 1; }
footer { display: flex; justify-content: space-between; padding: 20px 35px; font-size: 10px; color: #8b9ca5; }
.page-title { display: flex; align-items: center; justify-content: space-between; gap: 22px; margin-bottom: 28px; }
.page-title p { font-size: 12px; margin: 0; }
.eyebrow { font-size: 9px; font-weight: 600; color: #7a919d; letter-spacing: 1.8px; margin-bottom: 11px; }
.page-actions { display: flex; align-items: center; gap: 9px; flex-shrink: 0; }
.page-actions > select { font-size: 12px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 17px; margin-bottom: 24px; }
.stat { border: 1px solid var(--line); background: white; border-radius: 9px; padding: 19px 20px 20px; }
.stat-top { display: flex; justify-content: space-between; align-items: center; color: #718691; font-size: 12px; }
.stat-top > span { color: #799fa0; background: #f0f7f6; width: 33px; height: 33px; display: flex; align-items: center; justify-content: center; border-radius: 8px; }
.stat strong { display: block; font-size: 33px; color: #193342; font-weight: 650; letter-spacing: -.8px; margin: 7px 0 8px; font-variant-numeric: tabular-nums; }
.stat small { font-size: 10px; color: #84969f; }
.card { background: white; border: 1px solid var(--line); border-radius: 9px; padding: 23px; min-width: 0; }
.card-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; }
.card-title h2 { margin: 0; }
.badge { display: inline-block; border-radius: 4px; background: #f0f3f5; color: #6b7c87; font-size: 10px; padding: 4px 7px; line-height: 1.25; white-space: nowrap; }
.badge.green { background: #eaf5ef; color: #327d60; }
.badge.amber { background: #fff5df; color: #9d7735; }
.badge.red { background: #faeae8; color: #b46157; }
.dashboard-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 22px; margin-bottom: 24px; }
.welcome { background: linear-gradient(115deg, #fff, #f8fbfa); padding: 25px 27px; }
.section-kicker { color: var(--teal); font-size: 11px; margin-bottom: 14px; }
.welcome h2 { font-size: 21px; margin-bottom: 10px; }
.welcome > p { font-size: 12px; max-width: 430px; margin-bottom: 19px; }
.steps { display: flex; flex-direction: column; }
.steps > div { display: flex; gap: 15px; align-items: center; padding: 14px 0; border-top: 1px solid #e5eeeb; }
.steps > div > span { font-size: 19px; color: #aac7c0; font-weight: 350; }
.steps b { font-size: 12px; font-weight: 600; }
.steps small { display: block; font-size: 11px; margin-top: 5px; }
.steps button { border: 0; padding: 5px; background: transparent; margin-left: auto; color: #69988b; }
.source-row { display: flex; align-items: center; gap: 13px; padding: 20px 0; border-bottom: 1px solid #edf1f3; color: #34505e; }
.source-row b { font-size: 13px; }
.source-row small { display: block; margin-top: 7px; font-size: 10px; }
.source-row > svg { margin-left: auto; color: #8096a1; }
.source-icon { width: 42px; height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 9px; background: #eff5fa; color: #4b80a4; }
.source-1 { background: #f3f3e9; color: #9a9864; }
.source-note { display: flex; gap: 10px; color: #77908b; margin: 23px 0 12px; padding: 14px; background: #f5f8f7; border-radius: 6px; align-items: flex-start; }
.source-note > svg { flex-shrink: 0; margin-top: 3px; }
.source-note p { font-size: 11px; line-height: 1.9; margin: 0; }
.sources .text-button { font-size: 11px; }
.recent { padding-bottom: 20px; }
.onboarding-empty { padding: 20px 5px; display: flex; gap: 17px; align-items: center; }
.onboarding-empty b { font-size: 13px; font-weight: 550; }
.onboarding-empty p { font-size: 11px; margin: 8px 0 0; }
.onboarding-empty button { margin-left: auto; color: #6a8692; font-size: 11px; }
.dashed-icon { border: 1px dashed #c9d7dc; border-radius: 9px; width: 49px; height: 49px; display: flex; align-items: center; justify-content: center; color: #98aeb9; flex-shrink: 0; }
.recent-list > div { display: flex; align-items: center; gap: 15px; padding: 13px 0; border-top: 1px solid var(--line); }
.recent-list small { display: block; margin-top: 5px; }
.recent-list b { font-size: 12px; }
.recent-list > div > div { flex: 1; }
.recent-list > div > span:last-child { font-size: 11px; color: var(--muted); }
.job-dot { width: 7px; height: 7px; background: #a4c7bb; border-radius: 50%; }
.filters { padding: 17px 18px; margin-bottom: 20px; }
.filter-main { display: flex; gap: 10px; align-items: center; }
.filter-main select, .filter-main button { font-size: 12px; height: 38px; }
.search-input { position: relative; flex: 1; min-width: 190px; }
.search-input input { width: 100%; padding-left: 35px; }
.search-input svg { position: absolute; top: 11px; left: 11px; color: #8d9ea7; }
.filter-more { padding-top: 19px; margin-top: 18px; border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
label { color: #6d828e; font-size: 12px; }
.filter-more > label, .form-stack label, .two-fields > label, .three-fields > label { display: flex; flex-direction: column; gap: 7px; }
.reset { justify-self: start; align-self: end; }
.data-card { padding: 0; overflow: hidden; }
.data-toolbar { padding: 19px 21px; display: flex; align-items: center; justify-content: space-between; gap: 16px; font-size: 12px; color: #8598a2; }
.data-toolbar > div { display: flex; align-items: center; gap: 5px; }
.data-toolbar b { color: #2d4c5b; }
.data-toolbar > label { display: flex; align-items: center; gap: 10px; }
.data-toolbar select { font-size: 11px; padding: 6px 9px; }
.table-scroll { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; text-align: left; }
th { background: #f7f9fa; font-weight: 500; color: #7a8d98; font-size: 11px; }
th, td { padding: 13px 15px; border-bottom: 1px solid #eaf0f2; vertical-align: top; line-height: 1.7; }
td small, th small { display: block; margin-top: 5px; font-size: 10px; }
td b { font-weight: 600; }
.catalog-table { min-width: 1020px; }
.catalog-table .narrow { width: 45px; padding-left: 15px; padding-right: 6px; }
.catalog-table td:nth-child(2) { min-width: 175px; }
.catalog-table td:nth-child(3) { max-width: 200px; min-width: 135px; }
.catalog-table td:nth-child(5) { min-width: 110px; max-width: 160px; }
.catalog-table tr:hover { background: #fbfdfc; }
.row-link { color: #234a5c; font-weight: 650; min-height: 24px; padding: 0; border: 0; background: transparent; font-size: 13px; }
.row-badges { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 9px; }
.subjects-cell { font-size: 10px; min-width: 200px; color: #5f7886; line-height: 1.85; }
.score-number { font-size: 18px; color: #287764; }
.verification-note { display: block; color: #a59674; font-size: 9px; margin-top: 5px; }
.favorite { color: #a8b6bd; }
.favorite.is-favorite { color: #c6a047; }
.pagination { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; color: #8597a0; font-size: 11px; }
.pagination > div { display: flex; gap: 6px; }
.pagination button { min-height: 28px; padding: 5px; }
.empty { padding: 64px 20px 75px; text-align: center; color: #99aeb8; }
.empty svg { color: #b4c6ce; }
.empty h3 { margin-top: 20px; color: #728d9a; font-weight: 550; }
.empty p { font-size: 12px; }
.empty button { margin-top: 10px; font-size: 12px; }
.loading-area { padding: 60px 20px; text-align: center; display: flex; gap: 10px; align-items: center; justify-content: center; color: #8299a6; }
.compare-bar { display: flex; align-items: center; gap: 18px; background: #183a49; color: #eaf4f3; padding: 14px 21px; border-radius: 9px; margin-top: 17px; box-shadow: 0 5px 18px #123b4920; }
.compare-bar > div { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.compare-bar b { font-size: 12px; white-space: nowrap; }
.compare-bar span { color: #9eb7c0; font-size: 10px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.compare-bar .text-button { color: #b4d2c9; }
.task-grid { display: grid; grid-template-columns: 335px minmax(0, 1fr); gap: 22px; align-items: start; }
.task-form { padding: 23px; }
.form-stack { display: flex; flex-direction: column; gap: 17px; }
.form-stack > p { margin-bottom: 0; font-size: 12px; }
.form-stack button.primary { margin-top: 3px; }
.two-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.three-fields { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.year-checks { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; margin-top: -5px; }
.year-checks > label, .form-stack .check-label { display: flex; align-items: center; flex-direction: row; gap: 7px; color: #58727f; }
.info-box { padding: 13px 15px; border-radius: 6px; background: #f1f7f6; color: #638179; font-size: 11px; line-height: 1.9; overflow-wrap: anywhere; }
.warning { background: #fff6e5; color: #9e7c42; margin-bottom: 20px; }
.form-hint { font-size: 10px !important; color: #8a9fa7; line-height: 1.8; }
.task-right { display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.job-list { max-height: 315px; overflow-y: auto; }
.job-row { width: 100%; border: 0; border-top: 1px solid var(--line); border-radius: 0; padding: 15px 11px; justify-content: space-between; text-align: left; background: transparent; }
.job-row.selected { background: #f0f7f5; border-radius: 5px; }
.job-row b { font-weight: 550; font-size: 12px; }
.job-row small { display: block; font-size: 10px; margin-top: 7px; }
.inline-empty { padding: 31px 8px; color: #91a4ae; text-align: center; font-size: 12px; line-height: 1.9; }
.button-group { display: flex; gap: 7px; flex-wrap: wrap; }
.button-group button { font-size: 11px; padding: 7px 10px; min-height: 30px; }
.job-summary { display: flex; gap: 20px; flex-wrap: wrap; padding: 13px 0 18px; border-bottom: 1px solid var(--line); font-size: 11px; color: #7a929e; }
.job-summary b { color: #3e6472; margin-left: 7px; font-weight: 600; }
.job-message { padding: 16px 0; font-size: 12px; line-height: 1.8; color: #608176; }
.log-panel { border-radius: 6px; background: #f7f9fa; padding: 17px; min-height: 180px; max-height: 330px; overflow-y: auto; font-family: Consolas, 'Microsoft YaHei', monospace; font-size: 10px; line-height: 1.9; }
.log-panel > div { display: flex; gap: 12px; margin-bottom: 6px; }
.log-panel time { color: #9aafb9; flex-shrink: 0; }
.log-panel .error { color: #a9514a; }
.log-panel .warning { color: #ac823b; background: none; margin: 0 0 6px; }
.route-card { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; gap: 18px; }
.route-card > div { display: flex; gap: 18px; align-items: center; min-width: 0; }
.route-card h2 { font-size: 20px; margin: 9px 0 5px; overflow-wrap: anywhere; }
.route-card p { margin: 0; font-size: 11px; }
.route-indicator { width: 10px; height: 10px; border-radius: 50%; background: #3ba383; box-shadow: 0 0 0 7px #eff8f3; flex-shrink: 0; margin: 0 10px 0 6px; }
.route-indicator.amber { background: #bc963c; box-shadow: 0 0 0 7px #fdf7e9; }
.proxy-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }
.proxy-list { max-height: 350px; overflow-y: auto; }
.proxy-list > div { display: flex; align-items: center; justify-content: space-between; padding: 14px 2px; border-top: 1px solid var(--line); }
code { font-family: Consolas, monospace; font-size: 12px; color: #507184; }
.pool-controls p { font-size: 12px; }
.pool-controls .info-box { margin-top: 21px; }
.service-output { font-size: 10px; padding: 15px; border-radius: 6px; background: #f5f8f9; color: #557482; max-height: 270px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 23px; align-items: start; }
.settings-grid .card > h2 { margin-bottom: 24px; }
.auth-card > p { font-size: 12px; }
.browser-login { background: #f7faf9; border: 1px solid #e4eeea; padding: 18px; border-radius: 7px; margin: 20px 0 22px; }
.browser-login > div { display: flex; gap: 12px; align-items: center; margin-bottom: 17px; color: #628a7d; }
.browser-login b { font-size: 12px; font-weight: 550; color: #406657; }
.browser-login small { font-size: 10px; display: block; margin-top: 6px; }
.browser-login button { font-size: 12px; width: 100%; }
details { border-bottom: 1px solid var(--line); margin-bottom: 9px; }
summary { cursor: pointer; font-size: 12px; color: #5b7785; padding: 13px 0; }
details .form-stack { padding: 9px 0 18px; }
.auth-actions { margin: 22px 0; }
.modal-backdrop { position: fixed; inset: 0; background: #102a3b70; display: flex; align-items: center; justify-content: center; padding: 25px; z-index: 20; backdrop-filter: blur(3px); }
.modal { width: min(540px, 100%); max-height: 90vh; background: white; border-radius: 12px; box-shadow: 0 25px 80px #132c3b50; overflow-y: auto; }
.modal.wide { width: min(1070px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 19px 24px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: white; z-index: 1; }
.modal-head h2 { margin: 0; }
.modal-body { padding: 24px; }
.modal-body > p { font-size: 12px; }
.compare-table { min-width: 580px; }
.compare-table th:first-child { min-width: 100px; width: 115px; }
.compare-table td, .compare-table th { min-width: 170px; max-width: 270px; }
.compare-table tbody th { background: #fafbfc; font-size: 11px; }
.detail-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 10px; color: #8da097; margin-bottom: 24px; }
.detail-meta a { display: flex; align-items: center; gap: 3px; margin-left: auto; }
.detail-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px 18px; margin-bottom: 24px; }
.detail-grid b { display: block; font-weight: 500; font-size: 12px; margin-top: 8px; }
.detail-grid small { font-size: 10px; }
.subject-pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 19px 0; }
.subject-pills span { font-size: 11px; background: #f1f6f8; color: #507688; padding: 8px 12px; border-radius: 5px; }
.subheading { margin: 28px 0 18px; font-weight: 600; font-size: 14px; }
.chart-empty { padding: 28px; text-align: center; background: #f8fafb; font-size: 11px; color: #8a9ca6; }
.trend { background: #f9fbfb; padding: 15px 18px 19px; border: 1px solid #edf1f2; border-radius: 7px; margin-bottom: 20px; }
.trend svg { width: 100%; display: block; max-height: 230px; }
.trend text { font: 10px 'Segoe UI', 'Microsoft YaHei', sans-serif; fill: #7e929c; }
.chart-legend { display: flex; gap: 17px; flex-wrap: wrap; font-size: 10px; color: #839ba6; padding-left: 35px; }
.chart-legend > span { display: flex; align-items: center; gap: 6px; }
.chart-legend i { width: 8px; height: 8px; border-radius: 50%; }
.toast { position: fixed; bottom: 28px; left: calc(50% + 110px); transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 13px 16px; background: #204a41; color: white; border-radius: 8px; box-shadow: 0 8px 35px #0e322532; z-index: 40; font-size: 12px; max-width: min(650px, 90vw); line-height: 1.8; }
.toast.error { background: #904f48; }
.toast button { color: white; background: transparent; border: 0; padding: 1px; min-height: 22px; margin-left: 4px; }
.toast > svg { flex-shrink: 0; }
.spin { animation: spin 1.2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 1200px) { .sidebar { width: 195px; } .main-shell { margin-left: 195px; width: calc(100% - 195px); } main { padding: 28px 24px; } .topbar { padding: 0 24px; } .page-title { align-items: flex-start; } h1 { font-size: 25px; } .stat { padding: 17px; } .stat small { line-height: 1.6; } .task-grid { grid-template-columns: 300px minmax(0, 1fr); } .card { padding: 20px; } .data-card { padding: 0; } .filters { padding: 15px; } .filter-main { flex-wrap: wrap; } .data-toolbar > div > span { display: none; } .detail-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 950px) { .stats-grid { grid-template-columns: 1fr 1fr; } .dashboard-grid, .settings-grid, .proxy-grid { grid-template-columns: 1fr; } .page-title { flex-direction: column; } .task-grid { grid-template-columns: 1fr; } .filter-more { grid-template-columns: 1fr 1fr; } footer > span { display: none; } .toast { left: 50%; } }
@media (max-width: 640px) { .sidebar { position: sticky; top: 0; width: 100%; height: auto; padding: 11px 14px; z-index: 10; } .brand { display: none; } .nav-label, .sidebar-bottom { display: none; } nav { flex-direction: row; justify-content: space-between; gap: 3px; } nav button { flex-direction: column; padding: 8px 6px; min-height: 44px; font-size: 9px; gap: 5px; flex: 1; } .nav-active-dot { display: none; } .app-shell { flex-direction: column; } .main-shell { width: 100%; margin: 0; } .topbar { height: 48px; padding: 0 18px; } main { padding: 24px 16px; } h1 { font-size: 22px; } .page-title { gap: 15px; margin-bottom: 21px; } .eyebrow { font-size: 8px; } .stats-grid { gap: 10px; } .stat { padding: 15px; } .stat strong { font-size: 27px; } .stat-top { font-size: 11px; } .stat-top > span { width: 28px; height: 28px; } .onboarding-empty { flex-wrap: wrap; } .onboarding-empty button { margin-left: 65px; } .detail-grid { grid-template-columns: 1fr 1fr; } .modal-backdrop { padding: 10px; } .modal-head { padding: 16px; } .modal-body { padding: 17px; } .three-fields { gap: 8px; } .filter-main > .search-input { min-width: 100%; } .compare-bar { gap: 9px; padding: 12px; flex-wrap: wrap; } .compare-bar > div { width: 100%; flex: auto; } .data-toolbar { padding: 15px; } .route-card { align-items: flex-start; } .route-card h2 { font-size: 16px; } footer { padding: 20px 17px; } }
@media (prefers-reduced-motion: reduce) { * { animation-duration: .01ms !important; transition: none !important; } }
+12
View File
@@ -0,0 +1,12 @@
export type Row = { id: number; year: number; school_name: string; school_code: string; province: string; level: string; major_code: string; major_name: string; department_name: string; department_code: string; direction: string; subjects: string[]; quota: number | null; quota_text: string; quota_scope: string; degree_type: string; study_mode: string; exam_type: string; advisor: string; special_plans: string[]; remarks: string; source: string; source_url: string; fetched_at: string; year_verified: boolean; favorite: boolean; score_total: number | null; score_year: number | null; score_scope: string | null; reference_books?: string[] };
export type Score = { year: number; total: number | null; scope: string; raw_code?: string; department_name?: string; source?: string; note?: string; politics?: number | null; english?: number | null; special_one?: number | null; special_two?: number | null };
export type History = { record: Row; scores: Score[]; plans: Row[] };
export type Job = { id: string; params: { mode: string; year: number; major_code?: string; provinces: string[] }; status: string; message: string; created_at: string; updated_at: string; records: number; errors: number; completed_units: number };
export type Log = { id: number; created_at: string; level: string; message: string };
export type Province = { code: string; name: string };
export type Major = { code: string; name: string; degree_type: string; category: string; discipline: string };
export type Overview = { records: number; schools: number; majors: number; favorites: number; indexed_schools: number; scores: number; years: number[]; provinces: { province: string; count: number }[]; provinces_list: Province[]; sources: { name: string; role: string; url: string }[] };
export type Config = { network_mode: string; pool_url: string; pool_project: string; backup_proxies: string[]; request_interval: number; timeout: number; retries: number };
export type Proxy = { mode: string; route: string; active_proxy: string | null; fallback: boolean; counts: { count?: number; http_type?: { https: number; http: number } }; available: number; quarantined: number; error: string; proxies: { url: string; failed: boolean; active: boolean }[] };
export type Auth = { saved: boolean; valid: boolean; message: string; browser_state: string; browser_message: string };
export type Filters = Record<string, string | number | boolean>;
+1
View File
@@ -0,0 +1 @@
/// <reference types="vite/client" />