refactor: split admin.ts into sub-modules (P2-11)

Extracts 3833-line admin.ts into focused modules:
- src/routes/admin/ui.ts       — layout() and clampText() helpers
- src/routes/admin/helpers.ts  — KV list helpers (listAllFeeds, addFeedToList, etc.)
- src/routes/admin/feeds.ts    — feed CRUD routes (feedsRouter)
- src/routes/admin/emails.ts   — email view/delete routes (emailsRouter)

admin.ts now mounts the sub-routers and retains only auth middleware,
dashboard, login/logout, and the in-place feed API update route.
All 163 tests continue to pass.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
Julien HerrandClaude Sonnet 4.6 committed 2026-05-22 10:56:20 +02:00
1 parent a9501d6e44
commit 205d4ef5bb
5 files changed
+1898 -2228

No files matched your search

+36
View File
@@ -0,0 +1,36 @@
import { html, raw } from "hono/html";
import { designSystem } from "../../styles/index";
import { interactiveScripts } from "../../scripts/index";
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const layout = (title: string, content: any) => {
return html`<!DOCTYPE html>
<html>
<head>
<title>${title} - Email to RSS Admin</title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="color-scheme" content="light dark" />
<style>
${raw(designSystem)}
</style>
<script>
${raw(interactiveScripts)};
</script>
</head>
<body class="page">
${content}
</body>
</html>`;
};
export function clampText(value: string, maxLen: number): string {
const raw = `${value || ""}`;
if (raw.length <= maxLen) {
return raw.trim();
}
if (maxLen <= 3) {
return raw.slice(0, maxLen).trim();
}
return `${raw.slice(0, maxLen - 3).trimEnd()}...`;
}