feat: add search and user data routes, services, and tests
This commit is contained in:
@@ -326,13 +326,233 @@ a:hover { color: var(--accent-hover); text-decoration: underline; }
|
||||
border-top: 1px solid var(--border);
|
||||
}
|
||||
|
||||
/* ── Responsive ─────────────────────────────────────────────────── */
|
||||
/* ── Nav Search ──────────────────────────────────────────────────── */
|
||||
.nav-search {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.nav-search-input {
|
||||
padding: 5px 12px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
font-size: 0.85rem;
|
||||
background: var(--bg);
|
||||
color: var(--ink);
|
||||
width: 180px;
|
||||
transition: border-color 0.2s;
|
||||
font-family: var(--font-sans);
|
||||
}
|
||||
.nav-search-input:focus {
|
||||
outline: none;
|
||||
border-color: var(--accent);
|
||||
}
|
||||
|
||||
/* ── Search Page ────────────────────────────────────────────────── */
|
||||
.search-form {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.search-input {
|
||||
flex: 1;
|
||||
padding: 10px 16px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
font-size: 1rem;
|
||||
font-family: var(--font-sans);
|
||||
background: var(--surface);
|
||||
color: var(--ink);
|
||||
}
|
||||
.search-input:focus {
|
||||
outline: none;
|
||||
border-color: var(--accent);
|
||||
box-shadow: 0 0 0 3px rgba(45, 95, 138, 0.1);
|
||||
}
|
||||
|
||||
.search-btn {
|
||||
padding: 10px 24px;
|
||||
background: var(--accent);
|
||||
color: #fff;
|
||||
border: none;
|
||||
border-radius: var(--radius);
|
||||
font-size: 0.9rem;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
transition: background 0.2s;
|
||||
}
|
||||
.search-btn:hover { background: var(--accent-hover); }
|
||||
|
||||
/* ── Tag Filter ─────────────────────────────────────────────────── */
|
||||
.tag-filter {
|
||||
margin-bottom: 16px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.tag-filter-label {
|
||||
font-size: 0.85rem;
|
||||
color: var(--ink-light);
|
||||
}
|
||||
.tag-chip {
|
||||
display: inline-block;
|
||||
padding: 4px 10px;
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 4px;
|
||||
font-size: 0.8rem;
|
||||
color: var(--ink-light);
|
||||
}
|
||||
.tag-chip:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
|
||||
.tag-chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }
|
||||
|
||||
/* ── Search Meta & Sort ─────────────────────────────────────────── */
|
||||
.search-meta {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 16px;
|
||||
font-size: 0.9rem;
|
||||
color: var(--ink-light);
|
||||
}
|
||||
.sort-toggle a {
|
||||
color: var(--ink-light);
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
.sort-toggle a.active { color: var(--accent); font-weight: 600; }
|
||||
.sort-toggle a:hover { color: var(--accent); text-decoration: none; }
|
||||
.sort-divider { color: var(--border); margin: 0 4px; }
|
||||
|
||||
/* ── Search Highlight ───────────────────────────────────────────── */
|
||||
mark {
|
||||
background: #fff3cd;
|
||||
color: var(--ink);
|
||||
padding: 1px 2px;
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
.paper-snippet {
|
||||
margin-top: 8px;
|
||||
color: var(--ink-light);
|
||||
font-size: 0.92rem;
|
||||
line-height: 1.6;
|
||||
}
|
||||
.paper-date {
|
||||
margin-left: 12px;
|
||||
font-size: 0.82rem;
|
||||
color: var(--ink-light);
|
||||
}
|
||||
|
||||
/* ── Pagination ─────────────────────────────────────────────────── */
|
||||
.pagination {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
margin-top: 32px;
|
||||
padding-top: 16px;
|
||||
}
|
||||
.page-btn {
|
||||
padding: 6px 14px;
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
font-size: 0.85rem;
|
||||
color: var(--ink-light);
|
||||
}
|
||||
.page-btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
|
||||
.page-info {
|
||||
font-size: 0.85rem;
|
||||
color: var(--ink-light);
|
||||
}
|
||||
|
||||
/* ── Reading List ───────────────────────────────────────────────── */
|
||||
.page-heading {
|
||||
font-family: var(--font-body);
|
||||
font-size: 1.5rem;
|
||||
font-weight: 700;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.reading-list-filters {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
flex-wrap: wrap;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.filter-chip {
|
||||
display: inline-block;
|
||||
padding: 6px 14px;
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
font-size: 0.85rem;
|
||||
color: var(--ink-light);
|
||||
}
|
||||
.filter-chip:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
|
||||
.filter-chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }
|
||||
|
||||
/* ── Paper Card Footer (enhanced) ──────────────────────────────── */
|
||||
.paper-footer {
|
||||
margin-top: 12px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.paper-footer-left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.paper-footer-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
/* ── Bookmark Button ────────────────────────────────────────────── */
|
||||
.btn-bookmark {
|
||||
background: none;
|
||||
border: none;
|
||||
font-size: 1.2rem;
|
||||
cursor: pointer;
|
||||
color: var(--ink-light);
|
||||
padding: 2px 4px;
|
||||
transition: color 0.2s;
|
||||
line-height: 1;
|
||||
}
|
||||
.btn-bookmark:hover { color: var(--accent); }
|
||||
.btn-bookmark.active { color: #f0a500; }
|
||||
|
||||
/* ── Reading Badge ──────────────────────────────────────────────── */
|
||||
.reading-badge {
|
||||
font-size: 0.75rem;
|
||||
padding: 2px 6px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
.reading-unread { background: #f0f0f0; color: #888; }
|
||||
.reading-skimmed { background: #e3f2fd; color: #1976d2; }
|
||||
.reading-read_summary { background: #e8f5e9; color: #388e3c; }
|
||||
.reading-read_full { background: #e8f5e9; color: #2e7d32; font-weight: 500; }
|
||||
|
||||
/* ── Responsive ─────────────────────────────────────────────────── */
|
||||
@media (max-width: 640px) {
|
||||
.container { padding: 16px; }
|
||||
.nav-bar { padding: 10px 16px; }
|
||||
.nav-search-input { width: 120px; }
|
||||
.date-nav { gap: 8px; }
|
||||
.date-title { font-size: 1.2rem; }
|
||||
.paper-card { padding: 14px 16px; }
|
||||
.detail-title { font-size: 1.3rem; }
|
||||
.detail-meta { flex-direction: column; gap: 4px; }
|
||||
.search-form { flex-direction: column; }
|
||||
.reading-list-filters { gap: 4px; }
|
||||
.filter-chip { padding: 4px 10px; font-size: 0.8rem; }
|
||||
}
|
||||
|
||||
+18
-1
@@ -1 +1,18 @@
|
||||
/* app.js — 基础前端交互(HTMX 后续增强) */
|
||||
/* app.js — 基础前端交互 */
|
||||
|
||||
// Ctrl+K 或 / 聚焦搜索框
|
||||
document.addEventListener("keydown", function (e) {
|
||||
var input = document.querySelector(".nav-search-input");
|
||||
if (!input) return;
|
||||
|
||||
// 忽略在输入框内的按键
|
||||
if (e.target.tagName === "INPUT" || e.target.tagName === "TEXTAREA") return;
|
||||
|
||||
if ((e.ctrlKey || e.metaKey) && e.key === "k") {
|
||||
e.preventDefault();
|
||||
input.focus();
|
||||
} else if (e.key === "/") {
|
||||
e.preventDefault();
|
||||
input.focus();
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user