SchedulePreview
- Status
- Implemented
- Family
- 9 of 13
- Registry
- @lopifi/schedule-preview
npx shadcn@latest add @lopifi/theme @lopifi/schedule-previewThe component, rendering
Real data, the shipped component. Switch the theme to check the claims the spec makes below.
The four-layer spec
Every entry the period's schedules will generate — amortization, depreciation, recognition, straight-line lease expense — with totals, before anything posts. A close should never be surprised by its own automation. Posts as one batch with one audit record.
Lifted verbatim from Accounting core (GL). The doc and this page are the same paragraphs, so they cannot disagree.
What lands in your repository
One component is never one file. Everything below is copied into your project, where you own it.
- Files
components/ledger/schedule-preview.tsx
- npm packages
- @base-ui-components/reactclass-variance-authorityclsxtailwind-merge
- Registry entry
- /r/schedule-preview.json
The whole component
No compiled bundle, no black box. This is the file the registry copies, and the file you will edit.
"use client";
import { useScrollEdges } from "@/hooks/ledger/use-scroll-edges";
import { cn } from "@/lib/ledger/cn";
import { formatDate } from "@/lib/ledger/fiscal-period";
import type { MoneyValue } from "@/lib/ledger/money.types";
import { Button } from "@/components/ledger/button";
import { Money } from "@/components/ledger/money";
import { Rule } from "@/components/ledger/rule";
export type PreviewEntry = {
id: string;
schedule: string;
description: string;
debitAccount: string;
creditAccount: string;
amount: MoneyValue;
};
export interface SchedulePreviewProps {
className?: string;
entries: PreviewEntry[];
/** Caps the scroller so the header and the schedule column can freeze. */
maxHeight?: number;
onPostBatch?: () => void;
periodEnd: Date;
total: MoneyValue;
}
/**
* Every entry the period's schedules will generate, with totals, **before**
* anything posts. A close should never be surprised by its own automation.
*
* Posts as one batch with one audit record.
*/
export function SchedulePreview({
periodEnd,
entries,
total,
onPostBatch,
maxHeight = 520,
className,
}: SchedulePreviewProps) {
const scroller = useScrollEdges<HTMLDivElement>();
return (
<div className={cn("space-y-3", className)}>
<div className="rounded-xl border border-border bg-surface">
<div className="px-6 pb-4 pt-6">
<p className="text-title-sm font-medium">Schedule entries to be posted</p>
<p className="text-caption text-text-secondary">
Period ending {formatDate(periodEnd)} · nothing has posted yet
</p>
</div>
<div className="ledger-frozen scrollbar-thin" ref={scroller} style={{ maxHeight }}>
<table className="w-full min-w-[820px]">
<caption className="sr-only">
Schedule entries to be posted for the period ending {formatDate(periodEnd)}
</caption>
<thead>
<tr className="border-b border-border-subtle">
{["Schedule", "Description", "Debit", "Credit", "Amount"].map((h, i) => (
<th
className={cn(
"px-3 py-3 text-label font-medium text-text-secondary",
i === 4 ? "pr-6 text-right" : "text-left",
i === 0 && "pl-6",
)}
key={h}
scope="col"
>
{h}
</th>
))}
</tr>
</thead>
<tbody>
{entries.map((e) => (
<tr className="border-b border-border-subtle" key={e.id}>
<td className="py-3 pl-6 pr-3 text-caption capitalize text-text-secondary">{e.schedule}</td>
<th className="px-3 py-3 text-left text-body font-normal" scope="row">
{e.description}
</th>
<td className="px-3 py-3 text-caption text-text-secondary">{e.debitAccount}</td>
<td className="px-3 py-3 text-caption text-text-secondary">{e.creditAccount}</td>
<td className="py-3 pl-3 pr-6 text-right">
<Money accounting value={e.amount} />
</td>
</tr>
))}
</tbody>
<tfoot>
<tr>
<td colSpan={4} />
<td className="pr-6">
<Rule variant="subtotal" />
</td>
</tr>
<tr>
<th
className="py-3 pl-6 pr-3 text-left text-label font-medium"
colSpan={4}
data-frozen="none"
scope="row"
>
Total to post
</th>
<td className="py-3 pl-3 pr-6 text-right">
<Money accounting size="md" value={total} />
</td>
</tr>
<tr>
<td colSpan={4} />
<td className="pr-6">
<Rule variant="total" />
</td>
</tr>
</tfoot>
</table>
</div>
</div>
<Button onClick={onPostBatch} variant="primary">
Post {entries.length} entries as one batch
</Button>
<p className="text-caption text-text-tertiary">
Posting creates one audit record covering the whole batch.
</p>
</div>
);
}
The accounting it encodes
Concepts this component renders. Each one is defined once, in the lexicon, and used identically in the code and the copy.
Also in Accounting core (GL)
- JournalEntryDebit and credit as two columns. No signed-column variant.
- JournalEntryFormLine grid with live balance check and dimension capture.
- JournalEntryTableAll entries, with the gapless-numbering check.
- AccountPickerShows the normal balance. Blocks non-postable accounts.
- ChartOfAccountsHierarchy, statement mapping, unsupported-account flags.
- AccountRegisterGL detail with a running balance.
- DimensionPickerEntity always required; renders what the account demands.
- AdjustingEntryFormTemplated by type. Auto-reverse defaults on for accruals.
- RecurringEntryTemplateTemplate editable; instances read-only.
- EntryReversalDialogHold-to-confirm. Never a delete.
- ScheduleTableOne shell, seven presets. Prepaids through debt.
- RollForwardOpening → movements → closing → tie. The universal shape.
- AccountTieOutEvery BS account, proven against its evidence.
- RevenueWaterfallDeferred balance recognizing by future period.
- DepreciationScheduleBook and tax in parallel. In-service date, not purchase date.
- LeaseScheduleROU asset and liability on diverging curves.
- AllowanceRollForwardWith the methodology shown, not just the number.
See also
A component is specified in one place, defined in another, and running in a third. All three, from here.
- Accounting core (GL) — the family specThe four-layer specification this component was built against, before it was written.Doc
- General ledger and accounting coreThe family running, with real figures in it, in both themes and at every density.Live
- CatalogAll 179 components, specified before they are written.Doc
- AmortizationSpreading the cost of a finite-lived intangible, a prepaid or a debt discount over the periods it servesTerm
Elsewhere in the system
Where SchedulePreview sits in the rest of the system — the live section it renders in, the calculators that compute what it displays, and the ledger payloads it is fed from.
- SchedulePreview, runningThe gl showcase — live, with theme, density, greyscale and reduced-motion switches.Live
- Prepaid & deferred releaseA premium paid on the 17th does not release in twelve equal slices. Day-weighted, or even — your call.Tool
- Accounting core (GL)The general ledger layer. Specs for 18 React components: JournalEntry, JournalEntryForm, JournalEntryTable, AccountPicker and 14 more.Doc
Components are copied into your repository and meant to be edited — rounding policy, fiscal calendar and compliance copy differ per company.
Told when Accounting core (GL) changes
Components are copied into your repo, so a fix here does not reach you on its own. One email when a component in this family changes in a way that needs a migration — and nothing when it does not.