mirror of
https://github.com/Since-3/since3-portal.git
synced 2026-10-12 19:51:17 +00:00
29 lines
1.1 KiB
TypeScript
29 lines
1.1 KiB
TypeScript
// Nachrichten zwischen Editor und Vorschau-iframe (gleiche Origin, siehe live-preview.tsx)
|
|
export const PREVIEW_READY = "since3:preview-ready"
|
|
export const PREVIEW_CONTENT = "since3:preview-content"
|
|
// Baukasten: Vorschau scrollt zum Baustein, der im Editor gerade bearbeitet wird
|
|
export const PREVIEW_FOCUS = "since3:preview-focus"
|
|
|
|
export const DEVICES = {
|
|
desktop: { label: "Desktop", width: 1440 },
|
|
tablet: { label: "Tablet", width: 820 },
|
|
mobile: { label: "Mobil", width: 390 },
|
|
} as const
|
|
|
|
export type Device = keyof typeof DEVICES
|
|
|
|
export type ShareState = "shared" | "expired" | "private"
|
|
|
|
export function shareState(token: string | null, expiresAt: string | null): ShareState {
|
|
if (!token) return "private"
|
|
return expiresAt && new Date(expiresAt).getTime() <= Date.now() ? "expired" : "shared"
|
|
}
|
|
|
|
export const dateFormat = new Intl.DateTimeFormat("de-DE", { dateStyle: "medium", timeZone: "Europe/Berlin" })
|
|
|
|
export const SHARE_EXPIRY_OPTIONS = [
|
|
{ days: 0, label: "Unbegrenzt" },
|
|
{ days: 7, label: "7 Tage" },
|
|
{ days: 30, label: "30 Tage" },
|
|
{ days: 90, label: "90 Tage" },
|
|
] as const
|