fix #30: individual items are not saved

"
This commit is contained in:
Vasily Zubarev
2025-07-14 08:59:50 +02:00
parent b32421f114
commit 8f7c4a4d61
5 changed files with 14 additions and 11 deletions

View File

@@ -36,14 +36,14 @@ export default async function FieldsSettingsPage() {
{ key: "llm_prompt", label: "LLM Prompt", editable: true }, { key: "llm_prompt", label: "LLM Prompt", editable: true },
{ {
key: "isVisibleInList", key: "isVisibleInList",
label: "Always show in transactions table", label: "Show in transactions table",
type: "checkbox", type: "checkbox",
defaultValue: false, defaultValue: false,
editable: true, editable: true,
}, },
{ {
key: "isVisibleInAnalysis", key: "isVisibleInAnalysis",
label: "Always show in analysis form", label: "Show in analysis form",
type: "checkbox", type: "checkbox",
defaultValue: false, defaultValue: false,
editable: true, editable: true,

View File

@@ -0,0 +1,3 @@
export default function UnsortedLayout({ children }: { children: React.ReactNode }) {
return <div className="flex flex-col gap-4 p-4 w-full max-w-6xl">{children}</div>
}

View File

@@ -3,7 +3,7 @@ import { Loader2 } from "lucide-react"
export default function Loading() { export default function Loading() {
return ( return (
<div className="flex flex-col gap-6 p-4 w-full max-w-6xl"> <>
<header className="flex items-center justify-between"> <header className="flex items-center justify-between">
<h2 className="text-3xl font-bold tracking-tight flex flex-row gap-2"> <h2 className="text-3xl font-bold tracking-tight flex flex-row gap-2">
<span>Loading unsorted files...</span> <span>Loading unsorted files...</span>
@@ -27,6 +27,6 @@ export default function Loading() {
</div> </div>
</div> </div>
</Skeleton> </Skeleton>
</div> </>
) )
} }

View File

@@ -32,7 +32,7 @@ export default async function UnsortedPage() {
const settings = await getSettings(user.id) const settings = await getSettings(user.id)
return ( return (
<div className="flex flex-col gap-6 p-4 w-full max-w-6xl"> <>
<header className="flex items-center justify-between"> <header className="flex items-center justify-between">
<h2 className="text-3xl font-bold tracking-tight">You have {files.length} unsorted files</h2> <h2 className="text-3xl font-bold tracking-tight">You have {files.length} unsorted files</h2>
{files.length > 1 && <AnalyzeAllButton />} {files.length > 1 && <AnalyzeAllButton />}
@@ -103,6 +103,6 @@ export default async function UnsortedPage() {
</div> </div>
)} )}
</main> </main>
</div> </>
) )
} }

View File

@@ -3,20 +3,20 @@
import { useNotification } from "@/app/(app)/context" import { useNotification } from "@/app/(app)/context"
import { analyzeFileAction, deleteUnsortedFileAction, saveFileAsTransactionAction } from "@/app/(app)/unsorted/actions" import { analyzeFileAction, deleteUnsortedFileAction, saveFileAsTransactionAction } from "@/app/(app)/unsorted/actions"
import { CurrencyConverterTool } from "@/components/agents/currency-converter" import { CurrencyConverterTool } from "@/components/agents/currency-converter"
import { ItemsDetectTool } from "@/components/agents/items-detect"
import ToolWindow from "@/components/agents/tool-window"
import { FormError } from "@/components/forms/error" import { FormError } from "@/components/forms/error"
import { FormSelectCategory } from "@/components/forms/select-category" import { FormSelectCategory } from "@/components/forms/select-category"
import { FormSelectCurrency } from "@/components/forms/select-currency" import { FormSelectCurrency } from "@/components/forms/select-currency"
import { FormSelectProject } from "@/components/forms/select-project" import { FormSelectProject } from "@/components/forms/select-project"
import { FormSelectType } from "@/components/forms/select-type" import { FormSelectType } from "@/components/forms/select-type"
import { FormInput, FormTextarea } from "@/components/forms/simple" import { FormInput, FormTextarea } from "@/components/forms/simple"
import { Badge } from "@/components/ui/badge"
import { Button } from "@/components/ui/button" import { Button } from "@/components/ui/button"
import { Category, Currency, Field, File, Project } from "@/prisma/client" import { Category, Currency, Field, File, Project } from "@/prisma/client"
import { format } from "date-fns" import { format } from "date-fns"
import { Brain, Loader2, Trash2, ArrowDownToLine } from "lucide-react" import { ArrowDownToLine, Brain, Loader2, Trash2 } from "lucide-react"
import { startTransition, useActionState, useMemo, useState } from "react" import { startTransition, useActionState, useMemo, useState } from "react"
import ToolWindow from "@/components/agents/tool-window"
import { ItemsDetectTool } from "@/components/agents/items-detect"
import { Badge } from "@/components/ui/badge"
export default function AnalyzeForm({ export default function AnalyzeForm({
file, file,
@@ -309,7 +309,7 @@ export default function AnalyzeForm({
)} )}
<div className="hidden"> <div className="hidden">
<input type="text" name="items" defaultValue={JSON.stringify(formData.items)} /> <input type="text" name="items" value={JSON.stringify(formData.items)} readOnly />
<FormTextarea <FormTextarea
title={fieldMap.text.name} title={fieldMap.text.name}
name="text" name="text"