mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-24 07:53:09 +00:00
5d334d7ec8
A third scope, home, next to trip and journey: threads that name neither a trip nor a journey (the CHECK now only forbids both), reached under /api/assistant by their owner only. A home turn reads the user's trips through list_trips into a short card (under way, next, later, behind, undated), offers every read (a trip's on the id the model names, checked by the tool with the user's rights) and only the writes that take no trip or journey (atlas, vacation planner, collections, tour library, settings), all held as change cards. open_trip_chat answers with a card that goes on in that trip's own chat with the question waiting in its composer. On the desktop the window opens on the home chat outside a trip; its head lists the trips to switch into and a switched trip chat has the way back. On the phone the home chat opens full screen from the dashboard head and the dock's More list, and the card opens the trip with its chat. Both run on useAssistantHome.
44 lines
1.6 KiB
TypeScript
44 lines
1.6 KiB
TypeScript
import type { TrekCard, TrekCardKind } from '@trek/shared';
|
|
|
|
import { ATLAS_VIEWS } from './atlas/atlasViews';
|
|
import { BOOK_VIEWS } from './book/bookViews';
|
|
import { BOOK_DESIGN_VIEWS } from './bookDesign/bookDesignViews';
|
|
import { BOOKING_VIEWS } from './booking/bookingViews';
|
|
import { BUDGET_VIEWS } from './budget/budgetViews';
|
|
import type { CardView } from './cardTypes';
|
|
import { COLLAB_VIEWS } from './collab/collabViews';
|
|
import { COLLECTION_VIEWS } from './collection/collectionViews';
|
|
import { HOME_VIEWS } from './home/homeViews';
|
|
import { JOURNEY_VIEWS } from './journey/journeyViews';
|
|
import { PACKING_VIEWS } from './packing/packingViews';
|
|
import { ROADTRIP_VIEWS } from './roadtrip/roadtripViews';
|
|
import { TOUR_VIEWS } from './tour/tourViews';
|
|
import { VACAY_VIEWS } from './vacay/vacayViews';
|
|
|
|
/**
|
|
* How every kind of card draws, merged from each part of TREK's views. A kind
|
|
* without a view of its own yet has the pending one and draws nothing. This
|
|
* module pulls in the card components, so only the chat's own chunk imports
|
|
* it; the pure helpers, the layout rules among them, read the look instead.
|
|
*/
|
|
export const CARD_VIEWS: { readonly [K in TrekCardKind]: CardView<K> } = {
|
|
...TOUR_VIEWS,
|
|
...ROADTRIP_VIEWS,
|
|
...BUDGET_VIEWS,
|
|
...BOOKING_VIEWS,
|
|
...COLLAB_VIEWS,
|
|
...COLLECTION_VIEWS,
|
|
...ATLAS_VIEWS,
|
|
...VACAY_VIEWS,
|
|
...JOURNEY_VIEWS,
|
|
...PACKING_VIEWS,
|
|
...BOOK_VIEWS,
|
|
...BOOK_DESIGN_VIEWS,
|
|
...HOME_VIEWS,
|
|
};
|
|
|
|
/** The view of the card in hand, typed for any kind. */
|
|
export function viewOf(card: TrekCard): CardView<TrekCardKind> {
|
|
return CARD_VIEWS[card.kind] as CardView<TrekCardKind>;
|
|
}
|