mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-13 07:40:59 +00:00
feat(assistant): entry cards show tags, verdict and order, and changes can be taken back
The update card silently left out the tags and the pros and cons it was about to write, so the user approved a change the card did not show. An entry now shows its first tags and how its verdict leans, and an update names the tags, each side of the verdict and the coordinates it changes. A new order of the entries is drawn as the entries that move, in their new places. A changed entry is written back from what the tool answered it replaced, and a reorder is taken back to the order before, each while nothing changed since. A Dawarich stay taken in as an entry gets the entry card; it has no way back, since deleting the entry would leave the stay marked as taken in.
This commit is contained in:
@@ -12,7 +12,27 @@ import { z } from 'zod';
|
||||
*/
|
||||
|
||||
/** How much of a journal a card carries; the server clips to the same numbers. */
|
||||
export const JOURNEY_CARD_LIMITS = { entries: 8, title: 100, place: 80, story: 240, journal: 80, weather: 40 } as const;
|
||||
export const JOURNEY_CARD_LIMITS = {
|
||||
entries: 8,
|
||||
title: 100,
|
||||
place: 80,
|
||||
story: 240,
|
||||
journal: 80,
|
||||
weather: 40,
|
||||
tags: 6,
|
||||
tag: 40,
|
||||
points: 3,
|
||||
point: 80,
|
||||
} as const;
|
||||
|
||||
/** The verdict on a place as a card shows it: the first points on each side, and how many each side holds. */
|
||||
export const journeyEntryVerdictSchema = z.object({
|
||||
pros: z.array(cardText(JOURNEY_CARD_LIMITS.point)).max(JOURNEY_CARD_LIMITS.points),
|
||||
cons: z.array(cardText(JOURNEY_CARD_LIMITS.point)).max(JOURNEY_CARD_LIMITS.points),
|
||||
prosCount: cardCountSchema,
|
||||
consCount: cardCountSchema,
|
||||
});
|
||||
export type JourneyEntryVerdict = z.infer<typeof journeyEntryVerdictSchema>;
|
||||
|
||||
/**
|
||||
* One entry as a card shows it. Its texts are plain and on one line (the story
|
||||
@@ -52,11 +72,16 @@ export const journeyEntryLookSchema = z.object({
|
||||
fromTripPlace: z.boolean(),
|
||||
/** Which day of the journal it falls on, counted from 0, for the day's colour; null when unknown. */
|
||||
dayIndex: z.number().int().min(0).max(9_999).nullable(),
|
||||
/** Its first tags. Optional, like the two below: cards stored before they existed leave them out. */
|
||||
tags: z.array(cardText(JOURNEY_CARD_LIMITS.tag)).max(JOURNEY_CARD_LIMITS.tags).optional(),
|
||||
verdict: journeyEntryVerdictSchema.nullable().optional(),
|
||||
/** In a new order of the journal's entries, this one changed its place. */
|
||||
moved: z.boolean().optional(),
|
||||
});
|
||||
export type JourneyEntryLook = z.infer<typeof journeyEntryLookSchema>;
|
||||
|
||||
/** What a change card's entry goes through: nothing on an answer, else what the change does to it. */
|
||||
export const JOURNEY_CARD_CHANGES = ['none', 'new', 'changed', 'willDelete'] as const;
|
||||
/** What a change card's entries go through: nothing on an answer, else what the change does to them. */
|
||||
export const JOURNEY_CARD_CHANGES = ['none', 'new', 'changed', 'willDelete', 'reordered'] as const;
|
||||
|
||||
export const journeyEntriesCardSchema = z.object({
|
||||
kind: z.literal('journeyEntries'),
|
||||
|
||||
@@ -13,7 +13,7 @@ export * from './journey-header.card';
|
||||
*/
|
||||
export const JOURNEY_CARD_SCHEMAS = [journeyEntriesCardSchema, journeyHeaderCardSchema] as const;
|
||||
/**
|
||||
* An entry written, changed or deleted; a journal started, renamed, given
|
||||
* An entry written, changed or deleted, the entries put in a new order; a journal started, renamed, given
|
||||
* another status or other settings, deleted; a trip linked or unlinked; its
|
||||
* suggestions brought back; the user's own view of it changed.
|
||||
*/
|
||||
@@ -21,6 +21,7 @@ export const JOURNEY_VERB_KEYS = [
|
||||
'addJournalEntry',
|
||||
'updateJournalEntry',
|
||||
'removeJournalEntry',
|
||||
'reorderJournalEntries',
|
||||
'createJournal',
|
||||
'renameJournal',
|
||||
'setJournalStatus',
|
||||
|
||||
Reference in New Issue
Block a user