BREAKING: postgres + saas

This commit is contained in:
Vasily Zubarev
2025-04-03 13:07:54 +02:00
parent 54a892ddb0
commit f523b1f8ba
136 changed files with 3971 additions and 1563 deletions

View File

@@ -0,0 +1,42 @@
import { addCurrencyAction, deleteCurrencyAction, editCurrencyAction } from "@/app/(app)/settings/actions"
import { CrudTable } from "@/components/settings/crud"
import { getCurrentUser } from "@/lib/auth"
import { getCurrencies } from "@/models/currencies"
export default async function CurrenciesSettingsPage() {
const user = await getCurrentUser()
const currencies = await getCurrencies(user.id)
const currenciesWithActions = currencies.map((currency) => ({
...currency,
isEditable: true,
isDeletable: true,
}))
return (
<div className="container">
<h1 className="text-2xl font-bold mb-2">Currencies</h1>
<p className="text-sm text-gray-500 mb-6 max-w-prose">
Custom currencies would not be automatically converted but you still can have them.
</p>
<CrudTable
items={currenciesWithActions}
columns={[
{ key: "code", label: "Code", editable: true },
{ key: "name", label: "Name", editable: true },
]}
onDelete={async (code) => {
"use server"
return await deleteCurrencyAction(user.id, code)
}}
onAdd={async (data) => {
"use server"
return await addCurrencyAction(user.id, data as { code: string; name: string })
}}
onEdit={async (code, data) => {
"use server"
return await editCurrencyAction(user.id, code, data as { name: string })
}}
/>
</div>
)
}