Files
TaxHacker_s23/app/settings/fields/page.tsx
Vasily Zubarev 0b98a2c307 (squash) init
feat: filters, settings, backups

fix: ts compile errors

feat: new dashboard, webp previews and settings

feat: use webp for pdfs

feat: use webp

fix: analyze resets old data

fix: switch to corsproxy

fix: switch to free cors

fix: max upload limit

fix: currency conversion

feat: transaction export

fix: currency conversion

feat: refactor settings actions

feat: new loader

feat: README + LICENSE

doc: update readme

doc: update readme

doc: update readme

doc: update screenshots

ci: bump prisma
2025-03-16 21:29:20 +01:00

52 lines
1.4 KiB
TypeScript

import { addFieldAction, deleteFieldAction, editFieldAction } from "@/app/settings/actions"
import { CrudTable } from "@/components/settings/crud"
import { getFields } from "@/data/fields"
export default async function FieldsSettingsPage() {
const fields = await getFields()
const fieldsWithActions = fields.map((field) => ({
...field,
isEditable: true,
isDeletable: field.isExtra,
}))
return (
<div className="container">
<h1 className="text-2xl font-bold mb-6">Custom Fields</h1>
<CrudTable
items={fieldsWithActions}
columns={[
{ key: "name", label: "Name", editable: true },
{ key: "type", label: "Type", editable: true },
{ key: "llm_prompt", label: "LLM Prompt", editable: true },
]}
onDelete={async (code) => {
"use server"
await deleteFieldAction(code)
}}
onAdd={async (data) => {
"use server"
await addFieldAction(
data as {
name: string
type: string
llm_prompt?: string
}
)
}}
onEdit={async (code, data) => {
"use server"
await editFieldAction(
code,
data as {
name: string
type: string
llm_prompt?: string
}
)
}}
/>
</div>
)
}