mirror of
https://github.com/marcogll/TaxHacker_s23.git
synced 2026-01-13 13:25:18 +00:00
BREAKING: postgres + saas
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
"use client"
|
||||
|
||||
import { useNotification } from "@/app/context"
|
||||
import { uploadFilesAction } from "@/app/files/actions"
|
||||
import { useNotification } from "@/app/(app)/context"
|
||||
import { uploadFilesAction } from "@/app/(app)/files/actions"
|
||||
import { FormError } from "@/components/forms/error"
|
||||
import { FILE_ACCEPTED_MIMETYPES } from "@/lib/files"
|
||||
import { FILE_ACCEPTED_MIMETYPES } from "@/lib/constants"
|
||||
import { Camera, Loader2 } from "lucide-react"
|
||||
import { useRouter } from "next/navigation"
|
||||
import { startTransition, useState } from "react"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { FiltersWidget } from "@/components/dashboard/filters-widget"
|
||||
import { ProjectsWidget } from "@/components/dashboard/projects-widget"
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
|
||||
import { getCurrentUser } from "@/lib/auth"
|
||||
import { formatCurrency } from "@/lib/utils"
|
||||
import { getProjects } from "@/models/projects"
|
||||
import { getDashboardStats, getProjectStats } from "@/models/stats"
|
||||
@@ -8,11 +9,12 @@ import { TransactionFilters } from "@/models/transactions"
|
||||
import { ArrowDown, ArrowUp, BicepsFlexed } from "lucide-react"
|
||||
|
||||
export async function StatsWidget({ filters }: { filters: TransactionFilters }) {
|
||||
const projects = await getProjects()
|
||||
const stats = await getDashboardStats(filters)
|
||||
const user = await getCurrentUser()
|
||||
const projects = await getProjects(user.id)
|
||||
const stats = await getDashboardStats(user.id, filters)
|
||||
const statsPerProject = Object.fromEntries(
|
||||
await Promise.all(
|
||||
projects.map((project) => getProjectStats(project.code, filters).then((stats) => [project.code, stats]))
|
||||
projects.map((project) => getProjectStats(user.id, project.code, filters).then((stats) => [project.code, stats]))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -1,25 +1,30 @@
|
||||
import { Button } from "@/components/ui/button"
|
||||
import { Card, CardDescription, CardTitle } from "@/components/ui/card"
|
||||
import { ColoredText } from "@/components/ui/colored-text"
|
||||
import { getCurrentUser } from "@/lib/auth"
|
||||
import { getSettings, updateSettings } from "@/models/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() {
|
||||
const settings = await getSettings()
|
||||
const user = await getCurrentUser()
|
||||
const settings = await getSettings(user.id)
|
||||
|
||||
return (
|
||||
<Card className="flex flex-col md:flex-row items-start gap-10 p-10 w-full">
|
||||
<Card className="flex flex-col lg: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="flex items-center justify-between">
|
||||
<span className="text-2xl font-bold">Hey, I'm TaxHacker 👋</span>
|
||||
<span className="text-2xl font-bold">
|
||||
<ColoredText>Hey, I'm TaxHacker 👋</ColoredText>
|
||||
</span>
|
||||
<Button
|
||||
variant="outline"
|
||||
size="icon"
|
||||
onClick={async () => {
|
||||
"use server"
|
||||
await updateSettings("is_welcome_message_hidden", "true")
|
||||
await updateSettings(user.id, "is_welcome_message_hidden", "true")
|
||||
revalidatePath("/")
|
||||
}}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user