feat: add editorial approval and account guards
This commit is contained in:
1 parent
a8d4e54ffb
commit
3584b4a7a7
9 files changed
+878
-1
No files matched your search
@@ -0,0 +1,47 @@
|
||||
import { desc } from "drizzle-orm";
|
||||
|
||||
import { db } from "@/db/client";
|
||||
import { editorialAccounts } from "@/db/schema";
|
||||
|
||||
export default async function EditorialsPage() {
|
||||
const editorials = await db
|
||||
.select({
|
||||
id: editorialAccounts.id,
|
||||
name: editorialAccounts.name,
|
||||
contactName: editorialAccounts.contactName,
|
||||
loginEmail: editorialAccounts.loginEmail,
|
||||
status: editorialAccounts.status,
|
||||
currentPriceCents: editorialAccounts.currentPriceCents,
|
||||
createdAt: editorialAccounts.createdAt,
|
||||
})
|
||||
.from(editorialAccounts)
|
||||
.orderBy(desc(editorialAccounts.createdAt));
|
||||
|
||||
return (
|
||||
<section className="content-section" aria-labelledby="editorials-title">
|
||||
<p className="eyebrow">Kontoverwaltung</p>
|
||||
<h1 id="editorials-title">Redaktionen</h1>
|
||||
{editorials.length === 0 ? (
|
||||
<p>Noch keine Redaktionen registriert.</p>
|
||||
) : (
|
||||
<ul>
|
||||
{editorials.map((editorial) => (
|
||||
<li key={editorial.id}>
|
||||
<a href={`/admin/redaktionen/${editorial.id}`}>{editorial.name}</a>
|
||||
<p>
|
||||
{editorial.contactName} · {editorial.loginEmail} · Status: {editorial.status}
|
||||
{editorial.currentPriceCents === null
|
||||
? " · Preis noch nicht festgelegt"
|
||||
: ` · Netto ${formatCents(editorial.currentPriceCents)}`}
|
||||
</p>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
function formatCents(cents: number): string {
|
||||
return new Intl.NumberFormat("de-DE", { style: "currency", currency: "EUR" }).format(cents / 100);
|
||||
}
|
||||
Reference in new issue
Block a user