Revert "Add missing admin action files and navigation links"

This reverts commit 41be6835bf.
This commit is contained in:
Simo committed 2026-07-11 20:37:56 +02:00
1 parent 4a1e1115b3
commit 4d515bc400
338 files changed
+5949 -28144

No files matched your search

+11 -7
View File
@@ -1,6 +1,6 @@
"use client";
'use client';
import { useState } from "react";
import { useState } from 'react';
/**
* Read-only copy box for an embed snippet. Renders the code inside a
@@ -27,24 +27,28 @@ export function EmbedSnippet({
// 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()}`,
`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;
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(--color-text)]">{title}</h2>
<button type="button" className="btn btn-primary" onClick={copy}>
{copied ? "Copied!" : "Copy"}
{copied ? 'Copied!' : 'Copy'}
</button>
</div>
{description ? <p className="text-xs text-gray-500 dark:text-gray-400 mb-3">{description}</p> : null}
{description ? (
<p className="text-xs text-gray-500 dark:text-gray-400 mb-3">
{description}
</p>
) : null}
<textarea
id={id}
readOnly
+36 -35
View File
@@ -1,54 +1,54 @@
import Link from "next/link";
import { StatusCard } from "@/components/admin/dashboard";
import { siteSettings } from "@/lib/services/site-settings";
import { requireStaff } from "@/lib/admin/guard";
import { EmbedSnippet } from "./embed-snippet";
import { Code } from "lucide-react";
import Link from 'next/link';
import { StatusCard } from '@/components/admin/dashboard';
import { siteSettings } from '@/lib/services/site-settings';
import { requireStaff } from '@/lib/admin/guard';
import { EmbedSnippet } from './embed-snippet';
import { Code } from 'lucide-react';
import { getTranslations } from "next-intl/server";
export const dynamic = "force-dynamic";
export const dynamic = 'force-dynamic';
export const metadata = { title: "Radio Embed" };
export const metadata = { title: 'Radio Embed' };
export default async function AdminRadioEmbedPage() {
await requireStaff();
const t = await getTranslations("pages.admin.radio");
let streamUrl = "";
let radioName = "Radio";
let nowPlayingApiUrl = "";
let streamUrl = '';
let radioName = 'Radio';
let nowPlayingApiUrl = '';
try {
streamUrl = (await siteSettings.get("radio_stream_url", "")) ?? "";
streamUrl = (await siteSettings.get('radio_stream_url', '')) ?? '';
radioName =
(await siteSettings.get("radio_name", null)) ??
(await siteSettings.get("hotel_name", "Radio")) ??
"Radio";
nowPlayingApiUrl = (await siteSettings.get("radio_now_playing_api_url", "")) ?? "";
(await siteSettings.get('radio_name', null)) ??
(await siteSettings.get('hotel_name', 'Radio')) ??
'Radio';
nowPlayingApiUrl = (await siteSettings.get('radio_now_playing_api_url', '')) ?? '';
} catch {
streamUrl = "";
streamUrl = '';
}
streamUrl = streamUrl.trim();
nowPlayingApiUrl = nowPlayingApiUrl.trim();
const hasStream = streamUrl !== "";
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>
<nav className="text-xs text-gray-500 dark:text-gray-400 mb-2">
<Link href="/admin/radio">{t("title")}</Link> ·{" "}
<Link href="/admin/radio/settings">{t("settings")}</Link> ·{" "}
<Link href="/admin/radio/embed">{t("embed")}</Link> ·{" "}
<Link href="/admin/radio/banners">{t("banners.title")}</Link> ·{" "}
<Link href="/admin/radio/ranks">{t("ranks")}</Link> ·{" "}
<Link href="/admin/radio">{t("title")}</Link> ·{' '}
<Link href="/admin/radio/settings">{t("settings")}</Link> ·{' '}
<Link href="/admin/radio/embed">{t("embed")}</Link> ·{' '}
<Link href="/admin/radio/banners">{t("banners.title")}</Link> ·{' '}
<Link href="/admin/radio/ranks">{t("ranks")}</Link> ·{' '}
<Link href="/admin/radio/history">{t("history")}</Link>
</nav>
@@ -67,14 +67,14 @@ export default async function AdminRadioEmbedPage() {
<StatusCard
label={t("embedPage.streamUrl")}
value={hasStream ? t("embedPage.configured") : t("embedPage.missing")}
state={hasStream ? "ok" : "danger"}
state={hasStream ? 'ok' : 'danger'}
icon="\u{1F4BB}"
/>
<StatusCard label={t("embedPage.radioName")} value={radioName} icon="\u{1F399}\uFE0F" />
<StatusCard
label={t("embedPage.nowPlayingApi")}
value={nowPlayingApiUrl ? t("embedPage.set") : t("embedPage.notSet")}
state={nowPlayingApiUrl ? "ok" : "neutral"}
state={nowPlayingApiUrl ? 'ok' : 'neutral'}
icon="\u{1F3B5}"
/>
</div>
@@ -83,7 +83,9 @@ export default async function AdminRadioEmbedPage() {
{!hasStream ? (
<section className="mt-6">
<h2 className="admin-section-title">{t("embedPage.noStreamUrl")}</h2>
<p className="text-xs text-gray-500 dark:text-gray-400">{t("embedPage.noStreamUrlText")}</p>
<p className="text-xs text-gray-500 dark:text-gray-400">
{t("embedPage.noStreamUrlText")}
</p>
<p>
<Link href="/admin/radio/settings" className="btn btn-primary">
{t("embedPage.goToSettings")}
@@ -94,16 +96,15 @@ export default async function AdminRadioEmbedPage() {
<>
<section className="mt-6">
<h2 className="admin-section-title">{t("embedPage.livePreview")}</h2>
<p className="text-xs text-gray-500 dark:text-gray-400">{t("embedPage.livePreviewText")}</p>
<p className="text-xs text-gray-500 dark:text-gray-400">
{t("embedPage.livePreviewText")}
</p>
<div className="admin-card">
{}
<audio controls preload="none" src={streamUrl} style={{ width: "100%" }}>
{ }
<audio controls preload="none" src={streamUrl} style={{ width: '100%' }}>
{t("embedPage.audioUnsupported")}
</audio>
<p
className="text-xs text-gray-500 dark:text-gray-400"
style={{ margin: "0.5rem 0 0", wordBreak: "break-all" }}
>
<p className="text-xs text-gray-500 dark:text-gray-400" style={{ margin: '0.5rem 0 0', wordBreak: 'break-all' }}>
{t("embedPage.source")}: <code>{streamUrl}</code>
</p>
</div>