Fix whitescreen - add missing types, exports and props

Frontend build fixes:
- Add formatDateTimeISO and parseISODate to formatters.ts
- Add default type parameter to fetchGraphQL function
- Add toggleMobileDrawer and mobileDrawerOpen to uiStore
- Add compact prop to CompanySwitcher component
- Add JournalEntryDraft types to accounting.ts
- Add reopened/locked fields to FiscalYear type
- Fix documentProcessing.ts import

Closes books-0rs

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Nicolaj Hartmann 2026-01-30 22:24:36 +01:00
parent 381156ade7
commit 88bf4c4450
8 changed files with 107 additions and 5 deletions

View file

@ -33,7 +33,7 @@ export const queryClient = new QueryClient({
});
// Helper function to make GraphQL requests with error handling
export async function fetchGraphQL<TData, TVariables extends Record<string, unknown>>(
export async function fetchGraphQL<TData, TVariables extends Record<string, unknown> = Record<string, unknown>>(
query: string,
variables?: TVariables
): Promise<TData> {

View file

@ -6,6 +6,10 @@ import type { Company } from '@/types/accounting';
const { Text } = Typography;
interface CompanySwitcherProps {
compact?: boolean;
}
// Mock data - will be replaced with API call
const mockCompanies: Company[] = [
{
@ -36,7 +40,7 @@ const mockCompanies: Company[] = [
},
];
export default function CompanySwitcher() {
export default function CompanySwitcher({ compact = false }: CompanySwitcherProps) {
const { activeCompany, setActiveCompany, setCompanies } = useCompanyStore();
// Initialize with mock data if needed
@ -62,7 +66,7 @@ export default function CompanySwitcher() {
<Select
value={activeCompany?.id}
onChange={handleCompanyChange}
style={{ minWidth: 280 }}
style={{ minWidth: compact ? 150 : 280 }}
optionLabelProp="label"
popupMatchSelectWidth={false}
options={companies.map((company) => ({

View file

@ -200,3 +200,19 @@ export function decodeHtmlEntities(text: string): string {
textarea.innerHTML = text;
return textarea.value;
}
/**
* Format a datetime in ISO format for API requests
*/
export function formatDateTimeISO(date: string | Date): string {
return dayjs(date).toISOString();
}
/**
* Parse an ISO date string to dayjs object
* Returns null if the input is null/undefined/empty
*/
export function parseISODate(date: string | null | undefined): import('dayjs').Dayjs | null {
if (!date) return null;
return dayjs(date);
}

View file

@ -156,7 +156,7 @@ export function generateVATPeriods(
*/
export function getPeriodDisplayName(
startDate: string,
endDate: string,
_endDate: string,
frequency: PeriodFrequency
): { name: string; shortName: string } {
const start = dayjs(startDate);

View file

@ -5,6 +5,9 @@ interface UIState {
// Sidebar
sidebarCollapsed: boolean;
// Mobile drawer
mobileDrawerOpen: boolean;
// Theme
darkMode: boolean;
@ -14,6 +17,8 @@ interface UIState {
// Actions
toggleSidebar: () => void;
setSidebarCollapsed: (collapsed: boolean) => void;
toggleMobileDrawer: () => void;
setMobileDrawerOpen: (open: boolean) => void;
toggleDarkMode: () => void;
addNotification: (notification: Omit<Notification, 'id'>) => void;
removeNotification: (id: string) => void;
@ -32,6 +37,7 @@ export const useUIStore = create<UIState>()(
persist(
(set) => ({
sidebarCollapsed: false,
mobileDrawerOpen: false,
darkMode: false,
notifications: [],
@ -41,6 +47,12 @@ export const useUIStore = create<UIState>()(
setSidebarCollapsed: (collapsed) =>
set({ sidebarCollapsed: collapsed }),
toggleMobileDrawer: () =>
set((state) => ({ mobileDrawerOpen: !state.mobileDrawerOpen })),
setMobileDrawerOpen: (open) =>
set({ mobileDrawerOpen: open }),
toggleDarkMode: () =>
set((state) => ({ darkMode: !state.darkMode })),

View file

@ -209,3 +209,65 @@ export interface UserCompanyAccess {
export interface CompanyWithRole extends Company {
role: CompanyRole;
}
// Journal Entry Draft types
export type JournalEntryDraftStatus = 'draft' | 'pending_review' | 'approved' | 'posted' | 'discarded';
export interface JournalEntryDraftLine {
lineNumber: number;
accountId: string;
debitAmount: number;
creditAmount: number;
description?: string;
vatCode?: string;
}
export interface JournalEntryDraft {
id: string;
companyId: string;
name: string;
voucherNumber?: string;
documentDate?: string;
description?: string;
fiscalYearId?: string;
lines: JournalEntryDraftLine[];
attachmentIds: string[];
status: JournalEntryDraftStatus;
transactionId?: string;
createdBy: string;
createdAt: string;
updatedAt: string;
}
export interface CreateJournalEntryDraftInput {
companyId: string;
name: string;
voucherNumber?: string;
documentDate?: string;
description?: string;
fiscalYearId?: string;
}
export interface UpdateJournalEntryDraftInput {
id: string;
name?: string;
voucherNumber?: string;
documentDate?: string;
description?: string;
fiscalYearId?: string;
lines?: JournalEntryDraftLine[];
attachmentIds?: string[];
}
// Account balance type
export interface AccountBalance {
id: string;
accountNumber: string;
name: string;
accountType: AccountType;
isActive: boolean;
totalDebits: number;
totalCredits: number;
netChange: number;
entryCount: number;
}

View file

@ -48,6 +48,14 @@ export interface FiscalYear {
closedBy?: string; // User who closed the year
openingBalancePosted: boolean;
// Reopen tracking
reopenedDate?: string; // When year was reopened
reopenedBy?: string; // User who reopened the year
// Lock tracking
lockedDate?: string; // When year was locked
lockedBy?: string; // User who locked the year
// Metadata
createdAt: string;
updatedAt: string;

View file

@ -1 +1 @@
{"root":["./src/app.tsx","./src/main.tsx","./src/routes.tsx","./src/vite-env.d.ts","./src/api/client.ts","./src/api/documentprocessing.ts","./src/api/mutations/accountmutations.ts","./src/api/mutations/bankconnectionmutations.ts","./src/api/mutations/companymutations.ts","./src/api/mutations/customermutations.ts","./src/api/mutations/draftmutations.ts","./src/api/mutations/fiscalyearmutations.ts","./src/api/mutations/invoicemutations.ts","./src/api/mutations/ordermutations.ts","./src/api/mutations/productmutations.ts","./src/api/mutations/saftmutations.ts","./src/api/queries/accountqueries.ts","./src/api/queries/bankconnectionqueries.ts","./src/api/queries/banktransactionqueries.ts","./src/api/queries/companyqueries.ts","./src/api/queries/customerqueries.ts","./src/api/queries/draftqueries.ts","./src/api/queries/fiscalyearqueries.ts","./src/api/queries/invoicequeries.ts","./src/api/queries/orderqueries.ts","./src/api/queries/productqueries.ts","./src/api/queries/vatqueries.ts","./src/components/auth/companyguard.tsx","./src/components/auth/protectedroute.tsx","./src/components/bank-reconciliation/documentuploadmodal.tsx","./src/components/company/useraccessmanager.tsx","./src/components/kassekladde/balanceimpactpanel.tsx","./src/components/layout/applayout.tsx","./src/components/layout/companyswitcher.tsx","./src/components/layout/fiscalyearselector.tsx","./src/components/layout/header.tsx","./src/components/layout/sidebar.tsx","./src/components/modals/closefiscalyearwizard.tsx","./src/components/modals/createfiscalyearmodal.tsx","./src/components/settings/bankconnectionstab.tsx","./src/components/shared/amounttext.tsx","./src/components/shared/attachmentupload.tsx","./src/components/shared/commandpalette.tsx","./src/components/shared/confirmationmodal.tsx","./src/components/shared/demodatadisclaimer.tsx","./src/components/shared/emptystate.tsx","./src/components/shared/errorboundary.tsx","./src/components/shared/fullpagedropzone.tsx","./src/components/shared/hotkeyprovider.tsx","./src/components/shared/isodatepicker.tsx","./src/components/shared/pageheader.tsx","./src/components/shared/periodfilter.tsx","./src/components/shared/shortcuttooltip.tsx","./src/components/shared/shortcutshelpmodal.tsx","./src/components/shared/skeletonloader.tsx","./src/components/shared/statisticcard.tsx","./src/components/shared/statusbadge.tsx","./src/components/shared/index.ts","./src/components/tables/datatable.tsx","./src/hooks/useautosave.ts","./src/hooks/usecompany.ts","./src/hooks/usedatatable.ts","./src/hooks/usepagehotkeys.ts","./src/hooks/useperiod.ts","./src/hooks/useresponsivemodal.ts","./src/lib/accounting.ts","./src/lib/errorhandling.ts","./src/lib/fiscalyear.ts","./src/lib/formatters.ts","./src/lib/keyboardshortcuts.ts","./src/lib/periods.ts","./src/lib/vatcalculation.ts","./src/lib/vatcodes.ts","./src/pages/admin.tsx","./src/pages/bankafstemning.tsx","./src/pages/companysetupwizard.tsx","./src/pages/dashboard.tsx","./src/pages/eksport.tsx","./src/pages/fakturaer.tsx","./src/pages/kassekladde.tsx","./src/pages/kontooversigt.tsx","./src/pages/kreditnotaer.tsx","./src/pages/kunder.tsx","./src/pages/loenforstaelse.tsx","./src/pages/momsindberetning.tsx","./src/pages/ordrer.tsx","./src/pages/produkter.tsx","./src/pages/settings.tsx","./src/pages/usersettings.tsx","./src/services/authservice.ts","./src/stores/authstore.ts","./src/stores/companystore.ts","./src/stores/hotkeystore.ts","./src/stores/periodstore.ts","./src/stores/reconciliationstore.ts","./src/stores/uistore.ts","./src/styles/designtokens.ts","./src/styles/theme.ts","./src/types/accounting.ts","./src/types/api.ts","./src/types/order.ts","./src/types/periods.ts","./src/types/product.ts","./src/types/ui.ts","./src/types/vat.ts"],"errors":true,"version":"5.6.3"}
{"root":["./src/app.tsx","./src/main.tsx","./src/routes.tsx","./src/vite-env.d.ts","./src/api/client.ts","./src/api/documentprocessing.ts","./src/api/mutations/accountmutations.ts","./src/api/mutations/bankconnectionmutations.ts","./src/api/mutations/companymutations.ts","./src/api/mutations/customermutations.ts","./src/api/mutations/draftmutations.ts","./src/api/mutations/fiscalyearmutations.ts","./src/api/mutations/invoicemutations.ts","./src/api/mutations/ordermutations.ts","./src/api/mutations/productmutations.ts","./src/api/mutations/saftmutations.ts","./src/api/queries/accountqueries.ts","./src/api/queries/bankconnectionqueries.ts","./src/api/queries/banktransactionqueries.ts","./src/api/queries/companyqueries.ts","./src/api/queries/customerqueries.ts","./src/api/queries/draftqueries.ts","./src/api/queries/fiscalyearqueries.ts","./src/api/queries/invoicequeries.ts","./src/api/queries/orderqueries.ts","./src/api/queries/productqueries.ts","./src/api/queries/vatqueries.ts","./src/components/auth/companyguard.tsx","./src/components/auth/protectedroute.tsx","./src/components/bank-reconciliation/documentuploadmodal.tsx","./src/components/company/useraccessmanager.tsx","./src/components/kassekladde/balanceimpactpanel.tsx","./src/components/layout/applayout.tsx","./src/components/layout/companyswitcher.tsx","./src/components/layout/fiscalyearselector.tsx","./src/components/layout/header.tsx","./src/components/layout/sidebar.tsx","./src/components/modals/closefiscalyearwizard.tsx","./src/components/modals/createfiscalyearmodal.tsx","./src/components/settings/bankconnectionstab.tsx","./src/components/shared/amounttext.tsx","./src/components/shared/attachmentupload.tsx","./src/components/shared/commandpalette.tsx","./src/components/shared/confirmationmodal.tsx","./src/components/shared/demodatadisclaimer.tsx","./src/components/shared/emptystate.tsx","./src/components/shared/errorboundary.tsx","./src/components/shared/fullpagedropzone.tsx","./src/components/shared/hotkeyprovider.tsx","./src/components/shared/isodatepicker.tsx","./src/components/shared/pageheader.tsx","./src/components/shared/periodfilter.tsx","./src/components/shared/shortcuttooltip.tsx","./src/components/shared/shortcutshelpmodal.tsx","./src/components/shared/skeletonloader.tsx","./src/components/shared/statisticcard.tsx","./src/components/shared/statusbadge.tsx","./src/components/shared/index.ts","./src/components/tables/datatable.tsx","./src/hooks/useautosave.ts","./src/hooks/usecompany.ts","./src/hooks/usedatatable.ts","./src/hooks/usepagehotkeys.ts","./src/hooks/useperiod.ts","./src/hooks/useresponsivemodal.ts","./src/lib/accounting.ts","./src/lib/errorhandling.ts","./src/lib/fiscalyear.ts","./src/lib/formatters.ts","./src/lib/keyboardshortcuts.ts","./src/lib/periods.ts","./src/lib/vatcalculation.ts","./src/lib/vatcodes.ts","./src/pages/admin.tsx","./src/pages/bankafstemning.tsx","./src/pages/companysetupwizard.tsx","./src/pages/dashboard.tsx","./src/pages/eksport.tsx","./src/pages/fakturaer.tsx","./src/pages/kassekladde.tsx","./src/pages/kontooversigt.tsx","./src/pages/kreditnotaer.tsx","./src/pages/kunder.tsx","./src/pages/loenforstaelse.tsx","./src/pages/momsindberetning.tsx","./src/pages/ordrer.tsx","./src/pages/produkter.tsx","./src/pages/settings.tsx","./src/pages/usersettings.tsx","./src/services/authservice.ts","./src/stores/authstore.ts","./src/stores/companystore.ts","./src/stores/hotkeystore.ts","./src/stores/periodstore.ts","./src/stores/reconciliationstore.ts","./src/stores/uistore.ts","./src/styles/designtokens.ts","./src/styles/theme.ts","./src/types/accounting.ts","./src/types/api.ts","./src/types/order.ts","./src/types/periods.ts","./src/types/product.ts","./src/types/ui.ts","./src/types/vat.ts"],"version":"5.6.3"}