Files
F-r-ldraledigplannerare/frontend/src/utils/members.ts
T
jacobh2 ae6db7e16f Redesign the setup flow and consolidate the CSS into one primitives layer
Onboarding asks explicitly for one or two parents and shows one card per
parent for balances; the balance form is per parent with inline
validation; the partner can be filled from the FK deduction or added
from it. Settings and Dashboard reuse the same form.

CSS: bare buttons carry no colour any more; buttons, cards, choice
cards, fields, alerts, badges, eyebrow and modal chrome are defined once
in primitives.css. Media queries live only in responsive.css. A style
guard test blocks hex, !important and stray media queries. Bilingual
fixes: calendar selects size by content, header no longer wraps. Vitest
is capped at four workers.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-19 12:27:29 +02:00

23 lines
856 B
TypeScript

import type { PersonalData } from '@/types'
/** True when `member` is the signed-in user identified by `personalDataUuid`. */
export function isSelf(member: PersonalData, personalDataUuid: string | null): boolean {
return personalDataUuid !== null && member.uuid === personalDataUuid
}
/**
* Stable-sorts `members` so the signed-in user (if present among them) comes
* first, leaving every other member in their original relative order.
*
* Used to put "your" `ParentBalanceForm` ahead of a partner's in any UI that
* lists both — see `ParentBalanceForm.tsx`.
*/
export function orderSelfFirst(
members: PersonalData[],
personalDataUuid: string | null,
): PersonalData[] {
const self = members.filter((m) => isSelf(m, personalDataUuid))
const others = members.filter((m) => !isSelf(m, personalDataUuid))
return [...self, ...others]
}