Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/backend/src/activity/activity.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,4 @@ export class ActivityService {
nextCursor: events.length === safeLimit ? safeCursor + safeLimit : null,
};
}
}
}
13 changes: 1 addition & 12 deletions apps/web/src/components/groups/RecurringExpenseList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,6 @@ function formatGeneratedLabel(lastGeneratedAt?: string | null): string {
return `Last generated ${new Date(lastGeneratedAt).toLocaleDateString()}`;
}

/**
* Renders a UI list of recurring bills with edit and remove capabilities.
*
* Displays grouped sections (overdue, today, upcoming), per-item status, next run date, payer, generated info, and formatted amount.
*
* @param recurringExpenses - Array of recurring expense DTOs to display
* @param members - Group member summaries used to resolve payer names
* @param currency - Currency code used to format displayed amounts
* @param onChanged - Optional callback invoked after a successful update or removal
* @returns The React element for the recurring expenses list
*/
export function RecurringExpenseList({ recurringExpenses, members, currency, onChanged }: RecurringExpenseListProps) {
const [removingId, setRemovingId] = useState<string | null>(null);
const [editingId, setEditingId] = useState<string | null>(null);
Expand Down Expand Up @@ -336,4 +325,4 @@ export function RecurringExpenseList({ recurringExpenses, members, currency, onC
</div>
</section>
);
}
}
19 changes: 2 additions & 17 deletions packages/shared-types/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@ const CURRENCY_SYMBOLS: Record<CurrencyCode, string> = {
INR: '₹',
};

/**
* Normalize a cents amount input into a trimmed string representing whole cents.
*
* @param amountCents - A `bigint`, `number`, or `string` representing cents. If a `number`, it must be an integer; if a `string`, surrounding whitespace will be trimmed.
* @returns The normalized string representation of whole cents.
* @throws Error if `amountCents` is a `number` that is not an integer.
*/
function normalizeCentsInput(amountCents: bigint | number | string): string {
if (typeof amountCents === 'bigint') {
return amountCents.toString();
Expand All @@ -26,19 +19,11 @@ function normalizeCentsInput(amountCents: bigint | number | string): string {

const trimmed = amountCents.trim();
if (!/^-?\d+$/.test(trimmed)) {
throw new Error('Currency formatter expects an integer-cent string.');
throw new Error('Currency formatter expects a valid integer string.');
}
return trimmed;
}

/**
* Format a whole-cents monetary value into a currency string with symbol, thousands separators, and two decimal places.
*
* @param amountCents - The amount in whole cents (`bigint | number | string`). If a `number` is provided it must be an integer; `string` inputs are trimmed.
* @param currency - The target currency code used to pick the symbol (defaults to `'USD'`).
* @returns The formatted currency string including the currency symbol, grouped thousands, a decimal point, and exactly two fractional digits; a leading `-` is preserved for negative values.
* @throws If `amountCents` is a `number` that is not an integer.
*/
export function formatCurrencyFromCents(amountCents: bigint | number | string, currency: CurrencyCode = 'USD'): string {
const normalized = normalizeCentsInput(amountCents);
const negative = normalized.startsWith('-');
Expand Down Expand Up @@ -335,4 +320,4 @@ export interface CreatePaymentIntentResponseDto {
paymentId: string;
clientSecret: string;
paymentIntentId: string;
}
}
3 changes: 2 additions & 1 deletion tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"esModuleInterop": true,
"resolveJsonModule": true,
"declaration": true,
"sourceMap": true
"sourceMap": true,
"ignoreDeprecations": "6.0"
}
}
Loading