import { FilePreview } from "@/components/files/preview" import { UploadButton } from "@/components/files/upload-button" import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert" import { Button } from "@/components/ui/button" import { Card } from "@/components/ui/card" import AnalyzeForm from "@/components/unsorted/analyze-form" import { getCurrentUser } from "@/lib/auth" import { IS_SELF_HOSTED_MODE } from "@/lib/constants" import { getCategories } from "@/models/categories" import { getCurrencies } from "@/models/currencies" import { getFields } from "@/models/fields" import { getUnsortedFiles } from "@/models/files" import { getProjects } from "@/models/projects" import { getSettings } from "@/models/settings" import { FileText, PartyPopper, Settings, Upload } from "lucide-react" import { Metadata } from "next" import Link from "next/link" export const metadata: Metadata = { title: "Unsorted", description: "Analyze unsorted files", } export default async function UnsortedPage() { const user = await getCurrentUser() const files = await getUnsortedFiles(user.id) const categories = await getCategories(user.id) const projects = await getProjects(user.id) const currencies = await getCurrencies(user.id) const fields = await getFields(user.id) const settings = await getSettings(user.id) return ( <> You have {files.length} unsorted files {IS_SELF_HOSTED_MODE && !settings.openai_api_key && ( ChatGPT API Key is required for analyzing files Please set your OpenAI API key in the settings to use the analyze form. Go to Settings )} {files.map((file) => ( ))} {files.length == 0 && ( Everything is clear! Congrats! Drag and drop new files here to analyze Upload New File Go to Transactions )} > ) }
Everything is clear! Congrats!
Drag and drop new files here to analyze