feat: clock fonts and glass and tinted clock styles
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
// How the big clock on the dashboard looks. The choices are stored per user.
|
||||
|
||||
export const CLOCK_FONTS = [
|
||||
"serif",
|
||||
"sans",
|
||||
"light",
|
||||
"rounded",
|
||||
"slab",
|
||||
] as const
|
||||
export type ClockFont = (typeof CLOCK_FONTS)[number]
|
||||
|
||||
export const CLOCK_FONT_NAMES: Record<ClockFont, string> = {
|
||||
serif: "Serif",
|
||||
sans: "Sans",
|
||||
light: "Light",
|
||||
rounded: "Rounded",
|
||||
slab: "Slab",
|
||||
}
|
||||
|
||||
export const CLOCK_STYLES = ["solid", "glass", "tinted"] as const
|
||||
export type ClockStyle = (typeof CLOCK_STYLES)[number]
|
||||
|
||||
export const CLOCK_STYLE_NAMES: Record<ClockStyle, string> = {
|
||||
solid: "Solid",
|
||||
glass: "Glass",
|
||||
tinted: "Tinted",
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import { z } from "zod"
|
||||
import { db } from "@/db"
|
||||
import { card, link, settings, wallpaper } from "@/db/schema"
|
||||
import { auth, requireUser, signUpEnabled, ssoName } from "@/lib/auth"
|
||||
import { CLOCK_FONTS, CLOCK_STYLES } from "@/lib/clock"
|
||||
import { ENGINES, parseSuggestions } from "@/lib/search"
|
||||
|
||||
const httpUrl = z.url({ protocol: /^https?$/ }).max(2000)
|
||||
@@ -74,6 +75,8 @@ export const getDashboard = createServerFn({ method: "GET" }).handler(
|
||||
title: s?.title ?? "Dahoam",
|
||||
searchEngine: s?.searchEngine ?? "duckduckgo",
|
||||
wallpaperUrl: s?.wallpaperUrl ?? null,
|
||||
clockFont: s?.clockFont ?? "serif",
|
||||
clockStyle: s?.clockStyle ?? "solid",
|
||||
searxngUrl: process.env.SEARXNG_URL || null,
|
||||
}
|
||||
}
|
||||
@@ -187,6 +190,8 @@ export const saveSettings = createServerFn({ method: "POST" })
|
||||
wallpaperUrl: z
|
||||
.union([httpUrl, z.string().regex(/^\/api\/wallpaper\?v=\d+$/)])
|
||||
.nullable(),
|
||||
clockFont: z.enum(CLOCK_FONTS),
|
||||
clockStyle: z.enum(CLOCK_STYLES),
|
||||
})
|
||||
.partial()
|
||||
.refine((patch) => Object.keys(patch).length > 0)
|
||||
|
||||
Reference in New Issue
Block a user