From: Roberto Morado Date: Mon, 10 Nov 2025 01:18:16 +0000 (-0500) Subject: Add metrics X-Git-Url: https://git.morado.dev/logout?a=commitdiff_plain;h=6bbd06536876b82a2ee31d5cacaac89277b9d477;p=blog.morado.dev Add metrics --- diff --git a/main.ts b/main.ts index a416f34..682cd96 100644 --- a/main.ts +++ b/main.ts @@ -202,7 +202,6 @@ function renderHeader(username?: string) {
👤 ${escapeHTML(username)} - View Blog Logout
@@ -258,7 +257,7 @@ function renderHTML(content: string): string { .username { color: #666; } - .logout-btn, .login-btn, .admin-btn { + .logout-btn, .login-btn { color: white; padding: 8px 16px; border: none; @@ -270,10 +269,8 @@ function renderHTML(content: string): string { } .logout-btn { background: #E6521F; } .logout-btn:hover { background: #EA2F14; } - .login-btn { background: #B4E197; } - .login-btn:hover { background: #83BD75; } - .admin-btn { background: #234C6A; } - .admin-btn:hover { background: #1B3C53; } + .login-btn { background: #289672; } + .login-btn:hover { background: #1E6F5C; } h1 { font-size: 2em; margin-bottom: 10px; } h1 a { color: #333; text-decoration: none; } h1 a:hover { color: #555; } @@ -391,7 +388,7 @@ function renderHTML(content: string): string { font-size: 1em; } textarea { - min-height: 800px; + min-height: 500px; resize: vertical; font-family: 'Courier New', monospace; } @@ -540,26 +537,6 @@ async function renderAdminPage( visitCount: number, ): Promise { const posts = await getAllPosts(); - const sortedPosts = posts.sort((a, b) => b.timestamp - a.timestamp); - - const postsHTML = sortedPosts.length > 0 - ? `

Recent Posts (${sortedPosts.length})

` + - sortedPosts.slice(0, 5).map((post) => { - const excerpt = trimMD(post.content).slice(0, 100) + - "..."; - return ` -
- ${ - escapeHTML(post.title) - } - -
${escapeHTML(excerpt)}
-
- `; - }).join("") - : '
No posts yet. Create your first post below!
'; const metricsHTML = `
@@ -568,6 +545,10 @@ async function renderAdminPage(
Total visits
${visitCount.toLocaleString()}
+
+
Total posts
+
${posts.length}
+
`; @@ -599,10 +580,6 @@ function fn() { ${metricsHTML} - -
- ${postsHTML} -
`); }