- Add transactions_dirty table and zero-tolerance cleansing action - Implement bookkeeping workbench (/bookkeeping) with searchable Combobox channel selector and card suffix / account identifier - Implement transaction ledger (/transactions) with date groupings, multi-currency metrics, and filters - Update AGENTS.md guidelines for Base UI Select and Combobox bindings
52 lines
1.4 KiB
TypeScript
52 lines
1.4 KiB
TypeScript
import { redirect } from "next/navigation"
|
|
import { auth } from "@/lib/auth"
|
|
import { getDirtyTransactionsAction } from "@/lib/actions/bookkeeping"
|
|
import { getChannelsAction } from "@/lib/actions/channel"
|
|
import { AppSidebar } from "@/components/app-sidebar"
|
|
import { AppHeader } from "@/components/app-header"
|
|
import { SidebarInset, SidebarProvider } from "@/components/ui/sidebar"
|
|
import { BookkeepingView } from "./bookkeeping-view"
|
|
|
|
export default async function BookkeepingPage() {
|
|
const session = await auth()
|
|
|
|
if (!session?.user) {
|
|
redirect("/login")
|
|
}
|
|
|
|
const user = session.user
|
|
const userName = user.name || "Fluxent 用户"
|
|
const userEmail = user.email || ""
|
|
const userAvatar = user.image || null
|
|
|
|
const [dirtyTxnsRes, channelsRes] = await Promise.all([
|
|
getDirtyTransactionsAction(),
|
|
getChannelsAction(),
|
|
])
|
|
|
|
const initialDirtyTransactions =
|
|
dirtyTxnsRes.success && dirtyTxnsRes.data ? dirtyTxnsRes.data : []
|
|
const initialChannels =
|
|
channelsRes.success && channelsRes.data ? channelsRes.data : []
|
|
|
|
return (
|
|
<SidebarProvider>
|
|
<AppSidebar
|
|
user={{
|
|
name: userName,
|
|
email: userEmail,
|
|
avatar: userAvatar,
|
|
}}
|
|
/>
|
|
<SidebarInset>
|
|
<AppHeader title="流水记账" />
|
|
|
|
<BookkeepingView
|
|
initialDirtyTransactions={initialDirtyTransactions}
|
|
initialChannels={initialChannels}
|
|
/>
|
|
</SidebarInset>
|
|
</SidebarProvider>
|
|
)
|
|
}
|