Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

fix(assistant): an expense's or payment's note sits under its change row, not beside its buttons

Maurice436541780790
diff --git a/client/src/components/Assistant/cards/ChangeCardSlots.tsx b/client/src/components/Assistant/cards/ChangeCardSlots.tsx
index e0b159ee2..07641ec57 100644
--- a/client/src/components/Assistant/cards/ChangeCardSlots.tsx
+++ b/client/src/components/Assistant/cards/ChangeCardSlots.tsx
@@ -120,8 +120,8 @@ function ChangeHead({ item, view, struck }: { item: ChangeItem; view: View | nul
) : (
<SubjectLine subject={preview.subject} struck={struck} aside={view?.Aside && aside} />
)}
- <span className="mt-0.5 flex min-w-0 items-center gap-2.5 text-caption text-content-faint">
- <span className="truncate">{verbLabel(preview, t)}</span>
+ <span className="mt-0.5 flex min-w-0 flex-wrap items-center gap-x-2.5 gap-y-1 text-caption text-content-faint">
+ <span className="max-w-full truncate">{verbLabel(preview, t)}</span>
<DomainChip domain={preview.domain} />
<Slot item={item} view={view} name="Facts" />
</span>
diff --git a/client/src/components/Assistant/cards/budget/ExpenseChange.tsx b/client/src/components/Assistant/cards/budget/ExpenseChange.tsx
index 4fbef1858..884507073 100644
--- a/client/src/components/Assistant/cards/budget/ExpenseChange.tsx
+++ b/client/src/components/Assistant/cards/budget/ExpenseChange.tsx
@@ -14,7 +14,7 @@ import { Amount, NotePill, SplitLine } from './budgetParts';
* An expense inside a change row, waiting or decided: its amount at the end
* of the subject line (the one an update replaces struck through before it),
* its category, day and place on the faint line with what an update changes,
- * and under it the whole split, the part the user decides on. A run of new
+ * and under it the whole split, the part the user decides on, and its note. A run of new
* expenses in one currency says what they add up to.
*/
@@ -88,14 +88,20 @@ export function ExpenseFacts({ card }: SlotProps) {
/>
)}
{row.receipts > 0 && <Fact icon={Receipt} label={t('assistant.card.budget.receipts', { count: row.receipts })} />}
- {row.note && <NotePill note={row.note} />}
</>
);
}
+/** The split under the row, and the expense's note under it: too long for the faint line beside the icons. */
export function ExpenseBody({ card }: SlotProps) {
const row = card.rows[0];
- return row ? <SplitLine row={row} /> : null;
+ if (!row) return null;
+ return (
+ <span className="flex flex-col items-start gap-1">
+ <SplitLine row={row} />
+ {row.note && <NotePill note={row.note} />}
+ </span>
+ );
}
/** Under a run of waiting expenses: what the included ones add up to, when they are two or more in one currency. */
diff --git a/client/src/components/Assistant/cards/budget/ExpensesCard.test.tsx b/client/src/components/Assistant/cards/budget/ExpensesCard.test.tsx
index 6b72663ee..88806cafb 100644
--- a/client/src/components/Assistant/cards/budget/ExpensesCard.test.tsx
+++ b/client/src/components/Assistant/cards/budget/ExpensesCard.test.tsx
@@ -138,11 +138,17 @@ describe('an expense in a change row', () => {
expect(screen.getByText('Split unevenly')).toHaveClass('line-through');
expect(screen.getByText('Split evenly')).toBeInTheDocument();
expect(screen.getByText('1 receipt')).toBeInTheDocument();
- expect(screen.getByText('Window table')).toBeInTheDocument();
+ // The note is too long for the faint line beside the row's buttons: it sits under the row.
+ expect(screen.queryByText('Window table')).toBeNull();
fireEvent.click(screen.getByRole('button', { name: /Lokanta/ }));
expect(onOpen).toHaveBeenCalledWith({ kind: 'map', placeId: 12, dayId: null });
});
+ it('FE-AI-CARD-BUD-012b: the note of an expense sits under its split', () => {
+ inView(<ExpenseBody card={expenses([expense({ note: 'Window table' })])} item={changeItem('a', null)} />);
+ expect(screen.getByText('Window table')).toBeInTheDocument();
+ });
+
it('FE-AI-CARD-BUD-013: the split shows who paid and each part, paid ones green, the ones it is about in the accent', () => {
const split = expense({
payers: [{ person: BEN, amount: 84 }],
diff --git a/client/src/components/Assistant/cards/budget/PaymentsCard.test.tsx b/client/src/components/Assistant/cards/budget/PaymentsCard.test.tsx
index 9acffda77..ca3df3b33 100644
--- a/client/src/components/Assistant/cards/budget/PaymentsCard.test.tsx
+++ b/client/src/components/Assistant/cards/budget/PaymentsCard.test.tsx
@@ -72,6 +72,15 @@ describe('payments', () => {
expect(screen.getByRole('img', { name: 'Cleo' })).toBeInTheDocument();
});
+ it('FE-AI-CARD-BUD-016b: a payment note sits under the two people, not on the faint line', () => {
+ const card = payments([payment({ note: 'Taxi back' })]);
+ const facts = inView(<PaymentChangeFacts card={card} item={changeItem('a', card)} />);
+ expect(screen.queryByText('Taxi back')).toBeNull();
+ facts.unmount();
+ inView(<PaymentBody card={card} item={changeItem('a', card)} />);
+ expect(screen.getByText('Taxi back')).toBeInTheDocument();
+ });
+
it('FE-AI-CARD-BUD-017: a payment that goes, or a change that will not happen, is struck through', () => {
const gone = payments([payment({ change: 'willDelete' })]);
const first = inView(<PaymentAside card={gone} item={changeItem('a', gone)} />);
diff --git a/client/src/components/Assistant/cards/budget/PaymentsCard.tsx b/client/src/components/Assistant/cards/budget/PaymentsCard.tsx
index 4c6366e0b..9fa858d51 100644
--- a/client/src/components/Assistant/cards/budget/PaymentsCard.tsx
+++ b/client/src/components/Assistant/cards/budget/PaymentsCard.tsx
@@ -21,12 +21,17 @@ import { Amount, NotePill, PaymentFaces, PaymentNames } from './budgetParts';
* strikes through the people and the amount it replaces.
*/
+/** The day of a payment. */
+function PaymentDate({ date }: { date: string }) {
+ const format = useCardFormat();
+ return <Fact icon={CalendarDays} label={format.date(date)} />;
+}
+
/** The day of a payment and its note. */
function PaymentFacts({ row }: { row: CardPayment }) {
- const format = useCardFormat();
return (
<>
- {row.date && <Fact icon={CalendarDays} label={format.date(row.date)} />}
+ {row.date && <PaymentDate date={row.date} />}
{row.note && <NotePill note={row.note} />}
</>
);
@@ -118,19 +123,22 @@ export function PaymentChangeFacts({ card }: SlotProps) {
return (
<>
{was && <PeopleChange was={was} now={row} />}
- <PaymentFacts row={row} />
+ {row.date && <PaymentDate date={row.date} />}
</>
);
}
-/** Under a payment's change row: the two people, face to face. */
+/** Under a payment's change row: the two people, face to face, and the payment's note under them. */
export function PaymentBody({ card }: SlotProps) {
const row = card.rows[0];
if (!row) return null;
return (
- <span className="flex items-center gap-2 text-caption text-content-secondary">
- <PaymentFaces from={row.from} to={row.to} size={20} />
- <PaymentNames from={row.from} to={row.to} />
+ <span className="flex flex-col items-start gap-1">
+ <span className="flex items-center gap-2 text-caption text-content-secondary">
+ <PaymentFaces from={row.from} to={row.to} size={20} />
+ <PaymentNames from={row.from} to={row.to} />
+ </span>
+ {row.note && <NotePill note={row.note} />}
</span>
);
}