Revert "Merge pull request 'Complete Housekeeping migration and /ase cutover' (#52) from codex/housekeeping-complete into main"

This reverts commit 488b6e57c4, reversing
changes made to b506b4499a.
This commit is contained in:
2026-08-30 21:31:34 +02:00
parent 488b6e57c4
commit b1ddda66ff
802 changed files with 61370 additions and 76659 deletions
@@ -0,0 +1,66 @@
"use client";
import { useState } from "react";
import { Button } from "@/components/ui/button";
/**
* Read-only copy box for an embed snippet. Renders the code inside a
* <textarea readOnly> so staff can select/copy it, plus a one-click copy
* button (with clipboard fallback to selecting the text).
*/
export function EmbedSnippet({
title,
description,
snippet,
}: {
title: string;
description?: string;
snippet: string;
}) {
const [copied, setCopied] = useState(false);
async function copy() {
try {
await navigator.clipboard.writeText(snippet);
setCopied(true);
setTimeout(() => setCopied(false), 1500);
} catch {
// Clipboard API unavailable (e.g. insecure context) — fall back to
// selecting the textarea so the user can copy manually.
const el = document.getElementById(
`snippet-${title.replace(/\s+/g, "-").toLowerCase()}`,
) as HTMLTextAreaElement | null;
el?.select();
}
}
const id = `snippet-${title.replace(/\s+/g, "-").toLowerCase()}`;
const lines = snippet.split("\n").length;
return (
<section className="mt-6">
<div className="flex items-center justify-between gap-4 mb-1">
<h2 className="m-0 text-base font-bold text-[var(--admin-text)]">
{title}
</h2>
<Button type="button" variant="default" onClick={copy}>
{copied ? "Copied!" : "Copy"}
</Button>
</div>
{description ? (
<p className="text-xs theme-text-muted dark:theme-text-muted mb-3">
{description}
</p>
) : null}
<textarea
id={id}
readOnly
value={snippet}
rows={Math.min(Math.max(lines + 1, 3), 14)}
onFocus={(e) => e.currentTarget.select()}
spellCheck={false}
className="w-full font-mono text-sm resize-vertical"
/>
</section>
);
}
+126
View File
@@ -0,0 +1,126 @@
import { getTranslations } from "next-intl/server";
import { StatusCard } from "@/components/admin/dashboard";
import Link from "@/components/link";
import { Button } from "@/components/ui/button";
import { resolveHotelName } from "@/lib/hotel-name";
import { siteSettings } from "@/lib/services/site-settings";
import { EmbedSnippet } from "./embed-snippet";
export const metadata = { title: "Radio Embed" };
export default async function AdminRadioEmbedPage() {
const t = await getTranslations("pages.admin.radio");
let streamUrl = "";
let radioName = "Radio";
let nowPlayingApiUrl = "";
try {
streamUrl = (await siteSettings.get("radio_stream_url", "")) ?? "";
radioName =
(await siteSettings.get("radio_name", null)) ??
(await resolveHotelName());
nowPlayingApiUrl =
(await siteSettings.get("radio_now_playing_api_url", "")) ?? "";
} catch {
streamUrl = "";
}
streamUrl = streamUrl.trim();
nowPlayingApiUrl = nowPlayingApiUrl.trim();
const hasStream = streamUrl !== "";
const audioSnippet = hasStream
? `<audio controls preload="none" src="${streamUrl}">\n ${t("embedPage.audioUnsupported")}\n</audio>`
: "";
const iframeSnippet = hasStream
? `<iframe\n src="/radio/embed"\n title="${radioName}"\n width="320"\n height="120"\n frameborder="0"\n allow="autoplay"\n style="border:0;border-radius:8px;overflow:hidden"\n></iframe>`
: "";
return (
<main>
<section className="mt-6">
<div className="grid grid-cols-[repeat(auto-fit,minmax(180px,1fr))] gap-3.5 mb-6">
<StatusCard
label={t("embedPage.streamUrl")}
value={
hasStream ? t("embedPage.configured") : t("embedPage.missing")
}
state={hasStream ? "ok" : "danger"}
icon="💻"
/>
<StatusCard
label={t("embedPage.radioName")}
value={radioName}
icon="🎙️"
/>
<StatusCard
label={t("embedPage.nowPlayingApi")}
value={
nowPlayingApiUrl ? t("embedPage.set") : t("embedPage.notSet")
}
state={nowPlayingApiUrl ? "ok" : "neutral"}
icon="🎵"
/>
</div>
</section>
{!hasStream ? (
<section className="mt-6">
<h2 className="admin-section-title">{t("embedPage.noStreamUrl")}</h2>
<p className="text-xs theme-text-muted dark:theme-text-muted">
{t("embedPage.noStreamUrlText")}
</p>
<p>
<Button variant="default" asChild>
<Link href="/admin/radio/settings">
{t("embedPage.goToSettings")}
</Link>
</Button>
</p>
</section>
) : (
<>
<section className="mt-6">
<h2 className="admin-section-title">
{t("embedPage.livePreview")}
</h2>
<p className="text-xs theme-text-muted dark:theme-text-muted">
{t("embedPage.livePreviewText")}
</p>
<div className="admin-card">
{}
<audio
controls
preload="none"
src={streamUrl}
style={{ width: "100%" }}
>
<track kind="captions" />
{t("embedPage.audioUnsupported")}
</audio>
<p
className="text-xs theme-text-muted dark:theme-text-muted"
style={{ margin: "0.5rem 0 0", wordBreak: "break-all" }}
>
{t("embedPage.source")}: <code>{streamUrl}</code>
</p>
</div>
</section>
<EmbedSnippet
title={t("embedPage.audioSnippet")}
description={t("embedPage.audioSnippetDesc")}
snippet={audioSnippet}
/>
<EmbedSnippet
title={t("embedPage.iframeSnippet")}
description={t("embedPage.iframeSnippetDesc")}
snippet={iframeSnippet}
/>
</>
)}
</main>
);
}