diff options
Diffstat (limited to 'src/components/expense-form.tsx')
| -rw-r--r-- | src/components/expense-form.tsx | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/components/expense-form.tsx b/src/components/expense-form.tsx index fd3f6e2..a7e549c 100644 --- a/src/components/expense-form.tsx +++ b/src/components/expense-form.tsx @@ -35,6 +35,7 @@ import { SelectValue, } from '@/components/ui/select' import { getCategories, getExpense, getGroup, randomId } from '@/lib/api' +import { RuntimeFeatureFlags } from '@/lib/featureFlags' import { ExpenseFormValues, expenseFormSchema } from '@/lib/schemas' import { cn } from '@/lib/utils' import { zodResolver } from '@hookform/resolvers/zod' @@ -52,6 +53,7 @@ export type Props = { categories: NonNullable<Awaited<ReturnType<typeof getCategories>>> onSubmit: (values: ExpenseFormValues) => Promise<void> onDelete?: () => Promise<void> + runtimeFeatureFlags: RuntimeFeatureFlags } export function ExpenseForm({ @@ -60,6 +62,7 @@ export function ExpenseForm({ categories, onSubmit, onDelete, + runtimeFeatureFlags, }: Props) { const isCreate = expense === undefined const searchParams = useSearchParams() @@ -161,7 +164,7 @@ export function ExpenseForm({ {...field} onBlur={async () => { field.onBlur() // avoid skipping other blur event listeners since we overwrite `field` - if (process.env.NEXT_PUBLIC_ENABLE_CATEGORY_EXTRACT) { + if (runtimeFeatureFlags.enableCategoryExtract) { setCategoryLoading(true) const { categoryId } = await extractCategoryFromTitle( field.value, @@ -541,7 +544,7 @@ export function ExpenseForm({ </CardContent> </Card> - {process.env.NEXT_PUBLIC_ENABLE_EXPENSE_DOCUMENTS && ( + {runtimeFeatureFlags.enableExpenseDocuments && ( <Card className="mt-4"> <CardHeader> <CardTitle className="flex justify-between"> |
