mirror of
https://github.com/marcogll/TaxHacker_s23.git
synced 2026-01-13 21:35:19 +00:00
feat: button to hide welcome msg
This commit is contained in:
@@ -18,7 +18,7 @@ export async function saveSettingsAction(prevState: any, formData: FormData) {
|
||||
}
|
||||
|
||||
for (const key in validatedForm.data) {
|
||||
await updateSettings(key, validatedForm.data[key as keyof typeof validatedForm.data] || "")
|
||||
await updateSettings(key, validatedForm.data[key as keyof typeof validatedForm.data])
|
||||
}
|
||||
|
||||
revalidatePath("/settings")
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { Button } from "@/components/ui/button"
|
||||
import { Card, CardDescription, CardTitle } from "@/components/ui/card"
|
||||
import { getSettings } from "@/data/settings"
|
||||
import { Banknote, ChartBarStacked, FolderOpenDot, Key, TextCursorInput } from "lucide-react"
|
||||
import { getSettings, updateSettings } from "@/data/settings"
|
||||
import { Banknote, ChartBarStacked, FolderOpenDot, Key, TextCursorInput, X } from "lucide-react"
|
||||
import { revalidatePath } from "next/cache"
|
||||
import Link from "next/link"
|
||||
|
||||
export async function WelcomeWidget() {
|
||||
@@ -11,7 +12,20 @@ export async function WelcomeWidget() {
|
||||
<Card className="flex flex-col md:flex-row items-start gap-10 p-10 w-full">
|
||||
<img src="/logo/1024.png" alt="Logo" className="w-64 h-64" />
|
||||
<div className="flex flex-col">
|
||||
<CardTitle className="text-2xl font-bold">Hey, I'm TaxHacker 👋</CardTitle>
|
||||
<CardTitle className="flex items-center justify-between">
|
||||
<span className="text-2xl font-bold">Hey, I'm TaxHacker 👋</span>
|
||||
<Button
|
||||
variant="outline"
|
||||
size="icon"
|
||||
onClick={async () => {
|
||||
"use server"
|
||||
await updateSettings("is_welcome_message_hidden", "true")
|
||||
revalidatePath("/")
|
||||
}}
|
||||
>
|
||||
<X className="h-4 w-4" />
|
||||
</Button>
|
||||
</CardTitle>
|
||||
<CardDescription className="mt-5">
|
||||
<p className="mb-3">
|
||||
I'm a little accountant app that tries to help you deal with endless receipts, checks and invoices with (you
|
||||
|
||||
@@ -118,7 +118,7 @@ export function ExportTransactionsDialog({
|
||||
<div className="grid grid-cols-2 gap-2">
|
||||
{fields.map((field) => (
|
||||
<div key={field.code} className="inline-flex gap-2">
|
||||
<label className="flex gap-1">
|
||||
<label className="flex items-center gap-1">
|
||||
<input
|
||||
type="checkbox"
|
||||
name={field.code}
|
||||
|
||||
@@ -11,7 +11,8 @@ export const getSettings = cache(async (): Promise<SettingsMap> => {
|
||||
}, {} as SettingsMap)
|
||||
})
|
||||
|
||||
export const updateSettings = cache(async (code: string, value: string) => {
|
||||
export const updateSettings = cache(async (code: string, value?: any) => {
|
||||
console.log("updateSettings", code, value)
|
||||
return await prisma.setting.upsert({
|
||||
where: { code },
|
||||
update: { value },
|
||||
|
||||
@@ -8,4 +8,5 @@ export const settingsFormSchema = z.object({
|
||||
default_project: z.string().optional(),
|
||||
openai_api_key: z.string().optional(),
|
||||
prompt_analyse_new_file: z.string().optional(),
|
||||
is_welcome_message_hidden: z.boolean().optional(),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user