diff --git a/2016/src/App.css b/2016/src/App.css index dc235f3..9410c19 100644 --- a/2016/src/App.css +++ b/2016/src/App.css @@ -1,24 +1,38 @@ .app { max-width: 1200px; margin: 0 auto; - padding: 2rem 1rem; - font-family: system-ui, -apple-system, sans-serif; + padding: 2rem 1rem 3rem; } +/* Header */ header { text-align: center; margin-bottom: 2rem; } header h1 { - font-size: 1.8rem; - color: #1a1a2e; - margin-bottom: 0.25rem; + font-size: clamp(1.4rem, 2.4vw, 2rem); + color: var(--text); + margin: 0 0 0.4rem; + letter-spacing: -0.01em; + font-weight: 700; } .subtitle { - color: #666; + color: var(--text-muted); font-size: 0.95rem; + margin: 0; +} + +.subtitle .pill { + display: inline-block; + padding: 0.1rem 0.55rem; + background: var(--accent-soft); + color: var(--accent); + border-radius: 999px; + font-weight: 600; + font-size: 0.8rem; + margin-right: 0.35rem; } /* Tabs */ @@ -27,29 +41,30 @@ header h1 { gap: 0; max-width: 600px; margin: 0 auto 1.5rem; - border-bottom: 2px solid #ddd; + border-bottom: 1px solid var(--border); } .tab { flex: 1; padding: 0.75rem 1rem; - font-size: 1rem; + font-size: 0.95rem; background: none; border: none; border-bottom: 2px solid transparent; - margin-bottom: -2px; + margin-bottom: -1px; cursor: pointer; - color: #666; - transition: color 0.2s, border-color 0.2s; + color: var(--text-muted); + font-weight: 500; + transition: color 0.15s, border-color 0.15s; } .tab:hover { - color: #4361ee; + color: var(--accent); } -.tab.active { - color: #4361ee; - border-bottom-color: #4361ee; +.tab[aria-selected="true"] { + color: var(--accent); + border-bottom-color: var(--accent); font-weight: 600; } @@ -59,35 +74,71 @@ header h1 { gap: 0.5rem; max-width: 600px; margin: 0 auto 1.5rem; + position: relative; +} + +.search-field { + flex: 1; + position: relative; } .search-form input { - flex: 1; - padding: 0.75rem 1rem; + width: 100%; + padding: 0.75rem 2.25rem 0.75rem 1rem; font-size: 1rem; - border: 2px solid #ddd; - border-radius: 8px; + border: 1px solid var(--border-strong); + border-radius: var(--radius); + background: var(--surface); + color: var(--text); outline: none; - transition: border-color 0.2s; + transition: border-color 0.15s, box-shadow 0.15s; } .search-form input:focus { - border-color: #4361ee; + border-color: var(--accent); + box-shadow: 0 0 0 3px var(--accent-soft); } -.search-form button { - padding: 0.75rem 1.5rem; - font-size: 1rem; - background: #4361ee; - color: white; +.search-clear { + position: absolute; + right: 0.4rem; + top: 50%; + transform: translateY(-50%); + width: 1.75rem; + height: 1.75rem; + display: grid; + place-items: center; border: none; - border-radius: 8px; + background: transparent; + color: var(--text-faint); + font-size: 1.1rem; + border-radius: 50%; cursor: pointer; - transition: background 0.2s; } -.search-form button:hover:not(:disabled) { - background: #3a56d4; +.search-clear:hover { + background: var(--surface-alt); + color: var(--text); +} + +.search-form button[type="submit"] { + padding: 0.75rem 1.5rem; + font-size: 0.95rem; + font-weight: 600; + background: var(--accent); + color: #fff; + border: none; + border-radius: var(--radius); + cursor: pointer; + transition: background 0.15s, transform 0.05s; +} + +.search-form button[type="submit"]:hover:not(:disabled) { + background: var(--accent-hover); +} + +.search-form button[type="submit"]:active:not(:disabled) { + transform: translateY(1px); } .search-form button:disabled { @@ -97,37 +148,41 @@ header h1 { /* Custom query */ .custom-query { - max-width: 900px; + max-width: 960px; margin: 0 auto; } .preset-list { display: flex; flex-wrap: wrap; - gap: 0.5rem; - margin-bottom: 1rem; + gap: 0.4rem; + margin-bottom: 0.85rem; align-items: center; } .preset-label { - font-size: 0.85rem; - color: #666; + font-size: 0.8rem; + color: var(--text-muted); white-space: nowrap; + margin-right: 0.25rem; + font-weight: 500; } .preset-btn { padding: 0.35rem 0.75rem; font-size: 0.8rem; - background: #f0f0f5; - border: 1px solid #ddd; - border-radius: 6px; + background: var(--surface); + border: 1px solid var(--border); + color: var(--text); + border-radius: 999px; cursor: pointer; - transition: background 0.2s, border-color 0.2s; + transition: background 0.15s, border-color 0.15s, color 0.15s; } .preset-btn:hover:not(:disabled) { - background: #e8e8f0; - border-color: #4361ee; + background: var(--accent-soft); + border-color: var(--accent); + color: var(--accent); } .preset-btn:disabled { @@ -141,42 +196,49 @@ header h1 { .query-form textarea { width: 100%; - padding: 0.75rem 1rem; + padding: 0.85rem 1rem; font-size: 0.9rem; - font-family: "Cascadia Code", "Fira Code", "JetBrains Mono", monospace; - border: 2px solid #ddd; - border-radius: 8px; + font-family: + "JetBrains Mono", "Cascadia Code", "Fira Code", ui-monospace, monospace; + background: var(--surface); + color: var(--text); + border: 1px solid var(--border-strong); + border-radius: var(--radius); outline: none; resize: vertical; - min-height: 120px; - transition: border-color 0.2s; + min-height: 130px; + transition: border-color 0.15s, box-shadow 0.15s; tab-size: 2; + line-height: 1.5; } .query-form textarea:focus { - border-color: #4361ee; + border-color: var(--accent); + box-shadow: 0 0 0 3px var(--accent-soft); } .query-actions { display: flex; align-items: center; gap: 1rem; - margin-top: 0.5rem; + margin-top: 0.6rem; + flex-wrap: wrap; } .query-actions button { - padding: 0.6rem 1.5rem; - font-size: 0.95rem; - background: #4361ee; - color: white; + padding: 0.6rem 1.4rem; + font-size: 0.9rem; + font-weight: 600; + background: var(--accent); + color: #fff; border: none; - border-radius: 8px; + border-radius: var(--radius); cursor: pointer; - transition: background 0.2s; + transition: background 0.15s; } .query-actions button:hover:not(:disabled) { - background: #3a56d4; + background: var(--accent-hover); } .query-actions button:disabled { @@ -186,28 +248,57 @@ header h1 { .exec-time { font-size: 0.85rem; - color: #666; + color: var(--text-muted); + font-variant-numeric: tabular-nums; +} + +.exec-time.running { + color: var(--accent); +} + +.kbd { + display: inline-block; + padding: 0.05rem 0.4rem; + font-family: ui-monospace, monospace; + font-size: 0.75rem; + background: var(--surface-alt); + border: 1px solid var(--border); + border-bottom-width: 2px; + border-radius: 4px; + color: var(--text-muted); } /* Loading */ .loading { + max-width: 600px; + margin: 0.5rem auto 1.5rem; + padding: 0.85rem 1rem; text-align: center; - margin: 1rem 0; - color: #555; + color: var(--text-muted); + background: var(--surface); + border: 1px solid var(--border); + border-radius: var(--radius); + box-shadow: var(--shadow-sm); +} + +.loading p { + margin: 0 0 0.5rem; + font-size: 0.9rem; } .progress-bar { - width: 300px; - height: 8px; - background: #eee; + width: 100%; + max-width: 300px; + height: 6px; + background: var(--surface-alt); border-radius: 4px; - margin: 0.5rem auto; + margin: 0 auto; overflow: hidden; } .progress-fill { height: 100%; - background: #4361ee; + background: linear-gradient(90deg, var(--accent), var(--accent-hover)); border-radius: 4px; transition: width 0.3s; } @@ -216,12 +307,17 @@ header h1 { .table-wrapper { overflow-x: auto; margin-top: 1rem; + background: var(--surface); + border: 1px solid var(--border); + border-radius: var(--radius); + box-shadow: var(--shadow-sm); } .result-count { - color: #555; + color: var(--text-muted); font-size: 0.9rem; - margin-bottom: 0.5rem; + margin: 0.5rem 0; + padding: 0 0.25rem; } table { @@ -231,31 +327,53 @@ table { } thead th { - background: #f0f0f5; - padding: 0.6rem 0.5rem; + background: var(--surface-alt); + padding: 0.65rem 0.6rem; text-align: left; white-space: nowrap; position: sticky; top: 0; - border-bottom: 2px solid #ddd; + border-bottom: 1px solid var(--border-strong); + color: var(--text-muted); + font-weight: 600; + font-size: 0.8rem; + text-transform: uppercase; + letter-spacing: 0.03em; } tbody td { - padding: 0.5rem; - border-bottom: 1px solid #eee; + padding: 0.55rem 0.6rem; + border-bottom: 1px solid var(--border); } -tbody tr:hover { - background: #f8f9ff; +tbody tr:last-child td { + border-bottom: none; +} + +tbody tr:nth-child(even) td { + background: color-mix(in srgb, var(--surface-alt) 45%, transparent); +} + +tbody tr:hover td { + background: var(--accent-soft); +} + +.sbd-cell { + font-family: ui-monospace, monospace; + font-size: 0.85rem; + color: var(--text-muted); + white-space: nowrap; } .name-cell { white-space: nowrap; + font-weight: 500; } .cumthi-cell { - font-size: 0.8rem; - max-width: 200px; + font-size: 0.82rem; + color: var(--text-muted); + max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; @@ -266,30 +384,46 @@ tbody tr:hover { font-variant-numeric: tabular-nums; } +.score-cell.score-high { + color: var(--ok); + font-weight: 600; +} + +.score-cell.score-low { + color: var(--danger); +} + +.score-cell.score-empty { + color: var(--text-faint); +} + /* Messages */ .no-results, .error, .warning { text-align: center; - padding: 1rem; - border-radius: 8px; - margin: 1rem 0; + padding: 0.9rem 1rem; + border-radius: var(--radius); + margin: 1rem auto; + max-width: 600px; + font-size: 0.9rem; } .no-results { - color: #666; - background: #f5f5f5; + color: var(--text-muted); + background: var(--surface); + border: 1px dashed var(--border-strong); } .error { - color: #d32f2f; - background: #fdecea; + color: var(--danger); + background: var(--danger-bg); + border: 1px solid color-mix(in srgb, var(--danger) 25%, transparent); } .warning { - color: #e65100; - background: #fff3e0; - font-size: 0.9rem; + color: var(--warn); + background: var(--warn-bg); } /* Footer */ @@ -297,27 +431,44 @@ footer { text-align: center; margin-top: 3rem; padding-top: 1rem; - border-top: 1px solid #eee; - color: #999; + border-top: 1px solid var(--border); + color: var(--text-faint); font-size: 0.85rem; } +footer a { + color: var(--text-muted); +} + /* Responsive */ -@media (max-width: 600px) { - header h1 { - font-size: 1.3rem; +@media (max-width: 640px) { + .app { + padding: 1.25rem 0.75rem 2rem; } .search-form { flex-direction: column; } + .search-form button[type="submit"] { + width: 100%; + } + table { font-size: 0.8rem; } + thead th, + tbody td { + padding: 0.45rem 0.4rem; + } + .preset-list { flex-direction: column; - align-items: flex-start; + align-items: stretch; + } + + .preset-btn { + text-align: left; } } diff --git a/2016/src/App.jsx b/2016/src/App.jsx index f09e734..494519c 100644 --- a/2016/src/App.jsx +++ b/2016/src/App.jsx @@ -93,16 +93,16 @@ function App() {

Tra cứu điểm thi THPT Quốc gia 2016

- Dữ liệu 877.461 thí sinh toàn quốc · Hỗ trợ truy vấn SQL tùy chỉnh + 877.461 thí sinh + Dữ liệu toàn quốc · Hỗ trợ truy vấn SQL tùy chỉnh

{loading && ( -
+

- Đang tải cơ sở dữ liệu...{" "} - {progress > 0 ? `${progress}%` : ""} + Đang tải cơ sở dữ liệu{progress > 0 ? ` · ${progress}%` : "..."}

Lỗi: {error}

} -
+
{execTime !== null && ( diff --git a/2016/src/components/score-table.jsx b/2016/src/components/score-table.jsx index 5ddd1fc..e5258d6 100644 --- a/2016/src/components/score-table.jsx +++ b/2016/src/components/score-table.jsx @@ -18,6 +18,14 @@ function formatScore(val) { return Number(val).toFixed(2); } +function scoreClass(val) { + if (val === null || val === undefined) return "score-cell score-empty"; + const num = Number(val); + if (num >= 8) return "score-cell score-high"; + if (num < 4) return "score-cell score-low"; + return "score-cell"; +} + export function ScoreTable({ results }) { if (!results) return null; if (results.length === 0) { @@ -25,38 +33,42 @@ export function ScoreTable({ results }) { } return ( -
+ <>

Tìm thấy {results.length} kết quả

- - - - - - - - - {SUBJECT_COLUMNS.map((col) => ( - - ))} - - - - {results.map((row) => ( - - - - - - +
+
SBDHọ tênNgày sinhCụm thiGT{col.label}
{row.so_bao_danh}{row.ho_ten}{row.ngay_sinh || "—"}{row.ten_cum_thi || "—"}{row.gioi_tinh || "—"}
+ + + + + + + {SUBJECT_COLUMNS.map((col) => ( - + ))} - ))} - -
SBDHọ tênNgày sinhCụm thiGT - {formatScore(row[col.key])} - {col.label}
-
+ + + {results.map((row) => ( + + {row.so_bao_danh} + {row.ho_ten} + {row.ngay_sinh || "—"} + + {row.ten_cum_thi || "—"} + + {row.gioi_tinh || "—"} + {SUBJECT_COLUMNS.map((col) => ( + + {formatScore(row[col.key])} + + ))} + + ))} + + +
+ ); } diff --git a/2016/src/components/search-form.jsx b/2016/src/components/search-form.jsx index 7fcbbe4..bec23f7 100644 --- a/2016/src/components/search-form.jsx +++ b/2016/src/components/search-form.jsx @@ -10,15 +10,34 @@ export function SearchForm({ onSearch, disabled }) { } return ( -
- setQuery(e.target.value)} - placeholder="Nhập SBD hoặc họ tên (VD: nguyen van a)..." - disabled={disabled} - autoFocus - /> + +
+ + setQuery(e.target.value)} + placeholder="Nhập SBD hoặc họ tên (VD: nguyen van a)..." + disabled={disabled} + autoFocus + autoComplete="off" + spellCheck={false} + /> + {query && ( + + )} +
diff --git a/2016/src/index.css b/2016/src/index.css index 85687aa..52bc39d 100644 --- a/2016/src/index.css +++ b/2016/src/index.css @@ -1,13 +1,74 @@ +:root { + /* Light theme tokens */ + --bg: #f7f8fb; + --surface: #ffffff; + --surface-alt: #f2f4f9; + --border: #e3e6ee; + --border-strong: #cfd4e1; + --text: #1a1a2e; + --text-muted: #5c6275; + --text-faint: #8a8fa3; + --accent: #4361ee; + --accent-hover: #3a56d4; + --accent-soft: #e9edff; + --danger: #d32f2f; + --danger-bg: #fdecea; + --warn: #b45309; + --warn-bg: #fff4d6; + --ok: #0f8a4f; + --ok-bg: #e4f7ec; + --shadow-sm: 0 1px 2px rgba(20, 22, 38, 0.06); + --shadow-md: 0 4px 14px rgba(20, 22, 38, 0.08); + --radius: 10px; + --radius-sm: 6px; +} + +@media (prefers-color-scheme: dark) { + :root { + --bg: #0f1117; + --surface: #181b24; + --surface-alt: #21252f; + --border: #2a2f3d; + --border-strong: #3a4052; + --text: #eef0f6; + --text-muted: #a7adbe; + --text-faint: #6e7486; + --accent: #8aa1ff; + --accent-hover: #a6b8ff; + --accent-soft: #1e2647; + --danger: #ff7a7a; + --danger-bg: #3a1d1d; + --warn: #ffc875; + --warn-bg: #3a2a12; + --ok: #6ee2a4; + --ok-bg: #133524; + --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5); + --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.4); + } +} + *, *::before, *::after { box-sizing: border-box; } +html { + color-scheme: light dark; +} + body { margin: 0; - font-family: system-ui, -apple-system, sans-serif; + font-family: + "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; - background: #fafafa; - color: #333; + background: var(--bg); + color: var(--text); + line-height: 1.5; +} + +:focus-visible { + outline: 2px solid var(--accent); + outline-offset: 2px; + border-radius: 4px; }