Rediseno home: hero destacado, chips de genero, masonry + scroll infinito, busqueda publica /buscar, footer comunidad, status/queue protegidos
This commit is contained in:
@@ -214,6 +214,38 @@ export function getPostCount(): number {
|
||||
return row.count
|
||||
}
|
||||
|
||||
// Búsqueda pública por título/título_jpn/artista/tags (LIKE sobre JSON).
|
||||
export function searchPosts(query: string, publishedOnly = true): Post[] {
|
||||
const d = getDb()
|
||||
const q = `%${query}%`
|
||||
const where = publishedOnly ? "published = 1 AND" : ""
|
||||
const rows = d
|
||||
.prepare(
|
||||
`SELECT * FROM posts WHERE ${where} (
|
||||
title LIKE @q OR
|
||||
title_jpn LIKE @q OR
|
||||
artist LIKE @q OR
|
||||
parody LIKE @q OR
|
||||
tags LIKE @q
|
||||
) ORDER BY published_at DESC LIMIT 100`,
|
||||
)
|
||||
.all({ q }) as Record<string, unknown>[]
|
||||
return rows.map(rowToPost)
|
||||
}
|
||||
|
||||
// Paginación de la home pública.
|
||||
export function getPostsPage(page: number, perPage: number, publishedOnly = true): { items: Post[]; total: number } {
|
||||
const d = getDb()
|
||||
const offset = (page - 1) * perPage
|
||||
const where = publishedOnly ? "WHERE published = 1" : ""
|
||||
const order = publishedOnly ? "published_at DESC" : "created_at DESC"
|
||||
const rows = d
|
||||
.prepare(`SELECT * FROM posts ${where} ORDER BY ${order} LIMIT @perPage OFFSET @offset`)
|
||||
.all({ perPage, offset }) as Record<string, unknown>[]
|
||||
const total = (d.prepare(`SELECT COUNT(*) as count FROM posts ${where}`).get() as { count: number }).count
|
||||
return { items: rows.map(rowToPost), total }
|
||||
}
|
||||
|
||||
export function getGidsNotInPosts(): string[] {
|
||||
return []
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
// Links comunitarios del sitio. Reemplazá los placeholders cuando tengas
|
||||
// Discord y Patreon reales.
|
||||
export const SITE_LINKS = {
|
||||
twitter: "https://x.com/worstscan",
|
||||
discord: "#", // TODO: link real de Discord
|
||||
patreon: "#", // TODO: link real de Patreon
|
||||
}
|
||||
|
||||
export const SITE_NAME = "worst-scan"
|
||||
export const SITE_TAGLINE = "traducción automática de manga"
|
||||
Reference in New Issue
Block a user