@gloom-sh/terminal 0.20.9 → 0.20.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/patches/@opentui%2Fcore@0.3.2.patch +16 -0
- package/src/api-client/auth.ts +6 -0
- package/src/api-client/data.ts +1 -0
- package/src/api-client/earnings.ts +15 -0
- package/src/api-client/index.ts +14 -3
- package/src/api-client/socket-connection.ts +355 -0
- package/src/api-client/socket-features.ts +75 -0
- package/src/api-client/socket-frames.ts +161 -0
- package/src/api-client/socket-listeners.ts +207 -0
- package/src/api-client/socket-quotes.ts +332 -0
- package/src/api-client/socket.ts +150 -983
- package/src/api-client/types/account.ts +10 -0
- package/src/api-client/types/billing.ts +10 -0
- package/src/api-client/types/econ.ts +19 -7
- package/src/api-client/types/market.ts +7 -0
- package/src/api-client/types/screener.ts +2 -0
- package/src/brokers/signed-in/adapter.ts +19 -5
- package/src/brokers/signed-in/client.ts +13 -1
- package/src/brokers/signed-in/sign-in-dialog.tsx +33 -9
- package/src/cli/commands/market.ts +18 -8
- package/src/cli/commands/overview.ts +26 -7
- package/src/cli/commands/ticker.ts +40 -15
- package/src/cli/desktop-pane-shot.ts +39 -0
- package/src/cli/errors.ts +20 -3
- package/src/cli/fx-pair.ts +11 -2
- package/src/cli/history-rows.ts +34 -3
- package/src/cli/index.ts +1 -1
- package/src/cli/listing-arg.ts +51 -13
- package/src/cli/pane-functions/headless.ts +4 -2
- package/src/cli/pane-functions/index.ts +1 -0
- package/src/cli/pane-functions/resolver.ts +2 -1
- package/src/cli/pane-functions/screenshot-assessment.ts +73 -5
- package/src/cli/pane-functions/screenshot-types.ts +4 -0
- package/src/components/chart/composite/chart-layout.ts +7 -4
- package/src/components/chart/composite/composite-chart.tsx +6 -16
- package/src/components/chart/composite/toolbar.tsx +258 -82
- package/src/components/chart/composite/use-composite-chart-keyboard.ts +5 -6
- package/src/components/chart/native/kitty/manager.ts +2 -0
- package/src/components/chart/native/surface/manager.ts +211 -11
- package/src/components/command-bar/list/model.ts +13 -0
- package/src/components/command-bar/panel/index.tsx +2 -13
- package/src/components/command-bar/panel/layout.ts +1 -7
- package/src/components/command-bar/panel/runtime.ts +0 -1
- package/src/components/command-bar/panel/types.ts +0 -2
- package/src/components/command-bar/routes/ticker-search/actions.ts +2 -0
- package/src/components/command-bar/routes/ticker-search/results.ts +15 -8
- package/src/components/command-bar/surface/index.tsx +10 -5
- package/src/components/command-bar/workflow/alert.ts +21 -7
- package/src/components/data-table/column-menu.tsx +89 -0
- package/src/components/data-table/sort-menu.tsx +9 -2
- package/src/components/data-table/table-pane.ts +3 -1
- package/src/components/data-table/view.tsx +33 -6
- package/src/components/form-modal/content.tsx +10 -0
- package/src/components/index.ts +1 -1
- package/src/components/layout/pane/footer/index.tsx +25 -11
- package/src/components/layout/pane/footer/model.ts +88 -21
- package/src/components/layout/pane/sidebar.tsx +125 -15
- package/src/components/layout/shell/active-drag.ts +18 -13
- package/src/components/layout/shell/drag/magnets.ts +34 -18
- package/src/components/metric-treemap/heat-surface.tsx +2 -1
- package/src/components/metric-treemap/index.tsx +3 -2
- package/src/components/ticker/list-table-view.tsx +5 -0
- package/src/components/ui/confirm-dialog.tsx +253 -7
- package/src/components/ui/data-table/column-order.ts +180 -0
- package/src/components/ui/data-table/index.tsx +13 -2
- package/src/components/ui/data-table/opentui/index.tsx +267 -23
- package/src/components/ui/data-table/opentui/model.ts +43 -4
- package/src/components/ui/data-table/types.ts +56 -0
- package/src/components/ui/data-table/use-column-order.ts +135 -0
- package/src/components/ui/index.ts +1 -1
- package/src/components/ui/list-view.tsx +4 -3
- package/src/components/ui/status.tsx +9 -6
- package/src/components/ui/table-layout.ts +120 -0
- package/src/docs/snapshot.json +39 -2
- package/src/i18n/es.ts +14 -0
- package/src/i18n/ja.ts +14 -0
- package/src/i18n/ko.ts +14 -0
- package/src/i18n/zh-cn.ts +14 -0
- package/src/i18n/zh-tw.ts +14 -0
- package/src/market-data/coordinator/index.ts +4 -3
- package/src/market-data/coordinator/quotes.ts +12 -4
- package/src/market-data/fx-closes.ts +14 -2
- package/src/market-data/market/change-basis.ts +35 -1
- package/src/market-data/market/status.ts +37 -0
- package/src/market-data/performance.ts +4 -1
- package/src/market-data/quotes/freshness.ts +12 -0
- package/src/market-data/quotes/live-valuation.ts +26 -3
- package/src/market-data/quotes/regular-session-valuation.ts +1 -1
- package/src/market-data/realized-volatility.ts +3 -0
- package/src/market-data/us-bond-market.ts +115 -0
- package/src/plugins/builtin/account-management/invite-row.tsx +54 -0
- package/src/plugins/builtin/account-management/keyboard.ts +3 -0
- package/src/plugins/builtin/account-management/model.ts +1 -0
- package/src/plugins/builtin/account-management/pane.tsx +51 -5
- package/src/plugins/builtin/account-management/trial-cancel.ts +32 -7
- package/src/plugins/builtin/broker-manager/detail.tsx +5 -3
- package/src/plugins/builtin/broker-manager/index.tsx +6 -6
- package/src/plugins/builtin/broker-manager/model.ts +15 -6
- package/src/plugins/builtin/broker-manager/pane-actions.tsx +11 -4
- package/src/plugins/builtin/broker-manager/sign-in-end.ts +50 -19
- package/src/plugins/builtin/broker-manager/table.ts +10 -4
- package/src/plugins/builtin/chat/sidebar.tsx +33 -16
- package/src/plugins/builtin/cloud/askg/pane-session.ts +94 -0
- package/src/plugins/builtin/cloud/askg/pane.tsx +40 -83
- package/src/plugins/builtin/cloud/askg/tool-timeline.tsx +2 -0
- package/src/plugins/builtin/congress-trades/pane.tsx +8 -2
- package/src/plugins/builtin/correlation/compute.ts +4 -3
- package/src/plugins/builtin/earnings/board-model.ts +33 -0
- package/src/plugins/builtin/earnings/board-table.ts +50 -11
- package/src/plugins/builtin/earnings/board.tsx +29 -13
- package/src/plugins/builtin/earnings/calendar.tsx +15 -3
- package/src/plugins/builtin/earnings/client.ts +4 -1
- package/src/plugins/builtin/earnings/headless.ts +27 -14
- package/src/plugins/builtin/econ/calendar-source.ts +3 -0
- package/src/plugins/builtin/equity-screener/live.ts +74 -18
- package/src/plugins/builtin/equity-screener/model.ts +19 -4
- package/src/plugins/builtin/equity-screener/pane.tsx +19 -14
- package/src/plugins/builtin/equity-screener/refresh-anchor.ts +45 -0
- package/src/plugins/builtin/equity-screener/results.ts +22 -2
- package/src/plugins/builtin/equity-screener/screen-check.ts +9 -3
- package/src/plugins/builtin/futures/index.tsx +15 -1
- package/src/plugins/builtin/futures/table.tsx +1 -1
- package/src/plugins/builtin/fx-matrix/index.tsx +2 -0
- package/src/plugins/builtin/help/index.tsx +1 -1
- package/src/plugins/builtin/holders/pane.tsx +30 -20
- package/src/plugins/builtin/ipo-calendar/model.ts +3 -3
- package/src/plugins/builtin/iv-history/events.ts +5 -0
- package/src/plugins/builtin/iv-history/headless.ts +19 -12
- package/src/plugins/builtin/kelly-sizer/sections.tsx +2 -0
- package/src/plugins/builtin/macro-day/headless.ts +27 -8
- package/src/plugins/builtin/macro-day/model.ts +17 -4
- package/src/plugins/builtin/macro-day/releases.ts +36 -15
- package/src/plugins/builtin/market-halts/model.ts +3 -2
- package/src/plugins/builtin/market-movers/headless.ts +2 -1
- package/src/plugins/builtin/market-movers/index.tsx +3 -2
- package/src/plugins/builtin/market-movers/model.ts +75 -22
- package/src/plugins/builtin/market-movers/screener.ts +2 -1
- package/src/plugins/builtin/market-movers/table.ts +7 -5
- package/src/plugins/builtin/options/view.tsx +2 -0
- package/src/plugins/builtin/options-scenario/pane.tsx +2 -1
- package/src/plugins/builtin/pe-band/model.ts +4 -0
- package/src/plugins/builtin/perps/cascade-tabs.tsx +2 -1
- package/src/plugins/builtin/portfolio-list/cell-version.ts +4 -4
- package/src/plugins/builtin/portfolio-list/cli/render.ts +9 -4
- package/src/plugins/builtin/portfolio-list/pane/index.tsx +15 -1
- package/src/plugins/builtin/portfolio-list/summary/index.tsx +24 -7
- package/src/plugins/builtin/portfolio-list/summary/totals.ts +40 -11
- package/src/plugins/builtin/portfolio-list/table.tsx +18 -1
- package/src/plugins/builtin/rate-path/pane.tsx +2 -0
- package/src/plugins/builtin/research/analyst-headless.ts +9 -1
- package/src/plugins/builtin/research/analyst-pane.tsx +10 -4
- package/src/plugins/builtin/research/client.ts +25 -1
- package/src/plugins/builtin/research/corporate-actions-pane.tsx +2 -1
- package/src/plugins/builtin/research/event-model.ts +3 -13
- package/src/plugins/builtin/research/event-sources.ts +3 -1
- package/src/plugins/builtin/revenue-breakdown/pane.tsx +2 -0
- package/src/plugins/builtin/reverse-dcf/pane.tsx +2 -1
- package/src/plugins/builtin/seasonality/pane.tsx +2 -1
- package/src/plugins/builtin/short-interest/headless.ts +2 -0
- package/src/plugins/builtin/short-interest/publications-headless.ts +2 -0
- package/src/plugins/builtin/short-interest/watch-headless.ts +1 -0
- package/src/plugins/builtin/thirteenf/pane.tsx +2 -0
- package/src/plugins/builtin/ticker-detail/financials/model.ts +28 -6
- package/src/plugins/builtin/ticker-detail/financials/ratio-table.tsx +26 -9
- package/src/plugins/builtin/ticker-detail/financials/tab.tsx +58 -35
- package/src/plugins/builtin/vol-surface/heat-grid.tsx +2 -1
- package/src/plugins/builtin/vol-surface/pane.tsx +2 -1
- package/src/plugins/builtin/world-indices/index.tsx +5 -1
- package/src/plugins/builtin/yield-curve/headless.ts +5 -1
- package/src/plugins/builtin/yield-curve/index.tsx +7 -1
- package/src/portfolio/column-values.ts +47 -14
- package/src/portfolio/return-metrics.ts +4 -2
- package/src/renderers/dom/data-table/column-drag.ts +147 -0
- package/src/renderers/dom/data-table/index.tsx +22 -0
- package/src/renderers/dom/data-table/row.tsx +27 -5
- package/src/renderers/dom/host/image-surface.tsx +19 -9
- package/src/renderers/dom/host/input.tsx +4 -0
- package/src/renderers/dom/styles.css +22 -0
- package/src/renderers/electrobun/view/cli-pane-shot-entry.tsx +23 -1
- package/src/renderers/opentui/chart-surface.tsx +1 -0
- package/src/renderers/opentui/frame-hits.ts +33 -0
- package/src/renderers/opentui/host.tsx +2 -0
- package/src/renderers/opentui/native-surface.ts +14 -21
- package/src/renderers/opentui/test-utils.tsx +3 -0
- package/src/sources/gloomberb-cloud/normalizers.ts +2 -0
- package/src/sources/provider-errors.ts +12 -0
- package/src/sources/provider-router/index.ts +12 -4
- package/src/state/app/context/index.tsx +22 -0
- package/src/state/pane-session.ts +145 -0
- package/src/test-support/app-store.ts +24 -1
- package/src/tickers/search/home-listing.ts +44 -1
- package/src/tickers/search/index.ts +5 -2
- package/src/tickers/search/ranking.ts +7 -7
- package/src/tickers/us-listing.ts +11 -5
- package/src/time-series/base-series.ts +7 -1
- package/src/time-series/fundamentals/current-valuation.ts +8 -0
- package/src/time-series/fundamentals/series.ts +6 -0
- package/src/time-series/live-quotes.ts +3 -9
- package/src/time-series/resolve.ts +1 -0
- package/src/types/financials.ts +20 -0
- package/src/types/headless.ts +9 -0
- package/src/ui/host.tsx +20 -0
- package/src/ui/pointer-drag.ts +11 -2
- package/src/utils/exchanges.ts +13 -8
- package/src/utils/fundamentals.ts +14 -3
- package/src/utils/price-earnings.ts +17 -10
- package/src/utils/price-history-integrity.ts +15 -0
- package/src/utils/reason-codes.ts +79 -0
- package/src/utils/share-multiples.cases.json +1667 -0
- package/src/utils/share-multiples.ts +384 -0
- package/src/utils/untrusted-text.ts +11 -0
|
@@ -39,6 +39,7 @@ import {
|
|
|
39
39
|
NO_LATCH,
|
|
40
40
|
snapMovedRect,
|
|
41
41
|
snapResizedRect,
|
|
42
|
+
TERMINAL_MAGNET_REST_MS,
|
|
42
43
|
type MagnetDistances,
|
|
43
44
|
type MagnetGlide,
|
|
44
45
|
type MagnetLatch,
|
|
@@ -203,15 +204,16 @@ export function useShellActiveDrag({
|
|
|
203
204
|
return { rect, partners: rects };
|
|
204
205
|
};
|
|
205
206
|
const magnetArea = { x: 0, y: 0, width, height: contentHeight };
|
|
206
|
-
//
|
|
207
|
-
//
|
|
208
|
-
|
|
209
|
-
//
|
|
207
|
+
// The move run again once the pointer rests. A release lands where the
|
|
208
|
+
// pane is drawn: no catch after it.
|
|
209
|
+
const runAgain = event.type === "drag" ? () => { if (dragRef.current === drag) handleRef.current(event); } : undefined;
|
|
210
|
+
// Past the travel speed a release lands the pane where the pointer puts
|
|
211
|
+
// it, its magnets left out (the rest check runs the last move again once
|
|
212
|
+
// the pointer has stopped, so a release then catches). What they hold to
|
|
213
|
+
// still follows every move, so it rests where it would have.
|
|
210
214
|
const travelling = () => {
|
|
211
|
-
if (
|
|
212
|
-
|
|
213
|
-
const rest = event.type === "drag" ? () => { if (dragRef.current === drag) handleRef.current(event); } : undefined;
|
|
214
|
-
return memo.pace.travelling({ t: performance.now(), x: preciseX, y: preciseShellY }, magnetDistances, rest);
|
|
215
|
+
if (drag.type !== "pane-drag") return false;
|
|
216
|
+
return memo.pace.travelling({ t: performance.now(), x: preciseX, y: preciseShellY }, magnetDistances, runAgain);
|
|
215
217
|
};
|
|
216
218
|
// Where a move lands the pane (`rect`), and where its magnets hold it as
|
|
217
219
|
// the pointer slows down (`snapped`).
|
|
@@ -224,13 +226,16 @@ export function useShellActiveDrag({
|
|
|
224
226
|
memo.latch = snapped.latch;
|
|
225
227
|
return { rect: travelling() ? rect : snapped.rect, snapped: snapped.rect };
|
|
226
228
|
};
|
|
227
|
-
//
|
|
228
|
-
//
|
|
229
|
-
//
|
|
230
|
-
// glide on)
|
|
229
|
+
// The moving pane is drawn under the pointer while it moves, and where
|
|
230
|
+
// its magnets hold it once the pointer slows down to place it. The
|
|
231
|
+
// desktop glides between the two (the frames after the pointer stops
|
|
232
|
+
// carry the glide on); the terminal steps onto the magnets, on the move
|
|
233
|
+
// run again once the pointer rests.
|
|
231
234
|
const drawMove = (paneId: string, free: FloatingRect, moved: { rect: FloatingRect; snapped: FloatingRect }) => {
|
|
232
235
|
if (!nativePaneChrome) {
|
|
233
|
-
|
|
236
|
+
const placing = memo.pace.placing(performance.now(), magnetDistances);
|
|
237
|
+
updateDragFloatingRect({ paneId, rect: placing ? moved.snapped : free });
|
|
238
|
+
if (!placing && runAgain) memo.pace.rest(runAgain, TERMINAL_MAGNET_REST_MS);
|
|
234
239
|
return;
|
|
235
240
|
}
|
|
236
241
|
const { snapped } = moved;
|
|
@@ -37,16 +37,17 @@ const MAGNET_RELEASE_PX = 12;
|
|
|
37
37
|
const TERMINAL_MAGNETS: MagnetDistances = { catchX: 1, catchY: 1, releaseX: 2, releaseY: 2 };
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
|
-
*
|
|
41
|
-
* a release lands the pane where the
|
|
40
|
+
* Past this pointer speed, in catch distances a second (300 px/s on the
|
|
41
|
+
* desktop, 37.5 cells in the terminal), a release lands the pane where the
|
|
42
|
+
* pointer puts it, its magnets left out.
|
|
42
43
|
*/
|
|
43
44
|
const MAGNET_TRAVEL_SPEED = 300 / MAGNET_CATCH_PX;
|
|
44
45
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* read as a drag that lags and stutters.
|
|
46
|
+
* Below this pointer speed (60 px/s, about a px a frame) the pointer is
|
|
47
|
+
* placing the pane, and it is drawn where its magnets hold it; faster, it is
|
|
48
|
+
* drawn under the pointer. Drawing the magnets at a hand's usual speed held
|
|
49
|
+
* the pane on each line it crossed, then jumped it up to 18 px (three cells
|
|
50
|
+
* in the terminal), which read as a drag that lags and stutters.
|
|
50
51
|
*/
|
|
51
52
|
const MAGNET_PLACE_SPEED = 60 / MAGNET_CATCH_PX;
|
|
52
53
|
/**
|
|
@@ -59,6 +60,12 @@ const GLIDE_RATE = 35;
|
|
|
59
60
|
const SPEED_WINDOW_MS = 64;
|
|
60
61
|
/** How long the pointer rests before the magnets catch where it stopped, ms. */
|
|
61
62
|
export const MAGNET_REST_MS = 80;
|
|
63
|
+
/**
|
|
64
|
+
* The same in the terminal, which hears from the pointer only as it enters
|
|
65
|
+
* another cell: a hand placing a window there crosses five or so a second, so
|
|
66
|
+
* a pause shorter than that is still a drag.
|
|
67
|
+
*/
|
|
68
|
+
export const TERMINAL_MAGNET_REST_MS = 200;
|
|
62
69
|
|
|
63
70
|
/** Where the pointer was during a move, in cells, and when (ms). */
|
|
64
71
|
interface PointerSample {
|
|
@@ -75,7 +82,7 @@ function trackPointer(track: PointerSample[], sample: PointerSample): void {
|
|
|
75
82
|
}
|
|
76
83
|
|
|
77
84
|
/**
|
|
78
|
-
*
|
|
85
|
+
* When a moving pane's magnets act, over one drag. `travelling`
|
|
79
86
|
* takes each move and says whether the pointer is on its way somewhere; while
|
|
80
87
|
* it is, a release lands the pane where the pointer puts it, and `rest` (the
|
|
81
88
|
* move run again) is set to run once the pointer has stopped for
|
|
@@ -90,6 +97,12 @@ export interface MagnetPace {
|
|
|
90
97
|
travelling(sample: PointerSample, distances: MagnetDistances, rest?: () => void): boolean;
|
|
91
98
|
/** Whether the pointer, as of `now`, moves slowly enough to be placing the pane: its magnets are drawn. */
|
|
92
99
|
placing(now: number, distances: MagnetDistances): boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Runs `onRest` once the pointer has stopped for `ms`, unless another event
|
|
102
|
+
* of the drag comes first: the terminal, which draws only when an event
|
|
103
|
+
* comes, draws the magnets that catch where it stopped.
|
|
104
|
+
*/
|
|
105
|
+
rest(onRest: () => void, ms: number): void;
|
|
93
106
|
/** Drops the rest check: another event of the drag came first. */
|
|
94
107
|
cancel(): void;
|
|
95
108
|
/** Forgets the pointer's path, for a new drag. */
|
|
@@ -106,6 +119,17 @@ export function createMagnetPace(): MagnetPace {
|
|
|
106
119
|
rest = null;
|
|
107
120
|
frame = null;
|
|
108
121
|
};
|
|
122
|
+
const restThen = (onRest: () => void, ms = MAGNET_REST_MS) => {
|
|
123
|
+
cancel();
|
|
124
|
+
rest = setTimeout(() => {
|
|
125
|
+
rest = null;
|
|
126
|
+
if (typeof requestAnimationFrame !== "function") return onRest();
|
|
127
|
+
frame = requestAnimationFrame(() => {
|
|
128
|
+
frame = null;
|
|
129
|
+
onRest();
|
|
130
|
+
});
|
|
131
|
+
}, ms);
|
|
132
|
+
};
|
|
109
133
|
return {
|
|
110
134
|
travelling(sample, distances, onRest) {
|
|
111
135
|
cancel();
|
|
@@ -113,19 +137,11 @@ export function createMagnetPace(): MagnetPace {
|
|
|
113
137
|
// The same place again (a rest check, a repeated event) is not a move.
|
|
114
138
|
if (!last || last.x !== sample.x || last.y !== sample.y) trackPointer(track, sample);
|
|
115
139
|
if (pointerSpeed(track, sample.t, distances) <= MAGNET_TRAVEL_SPEED) return false;
|
|
116
|
-
if (onRest)
|
|
117
|
-
rest = setTimeout(() => {
|
|
118
|
-
rest = null;
|
|
119
|
-
if (typeof requestAnimationFrame !== "function") return onRest();
|
|
120
|
-
frame = requestAnimationFrame(() => {
|
|
121
|
-
frame = null;
|
|
122
|
-
onRest();
|
|
123
|
-
});
|
|
124
|
-
}, MAGNET_REST_MS);
|
|
125
|
-
}
|
|
140
|
+
if (onRest) restThen(onRest);
|
|
126
141
|
return true;
|
|
127
142
|
},
|
|
128
143
|
placing: (now, distances) => pointerSpeed(track, now, distances) < MAGNET_PLACE_SPEED,
|
|
144
|
+
rest: restThen,
|
|
129
145
|
cancel,
|
|
130
146
|
reset() {
|
|
131
147
|
cancel();
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
import { useThemeColors } from "../../theme/theme-context";
|
|
14
14
|
import { t } from "../../i18n";
|
|
15
15
|
import { clipToDisplayWidth, padTo } from "../../utils/format";
|
|
16
|
+
import { readableError } from "../../utils/reason-codes";
|
|
16
17
|
import type { FloatMetricTreemapTile, MetricTreemapItem } from "./layout";
|
|
17
18
|
import {
|
|
18
19
|
buildMetricTreemapScene,
|
|
@@ -820,7 +821,7 @@ export function HeatTreemapSurface<T>(props: HeatTreemapSurfaceProps<T>) {
|
|
|
820
821
|
if (props.scene.tiles.length === 0) {
|
|
821
822
|
return (
|
|
822
823
|
<Box width={props.width} height={props.height} paddingX={1} paddingY={1}>
|
|
823
|
-
<Text fg={colors.textDim}>{t(props.emptyStateTitle ?? "No chart data")}</Text>
|
|
824
|
+
<Text fg={colors.textDim}>{t(readableError(props.emptyStateTitle ?? "No chart data"))}</Text>
|
|
824
825
|
</Box>
|
|
825
826
|
);
|
|
826
827
|
}
|
|
@@ -4,6 +4,7 @@ import { blendHex, colors, priceColor } from "../../theme/colors";
|
|
|
4
4
|
import { blendForContrast, higherContrast } from "../../theme/color-utils";
|
|
5
5
|
import { t } from "../../i18n";
|
|
6
6
|
import { padTo } from "../../utils/format";
|
|
7
|
+
import { readableError } from "../../utils/reason-codes";
|
|
7
8
|
import {
|
|
8
9
|
buildMetricTreemap,
|
|
9
10
|
buildMetricTreemapRects,
|
|
@@ -249,7 +250,7 @@ function DesktopMetricTreemapSurface<T>({ items, width, height, selectedId, onSe
|
|
|
249
250
|
if (tiles.length === 0) {
|
|
250
251
|
return (
|
|
251
252
|
<Box width={width} height={height} paddingX={1} paddingY={1}>
|
|
252
|
-
<Text fg={colors.textDim}>{t(emptyStateTitle ?? "No chart data")}</Text>
|
|
253
|
+
<Text fg={colors.textDim}>{t(readableError(emptyStateTitle ?? "No chart data"))}</Text>
|
|
253
254
|
</Box>
|
|
254
255
|
);
|
|
255
256
|
}
|
|
@@ -328,7 +329,7 @@ export function MetricTreemapSurface<T>({
|
|
|
328
329
|
if (tiles.length === 0) {
|
|
329
330
|
return (
|
|
330
331
|
<Box width={width} height={height} paddingX={1} paddingY={1}>
|
|
331
|
-
<Text fg={colors.textDim}>{t(emptyStateTitle ?? "No chart data")}</Text>
|
|
332
|
+
<Text fg={colors.textDim}>{t(readableError(emptyStateTitle ?? "No chart data"))}</Text>
|
|
332
333
|
</Box>
|
|
333
334
|
);
|
|
334
335
|
}
|
|
@@ -26,6 +26,7 @@ import type { TickerRecord } from "../../types/ticker";
|
|
|
26
26
|
import { PRICE_SPARKLINE_COLUMN_ID, PriceSparkline } from "../price-sparkline/view";
|
|
27
27
|
import { DataTableView, type DataTableKeyEvent, type DataTableSelection } from "../data-table/view";
|
|
28
28
|
import type { QuoteFlashDirection } from "../quote-flash";
|
|
29
|
+
import type { DataTableColumnReorder } from "../ui";
|
|
29
30
|
import { objectVersion } from "../../utils/object-version";
|
|
30
31
|
import { getCompletedRegularSessionDisplay } from "../../market-data/market/status";
|
|
31
32
|
import { QUOTE_EXPORT_IDENTITY_HEADERS, quoteExportIdentityCells } from "../../market-data/quotes/export-identity";
|
|
@@ -152,6 +153,8 @@ export interface TickerListTableViewProps {
|
|
|
152
153
|
addTickerShortcut?: string;
|
|
153
154
|
virtualize?: boolean;
|
|
154
155
|
overscan?: number;
|
|
156
|
+
/** How the header drags reorder the columns (`DataTableProps.columnReorder`). */
|
|
157
|
+
columnReorder?: false | DataTableColumnReorder;
|
|
155
158
|
}
|
|
156
159
|
|
|
157
160
|
const FLASHABLE_QUOTE_COLUMN_IDS = new Set([
|
|
@@ -287,6 +290,7 @@ export function TickerListTableView({
|
|
|
287
290
|
virtualize = true,
|
|
288
291
|
overscan = 4,
|
|
289
292
|
exportName,
|
|
293
|
+
columnReorder,
|
|
290
294
|
}: TickerListTableViewProps) {
|
|
291
295
|
const commandBarShortcut = useCommandBarShortcut();
|
|
292
296
|
const resolvedEmptyHint = emptyHint ?? tf("Press {shortcut} to add one.", { shortcut: addTickerShortcut ?? commandBarShortcut });
|
|
@@ -445,6 +449,7 @@ export function TickerListTableView({
|
|
|
445
449
|
<DataTableView<TickerRecord, ColumnConfig>
|
|
446
450
|
focused={focused}
|
|
447
451
|
columns={columns}
|
|
452
|
+
columnReorder={columnReorder}
|
|
448
453
|
items={items}
|
|
449
454
|
isNavigable={summaries.length ? isNavigableRow : undefined}
|
|
450
455
|
sortColumnId={sortColumnId ?? null}
|
|
@@ -1,13 +1,39 @@
|
|
|
1
|
-
import { useCallback, useRef, type ReactNode } from "react";
|
|
2
|
-
import { Box, Text, useUiHost } from "../../ui";
|
|
1
|
+
import { useCallback, useMemo, useRef, useState, type ReactNode, type RefObject } from "react";
|
|
2
|
+
import { Box, Text, TextAttributes, useUiHost } from "../../ui";
|
|
3
3
|
import { colors } from "../../theme/colors";
|
|
4
4
|
import { t, tf } from "../../i18n";
|
|
5
5
|
import { type DialogApi, type PromptContext, useDialogKeyboard } from "../../ui/dialog";
|
|
6
|
+
import type { InputRenderable } from "../../ui/host";
|
|
7
|
+
import type { KeyEventLike } from "../../react/input";
|
|
6
8
|
import { isPlainKey } from "../../utils/keyboard";
|
|
7
9
|
import { Button, type ButtonVariant } from "./button";
|
|
8
10
|
import { DialogActions } from "./dialog-actions";
|
|
11
|
+
import { TextField } from "./fields";
|
|
9
12
|
import { DialogFrame, fitDialogWidth } from "./frame";
|
|
13
|
+
import { ListView, listCursorMove, type ListViewItem } from "./list-view";
|
|
10
14
|
import { logFailure } from "../../utils/log-failure";
|
|
15
|
+
import { sliceWholeCharacters } from "../../utils/untrusted-text";
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* An optional question a confirm asks under its body, such as why: one of a
|
|
19
|
+
* few choices and a short note. Nothing in it is required and it adds no
|
|
20
|
+
* step: the buttons and keys answer the dialog as they do without it.
|
|
21
|
+
*/
|
|
22
|
+
export interface ConfirmDialogQuestion {
|
|
23
|
+
/** Over the choices, e.g. "What made you decide to cancel? (optional)". */
|
|
24
|
+
label: string;
|
|
25
|
+
choices: ReadonlyArray<{ id: string; label: string }>;
|
|
26
|
+
/** The note field's placeholder; left out, the dialog asks for no note. */
|
|
27
|
+
notePlaceholder?: string;
|
|
28
|
+
/** The most characters the note takes. */
|
|
29
|
+
noteMaxLength?: number;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** What a confirm's question got: the choice picked and the note, trimmed, when there was one. */
|
|
33
|
+
export interface ConfirmDialogAnswer {
|
|
34
|
+
choice?: string;
|
|
35
|
+
note?: string;
|
|
36
|
+
}
|
|
11
37
|
|
|
12
38
|
export interface ConfirmDialogProps extends PromptContext<boolean> {
|
|
13
39
|
title: string;
|
|
@@ -43,6 +69,15 @@ export interface ConfirmDialogProps extends PromptContext<boolean> {
|
|
|
43
69
|
* and only `y` or the confirm button confirms.
|
|
44
70
|
*/
|
|
45
71
|
defaultAction?: "confirm" | "cancel";
|
|
72
|
+
/**
|
|
73
|
+
* Asks an optional question under the body. The arrows pick a choice, and
|
|
74
|
+
* Space or a click on the picked one clears it. Tab moves into the note and
|
|
75
|
+
* back; while the note has the keys, what is typed goes there, Enter leaves
|
|
76
|
+
* it and only Esc answers the dialog.
|
|
77
|
+
*/
|
|
78
|
+
question?: ConfirmDialogQuestion;
|
|
79
|
+
/** With `question`: what it got, called as the dialog confirms. */
|
|
80
|
+
onAnswer?: (answer: ConfirmDialogAnswer) => void;
|
|
46
81
|
}
|
|
47
82
|
|
|
48
83
|
export function ConfirmDialog({
|
|
@@ -60,16 +95,28 @@ export function ConfirmDialog({
|
|
|
60
95
|
formButtons = false,
|
|
61
96
|
keyGraceMs = 0,
|
|
62
97
|
defaultAction = "confirm",
|
|
98
|
+
question,
|
|
99
|
+
onAnswer,
|
|
63
100
|
}: ConfirmDialogProps) {
|
|
64
101
|
const enterCancels = defaultAction === "cancel";
|
|
65
102
|
const desktop = useUiHost().kind === "desktop-web";
|
|
66
103
|
const openedAt = useRef(Date.now());
|
|
67
|
-
const
|
|
104
|
+
const answer = useQuestionAnswer(question);
|
|
105
|
+
const confirm = useCallback(() => {
|
|
106
|
+
if (question) onAnswer?.(answer.read());
|
|
107
|
+
resolve(true);
|
|
108
|
+
}, [answer, onAnswer, question, resolve]);
|
|
68
109
|
const cancel = useCallback(() => resolve(false), [resolve]);
|
|
69
110
|
|
|
70
111
|
// Every key, even with a field focused under the dialog: a confirm has
|
|
71
|
-
// nothing to type into, so nothing below should take one.
|
|
112
|
+
// nothing to type into but its own note, so nothing below should take one.
|
|
72
113
|
useDialogKeyboard((event) => {
|
|
114
|
+
// The note takes what is typed, `y` and `n` included. Stopping a key here
|
|
115
|
+
// would keep it from the note too, so only the dialog's own keys stop.
|
|
116
|
+
if (question && answer.noteHasKeys(event) && event.name !== "escape") {
|
|
117
|
+
answer.handleNoteKey(event);
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
73
120
|
event.stopPropagation();
|
|
74
121
|
if (event.name === "escape") {
|
|
75
122
|
event.preventDefault();
|
|
@@ -81,6 +128,7 @@ export function ConfirmDialog({
|
|
|
81
128
|
return;
|
|
82
129
|
}
|
|
83
130
|
const enter = event.name === "enter" || event.name === "return";
|
|
131
|
+
if (question && answer.handleKey(event)) return;
|
|
84
132
|
if (enter && enterCancels) {
|
|
85
133
|
event.preventDefault();
|
|
86
134
|
cancel();
|
|
@@ -97,7 +145,7 @@ export function ConfirmDialog({
|
|
|
97
145
|
cancel();
|
|
98
146
|
return;
|
|
99
147
|
}
|
|
100
|
-
// Two buttons and nothing to type: Tab has nowhere to go.
|
|
148
|
+
// Two buttons and nothing to type (a note takes Tab above): Tab has nowhere to go.
|
|
101
149
|
if (event.name === "tab") event.preventDefault();
|
|
102
150
|
}, { allowEditable: true });
|
|
103
151
|
|
|
@@ -115,8 +163,11 @@ export function ConfirmDialog({
|
|
|
115
163
|
/>
|
|
116
164
|
);
|
|
117
165
|
const cancelButton = <Button label={cancelLabel} variant={enterCancels ? "primary" : "secondary"} disabled={busy} desktopShortcut={keys ? (enterCancels ? "Enter" : "Esc") : undefined} onPress={cancel} />;
|
|
166
|
+
const noteKey = question?.notePlaceholder !== undefined;
|
|
118
167
|
const keyLine = enterCancels
|
|
119
|
-
?
|
|
168
|
+
? noteKey
|
|
169
|
+
? tf("y {action} · Tab note · Enter or Esc {cancel}", { action: t(confirmLabel).toLowerCase(), cancel: t(cancelLabel).toLowerCase() })
|
|
170
|
+
: tf("y {action} · Enter or Esc {cancel}", { action: t(confirmLabel).toLowerCase(), cancel: t(cancelLabel).toLowerCase() })
|
|
120
171
|
: tf("Enter {action} · Esc cancel", { action: t(confirmLabel).toLowerCase() });
|
|
121
172
|
return (
|
|
122
173
|
<DialogFrame
|
|
@@ -127,6 +178,12 @@ export function ConfirmDialog({
|
|
|
127
178
|
>
|
|
128
179
|
<Box flexDirection="column" {...(desktop ? { style: { width: fitDialogWidth(width) } } : { width })}>
|
|
129
180
|
{renderBody(body)}
|
|
181
|
+
{question && (
|
|
182
|
+
<>
|
|
183
|
+
<Box height={1} />
|
|
184
|
+
<QuestionFields question={question} answer={answer} width={width} disabled={busy} />
|
|
185
|
+
</>
|
|
186
|
+
)}
|
|
130
187
|
{status && (
|
|
131
188
|
<>
|
|
132
189
|
<Box height={1} />
|
|
@@ -134,7 +191,10 @@ export function ConfirmDialog({
|
|
|
134
191
|
</>
|
|
135
192
|
)}
|
|
136
193
|
<Box height={1} />
|
|
137
|
-
<DialogActions
|
|
194
|
+
<DialogActions
|
|
195
|
+
alignEnd={formButtons}
|
|
196
|
+
hints={question && keys ? { keys: [{ key: "↑↓", label: "choose" }, ...noteKey ? [{ key: "Tab", label: "note" }] : []] } : undefined}
|
|
197
|
+
>
|
|
138
198
|
{formButtons ? cancelButton : confirmButton}
|
|
139
199
|
{formButtons ? confirmButton : cancelButton}
|
|
140
200
|
</DialogActions>
|
|
@@ -143,6 +203,175 @@ export function ConfirmDialog({
|
|
|
143
203
|
);
|
|
144
204
|
}
|
|
145
205
|
|
|
206
|
+
interface QuestionAnswer {
|
|
207
|
+
items: ListViewItem[];
|
|
208
|
+
choiceIndex: number;
|
|
209
|
+
note: string;
|
|
210
|
+
noteFocused: boolean;
|
|
211
|
+
noteInputRef: RefObject<InputRenderable | null>;
|
|
212
|
+
/** A click or Space on a choice: picks it, or clears it when it was the one picked. */
|
|
213
|
+
toggle(index: number): void;
|
|
214
|
+
setNote(note: string): void;
|
|
215
|
+
/** Moves the keyboard into the note or out of it, the field's own focus with it. */
|
|
216
|
+
focusNote(focused: boolean): void;
|
|
217
|
+
read(): ConfirmDialogAnswer;
|
|
218
|
+
/**
|
|
219
|
+
* Whether the note has the keys, ahead of the render that shows it. Only the
|
|
220
|
+
* note itself: a field under the dialog that kept the focus takes nothing
|
|
221
|
+
* from the dialog, which answers `y` and Enter as it does without a note.
|
|
222
|
+
*/
|
|
223
|
+
noteHasKeys(event: KeyEventLike): boolean;
|
|
224
|
+
/** A key while the note has the keys: Tab and Enter leave it; the rest is typing. */
|
|
225
|
+
handleNoteKey(event: KeyEventLike): void;
|
|
226
|
+
/**
|
|
227
|
+
* A key while the note does not have them: the arrows pick, Space clears
|
|
228
|
+
* the choice or picks it back, Tab enters the note. True when it was one.
|
|
229
|
+
*/
|
|
230
|
+
handleKey(event: KeyEventLike): boolean;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
function isTabKey(event: KeyEventLike): boolean {
|
|
234
|
+
return event.name === "tab" && !event.ctrl && !event.meta && !event.alt;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
function useQuestionAnswer(question: ConfirmDialogQuestion | undefined): QuestionAnswer {
|
|
238
|
+
const items = useMemo<ListViewItem[]>(() => (question?.choices ?? []).map(({ id, label }) => ({ id, label: t(label) })), [question?.choices]);
|
|
239
|
+
const [choiceIndex, setChoiceIndex] = useState(-1);
|
|
240
|
+
const [note, setNoteState] = useState("");
|
|
241
|
+
const [noteFocused, setNoteFocused] = useState(false);
|
|
242
|
+
// Terminal input can deliver a pick, the note and `y` before React renders.
|
|
243
|
+
const choiceRef = useRef(-1);
|
|
244
|
+
// The choice last picked, where the arrows and Space go on from once it is cleared.
|
|
245
|
+
const cursorRef = useRef(-1);
|
|
246
|
+
const noteRef = useRef("");
|
|
247
|
+
const noteFocusedRef = useRef(false);
|
|
248
|
+
const noteInputRef = useRef<InputRenderable | null>(null);
|
|
249
|
+
const hasNote = question?.notePlaceholder !== undefined;
|
|
250
|
+
const setChoice = (index: number) => {
|
|
251
|
+
if (index < -1 || index >= items.length) return;
|
|
252
|
+
if (index >= 0) cursorRef.current = index;
|
|
253
|
+
choiceRef.current = index;
|
|
254
|
+
setChoiceIndex(index);
|
|
255
|
+
};
|
|
256
|
+
// No reason stays a choice: the picked one clears.
|
|
257
|
+
const toggle = (index: number) => setChoice(index === choiceRef.current ? -1 : index);
|
|
258
|
+
const setNote = (next: string) => {
|
|
259
|
+
noteRef.current = next;
|
|
260
|
+
setNoteState(next);
|
|
261
|
+
};
|
|
262
|
+
const focusNote = (focused: boolean) => {
|
|
263
|
+
const next = focused && hasNote;
|
|
264
|
+
noteFocusedRef.current = next;
|
|
265
|
+
setNoteFocused(next);
|
|
266
|
+
// Now, not on the render the flag makes: the next key must find the field
|
|
267
|
+
// that has it, and a note left must not take Enter or `y` as typing.
|
|
268
|
+
if (next) noteInputRef.current?.focus?.();
|
|
269
|
+
else noteInputRef.current?.blur?.();
|
|
270
|
+
};
|
|
271
|
+
return {
|
|
272
|
+
items,
|
|
273
|
+
choiceIndex,
|
|
274
|
+
note,
|
|
275
|
+
noteFocused,
|
|
276
|
+
noteInputRef,
|
|
277
|
+
toggle,
|
|
278
|
+
setNote,
|
|
279
|
+
focusNote,
|
|
280
|
+
read: () => {
|
|
281
|
+
const choice = question?.choices[choiceRef.current]?.id;
|
|
282
|
+
const trimmed = sliceWholeCharacters(noteRef.current.trim(), question?.noteMaxLength ?? Infinity);
|
|
283
|
+
return { ...(choice ? { choice } : {}), ...(hasNote && trimmed ? { note: trimmed } : {}) };
|
|
284
|
+
},
|
|
285
|
+
noteHasKeys: (event) => {
|
|
286
|
+
if (!noteFocusedRef.current) return false;
|
|
287
|
+
if (event.targetEditable === true && noteInputRef.current?.focused === true) return true;
|
|
288
|
+
// The note lost the keys without saying so: they are the dialog's, and the note stops showing them.
|
|
289
|
+
focusNote(false);
|
|
290
|
+
return false;
|
|
291
|
+
},
|
|
292
|
+
handleNoteKey: (event) => {
|
|
293
|
+
if (!isTabKey(event) && event.name !== "enter" && event.name !== "return") return;
|
|
294
|
+
event.preventDefault();
|
|
295
|
+
event.stopPropagation();
|
|
296
|
+
focusNote(false);
|
|
297
|
+
},
|
|
298
|
+
handleKey: (event) => {
|
|
299
|
+
if (hasNote && isTabKey(event)) {
|
|
300
|
+
event.preventDefault();
|
|
301
|
+
focusNote(true);
|
|
302
|
+
return true;
|
|
303
|
+
}
|
|
304
|
+
if (isPlainKey(event, "space")) {
|
|
305
|
+
event.preventDefault();
|
|
306
|
+
if (cursorRef.current >= 0) toggle(cursorRef.current);
|
|
307
|
+
return true;
|
|
308
|
+
}
|
|
309
|
+
const move = listCursorMove(event, items.length);
|
|
310
|
+
if (!move) return false;
|
|
311
|
+
event.preventDefault();
|
|
312
|
+
setChoice(move(items, choiceRef.current >= 0 ? choiceRef.current : cursorRef.current));
|
|
313
|
+
return true;
|
|
314
|
+
},
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
function QuestionFields({
|
|
319
|
+
question,
|
|
320
|
+
answer,
|
|
321
|
+
width,
|
|
322
|
+
disabled,
|
|
323
|
+
}: {
|
|
324
|
+
question: ConfirmDialogQuestion;
|
|
325
|
+
answer: QuestionAnswer;
|
|
326
|
+
width: number;
|
|
327
|
+
disabled: boolean;
|
|
328
|
+
}) {
|
|
329
|
+
const desktop = useUiHost().kind === "desktop-web";
|
|
330
|
+
const label = t(question.label);
|
|
331
|
+
return (
|
|
332
|
+
<Box flexDirection="column">
|
|
333
|
+
{/* A form label, as a TextField draws its own: bold and a row above its control on the desktop. */}
|
|
334
|
+
<Box height={1}>
|
|
335
|
+
<Text fg={colors.textDim} attributes={desktop ? TextAttributes.BOLD : 0}>{label}</Text>
|
|
336
|
+
</Box>
|
|
337
|
+
{desktop && <Box height={1} />}
|
|
338
|
+
<ListView
|
|
339
|
+
items={answer.items}
|
|
340
|
+
selectedIndex={answer.choiceIndex}
|
|
341
|
+
remoteLabel={label}
|
|
342
|
+
rowGap={0}
|
|
343
|
+
surface="framed"
|
|
344
|
+
height={answer.items.length}
|
|
345
|
+
// Enter answers the dialog, a focused choice too: Space picks or clears it.
|
|
346
|
+
checkboxRows
|
|
347
|
+
onSelect={(index) => {
|
|
348
|
+
if (disabled) return;
|
|
349
|
+
answer.focusNote(false);
|
|
350
|
+
answer.toggle(index);
|
|
351
|
+
}}
|
|
352
|
+
/>
|
|
353
|
+
{question.notePlaceholder !== undefined && (
|
|
354
|
+
<>
|
|
355
|
+
<Box height={1} />
|
|
356
|
+
<TextField
|
|
357
|
+
accessibleLabel={t(question.notePlaceholder)}
|
|
358
|
+
value={answer.note}
|
|
359
|
+
placeholder={t(question.notePlaceholder)}
|
|
360
|
+
maxLength={question.noteMaxLength}
|
|
361
|
+
focused={answer.noteFocused}
|
|
362
|
+
inputRef={answer.noteInputRef}
|
|
363
|
+
disabled={disabled}
|
|
364
|
+
width={desktop ? undefined : width}
|
|
365
|
+
onMouseDown={() => answer.focusNote(true)}
|
|
366
|
+
onBlur={() => answer.focusNote(false)}
|
|
367
|
+
onChange={answer.setNote}
|
|
368
|
+
/>
|
|
369
|
+
</>
|
|
370
|
+
)}
|
|
371
|
+
</Box>
|
|
372
|
+
);
|
|
373
|
+
}
|
|
374
|
+
|
|
146
375
|
export type ConfirmDialogOptions = Omit<ConfirmDialogProps, keyof PromptContext<boolean>> & {
|
|
147
376
|
/** A click on the backdrop cancels. On by default. */
|
|
148
377
|
closeOnClickOutside?: boolean;
|
|
@@ -163,6 +392,23 @@ export async function confirmDialog(
|
|
|
163
392
|
return confirmed === true;
|
|
164
393
|
}
|
|
165
394
|
|
|
395
|
+
/**
|
|
396
|
+
* A confirmDialog that asks `question` under its body: the answer when the
|
|
397
|
+
* person confirms, empty when they skipped the question, and null when they
|
|
398
|
+
* cancelled (Cancel, Esc, a click outside or a failed dialog).
|
|
399
|
+
*/
|
|
400
|
+
export async function confirmDialogWithAnswer(
|
|
401
|
+
dialog: DialogApi,
|
|
402
|
+
{ closeOnClickOutside = true, ...props }: ConfirmDialogOptions & { question: ConfirmDialogQuestion },
|
|
403
|
+
): Promise<ConfirmDialogAnswer | null> {
|
|
404
|
+
let answer: ConfirmDialogAnswer = {};
|
|
405
|
+
const confirmed = await dialog.prompt<boolean>({
|
|
406
|
+
closeOnClickOutside,
|
|
407
|
+
content: (context) => <ConfirmDialog {...context} {...props} onAnswer={(next) => { answer = next; }} />,
|
|
408
|
+
}).catch(logFailure("ui.confirm-dialog", "Open confirm dialog failed", false));
|
|
409
|
+
return confirmed === true ? answer : null;
|
|
410
|
+
}
|
|
411
|
+
|
|
166
412
|
function renderBody(body: ReactNode | string | string[]): ReactNode {
|
|
167
413
|
if (Array.isArray(body)) {
|
|
168
414
|
return body.map((line, index) => (
|