mirror of
https://github.com/marcogll/TaxHacker_s23.git
synced 2026-01-13 13:25:18 +00:00
feat: better exchange rate tool ux
This commit is contained in:
@@ -11,8 +11,10 @@ import { FormSelectType } from "@/components/forms/select-type"
|
||||
import { FormInput, FormTextarea } from "@/components/forms/simple"
|
||||
import { Button } from "@/components/ui/button"
|
||||
import { Category, Currency, Field, File, Project } from "@prisma/client"
|
||||
import { format } from "date-fns"
|
||||
import { Brain, Loader2 } from "lucide-react"
|
||||
import { startTransition, useActionState, useMemo, useState } from "react"
|
||||
import AgentWindow from "../agents/agent-window"
|
||||
|
||||
export default function AnalyzeForm({
|
||||
file,
|
||||
@@ -197,16 +199,16 @@ export default function AnalyzeForm({
|
||||
</div>
|
||||
|
||||
{formData.total != 0 && formData.currencyCode && formData.currencyCode !== settings.default_currency && (
|
||||
<>
|
||||
<AgentWindow title={`Exchange rate on ${format(new Date(formData.issuedAt || Date.now()), "LLLL dd, yyyy")}`}>
|
||||
<FormConvertCurrency
|
||||
originalTotal={formData.total}
|
||||
originalCurrencyCode={formData.currencyCode}
|
||||
targetCurrencyCode={settings.default_currency}
|
||||
date={formData.issuedAt ? new Date(formData.issuedAt) : undefined}
|
||||
date={new Date(formData.issuedAt || Date.now())}
|
||||
onChange={(value) => setFormData((prev) => ({ ...prev, convertedTotal: value }))}
|
||||
/>
|
||||
<input type="hidden" name="convertedCurrencyCode" value={settings.default_currency} />
|
||||
</>
|
||||
</AgentWindow>
|
||||
)}
|
||||
|
||||
<div className="flex flex-row gap-4">
|
||||
|
||||
Reference in New Issue
Block a user