@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
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
ScrollBox,
|
|
27
27
|
Textarea,
|
|
28
28
|
TextAttributes,
|
|
29
|
+
useRendererHost,
|
|
29
30
|
useUiCapabilities,
|
|
30
31
|
type ScrollBoxRenderable,
|
|
31
32
|
type TextareaRenderable,
|
|
@@ -33,7 +34,7 @@ import {
|
|
|
33
34
|
import { useDialog, type AlertContext } from "../../../ui/dialog";
|
|
34
35
|
import type { SelectControl } from "../../../components/ui/select-button";
|
|
35
36
|
import { FRAMED_TEXTAREA_DESKTOP_STYLE, fieldFrameStyle } from "../../../components/ui/fields";
|
|
36
|
-
import { apiClient, type AccountProfile, type CloudPricing } from "../../../api-client";
|
|
37
|
+
import { apiClient, type AccountProfile, type CloudPricing, type ReferralInvite } from "../../../api-client";
|
|
37
38
|
import { chatController } from "../chat/controller";
|
|
38
39
|
import { SignInWall } from "../cloud/auth-actions";
|
|
39
40
|
import { loadUpgradeOffer } from "../../../account/upgrade-dialog";
|
|
@@ -72,6 +73,7 @@ import { DeleteAccountPasswordDialog, PasswordChangeDialog } from "./password-di
|
|
|
72
73
|
import { deleteAccountConfirmingSession } from "./delete-account";
|
|
73
74
|
import { endTrialAfterWarning } from "./trial-cancel";
|
|
74
75
|
import { CalendarAccountTab } from "./calendar-tab";
|
|
76
|
+
import { InviteRow } from "./invite-row";
|
|
75
77
|
import { useAccountManagementFooter } from "./footer";
|
|
76
78
|
import { useAccountManagementKeyboard } from "./keyboard";
|
|
77
79
|
import {
|
|
@@ -128,8 +130,8 @@ const ACCOUNT_TAB_FIELD_ORDER: Record<AccountManagementTab, AccountFieldKey[]> =
|
|
|
128
130
|
],
|
|
129
131
|
// Its actions are footer hints; the tab owns its footer.
|
|
130
132
|
calendar: [],
|
|
131
|
-
// Cancel Trial shows only while a trial runs.
|
|
132
|
-
pro: ["upgradeAction", "cancelTrialAction"],
|
|
133
|
+
// Cancel Trial shows only while a trial runs, the invite once it loaded.
|
|
134
|
+
pro: ["upgradeAction", "cancelTrialAction", "inviteCopyAction"],
|
|
133
135
|
// The Teams tab owns its own keyboard handling (a list, not form fields).
|
|
134
136
|
teams: [],
|
|
135
137
|
// Remote assistants allowed to drive this terminal; a list with its own footer.
|
|
@@ -230,6 +232,8 @@ export function AccountManagementPane({ focused, width, height }: PaneProps) {
|
|
|
230
232
|
const [pricing, setPricing] = useState<CloudPricing | null>(null);
|
|
231
233
|
// Null until the server says; only a confirmed trial is offered.
|
|
232
234
|
const [trialAvailable, setTrialAvailable] = useState<boolean | null>(null);
|
|
235
|
+
// The Pro tab's invite link; null until it loads, and when it cannot.
|
|
236
|
+
const [invite, setInvite] = useState<ReferralInvite | null>(null);
|
|
233
237
|
const [draft, setDraft] = useState<AccountDraft>(() => profileToDraft(null));
|
|
234
238
|
const [activeTab, setActiveTab] = usePluginPaneState<AccountManagementTab>("activeTab", "profile");
|
|
235
239
|
const [activeField, setActiveField] = useState<AccountFieldKey>(
|
|
@@ -268,8 +272,9 @@ export function AccountManagementPane({ focused, width, height }: PaneProps) {
|
|
|
268
272
|
if (field === "showLocalTime" || field === "showDesks") return chatCardSupported;
|
|
269
273
|
if (field === "desks") return chatCardSupported && draft.showDesks;
|
|
270
274
|
if (field === "cancelTrialAction") return planAccess.isTrialActive;
|
|
275
|
+
if (field === "inviteCopyAction") return invite !== null;
|
|
271
276
|
return true;
|
|
272
|
-
}), [activeTab, chatCardSupported, draft.showDesks, planAccess.isTrialActive]);
|
|
277
|
+
}), [activeTab, chatCardSupported, draft.showDesks, invite, planAccess.isTrialActive]);
|
|
273
278
|
const accountTabs = ACCOUNT_TAB_DEFS.map((tab) => ({ ...tab, label: t(tab.label) }));
|
|
274
279
|
|
|
275
280
|
const planPrice = useMemo(() => formatCloudMonthlyPrice(pricing), [language, pricing]);
|
|
@@ -519,6 +524,24 @@ export function AccountManagementPane({ focused, width, height }: PaneProps) {
|
|
|
519
524
|
};
|
|
520
525
|
}, [sessionMarker]);
|
|
521
526
|
|
|
527
|
+
// The invite link is read when the Pro tab opens, and again for another
|
|
528
|
+
// account: one account's link must never show under another's.
|
|
529
|
+
const proTabOpen = activeTab === "pro";
|
|
530
|
+
useEffect(() => {
|
|
531
|
+
setInvite(null);
|
|
532
|
+
if (!proTabOpen || !apiClient.isSignedIn()) return;
|
|
533
|
+
let cancelled = false;
|
|
534
|
+
void apiClient.getReferralInvite()
|
|
535
|
+
.then((next) => {
|
|
536
|
+
if (!cancelled) setInvite(next);
|
|
537
|
+
})
|
|
538
|
+
// A server without invites, or a failed read, leaves the row out.
|
|
539
|
+
.catch(logFailure("account-management.pane", "Load invite link failed"));
|
|
540
|
+
return () => {
|
|
541
|
+
cancelled = true;
|
|
542
|
+
};
|
|
543
|
+
}, [proTabOpen, sessionMarker]);
|
|
544
|
+
|
|
522
545
|
useEffect(() => {
|
|
523
546
|
if (!hasSession || !apiClient.isSignedIn()) return;
|
|
524
547
|
if (syncStatus.phase !== "synced" || syncStatus.revision == null) return;
|
|
@@ -757,7 +780,7 @@ export function AccountManagementPane({ focused, width, height }: PaneProps) {
|
|
|
757
780
|
const result = await endTrialAfterWarning(
|
|
758
781
|
dialog,
|
|
759
782
|
planAccess,
|
|
760
|
-
() => apiClient.endCloudTrial(),
|
|
783
|
+
(feedback) => apiClient.endCloudTrial(feedback),
|
|
761
784
|
() => {
|
|
762
785
|
setBusy("trial");
|
|
763
786
|
setMessage({ tone: "info", text: t("Ending trial...") });
|
|
@@ -784,6 +807,17 @@ export function AccountManagementPane({ focused, width, height }: PaneProps) {
|
|
|
784
807
|
}
|
|
785
808
|
}, [busy, dialog, planAccess]);
|
|
786
809
|
|
|
810
|
+
const renderer = useRendererHost();
|
|
811
|
+
const copyInvite = useCallback(() => {
|
|
812
|
+
setActiveField("inviteCopyAction");
|
|
813
|
+
if (!invite) return;
|
|
814
|
+
void renderer.copyText(invite.url).then(
|
|
815
|
+
() => setMessage({ tone: "success", text: t("Link copied.") }),
|
|
816
|
+
// A terminal without clipboard access: the link is selectable on the row.
|
|
817
|
+
() => setMessage({ tone: "info", text: t("Copy failed. Select the link instead.") }),
|
|
818
|
+
);
|
|
819
|
+
}, [invite, renderer]);
|
|
820
|
+
|
|
787
821
|
useAccountManagementFooter({
|
|
788
822
|
busy,
|
|
789
823
|
// The Calendar and Agents tabs save nothing and show their own status.
|
|
@@ -799,6 +833,7 @@ export function AccountManagementPane({ focused, width, height }: PaneProps) {
|
|
|
799
833
|
deleteAccount,
|
|
800
834
|
draftRef,
|
|
801
835
|
endTrial,
|
|
836
|
+
copyInvite,
|
|
802
837
|
fieldOrder,
|
|
803
838
|
// Behind the sign-in wall the fields are not there, and Enter is the wall's.
|
|
804
839
|
focused: focused && activeTab !== "teams" && activeTab !== "calendar" && activeTab !== "agents" && (hasSession || apiClient.isSignedIn()),
|
|
@@ -1053,6 +1088,17 @@ export function AccountManagementPane({ focused, width, height }: PaneProps) {
|
|
|
1053
1088
|
</Box>
|
|
1054
1089
|
) : null}
|
|
1055
1090
|
</Box>
|
|
1091
|
+
{invite ? (
|
|
1092
|
+
<InviteRow
|
|
1093
|
+
invite={invite}
|
|
1094
|
+
active={activeField === "inviteCopyAction"}
|
|
1095
|
+
width={contentWidth}
|
|
1096
|
+
labelWidth={formLabelWidth}
|
|
1097
|
+
nodeRef={fieldNodeRef("inviteCopyAction")}
|
|
1098
|
+
onCopy={copyInvite}
|
|
1099
|
+
onFocus={() => setActiveField("inviteCopyAction")}
|
|
1100
|
+
/>
|
|
1101
|
+
) : null}
|
|
1056
1102
|
</>
|
|
1057
1103
|
) : null}
|
|
1058
1104
|
|
|
@@ -1,25 +1,40 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { confirmDialogWithAnswer } from "../../../components/ui/confirm-dialog";
|
|
2
2
|
import { formatTrialEnd } from "../../../account/billing";
|
|
3
3
|
import { t, tf } from "../../../i18n";
|
|
4
|
+
import { CLOUD_CANCEL_COMMENT_MAX } from "../../../api-client";
|
|
5
|
+
import type { CloudCancelFeedback, CloudCancelReason } from "../../../api-client";
|
|
4
6
|
import type { PlanAccess } from "../../../api-client/plan-rules";
|
|
5
7
|
import type { DialogApi } from "../../../ui/dialog";
|
|
6
8
|
|
|
9
|
+
/** The reasons gloom.sh's cancel window offers, in its words and order. */
|
|
10
|
+
const CANCEL_REASONS: ReadonlyArray<{ id: CloudCancelReason; label: string }> = [
|
|
11
|
+
{ id: "bugs", label: "Bugs or reliability" },
|
|
12
|
+
{ id: "missing_feature", label: "Missing feature" },
|
|
13
|
+
{ id: "too_expensive", label: "Too expensive" },
|
|
14
|
+
{ id: "not_using", label: "Not using it enough" },
|
|
15
|
+
{ id: "temporary", label: "Only needed it temporarily" },
|
|
16
|
+
{ id: "other", label: "Other" },
|
|
17
|
+
];
|
|
18
|
+
|
|
7
19
|
/**
|
|
8
20
|
* Ends a Pro trial the way the account page on gloom.sh does: first a warning
|
|
9
21
|
* that it ends the trial and Pro now, and only a confirmed answer reaches the
|
|
10
22
|
* server. Ending Pro cannot be undone, so a stray Enter keeps the trial; `y`
|
|
11
|
-
* or End Trial Now ends it.
|
|
12
|
-
*
|
|
23
|
+
* or End Trial Now ends it. The warning also asks why, as the cancel window
|
|
24
|
+
* on gloom.sh does, but nothing there is required and it adds no step: the
|
|
25
|
+
* reason and note picked go with the request, and none go when none were.
|
|
26
|
+
* Null when the person kept the trial, or when no trial is running (a stale
|
|
27
|
+
* key or click after it ended), which asks nothing.
|
|
13
28
|
*/
|
|
14
29
|
export async function endTrialAfterWarning(
|
|
15
30
|
dialog: DialogApi,
|
|
16
31
|
trial: Pick<PlanAccess, "isTrialActive" | "trialEndsAt">,
|
|
17
|
-
end: () => Promise<{ endedNow?: boolean }>,
|
|
32
|
+
end: (feedback: CloudCancelFeedback) => Promise<{ endedNow?: boolean }>,
|
|
18
33
|
onConfirmed?: () => void,
|
|
19
34
|
): Promise<{ endedNow: boolean } | null> {
|
|
20
35
|
if (!trial.isTrialActive) return null;
|
|
21
36
|
const date = formatTrialEnd(trial.trialEndsAt);
|
|
22
|
-
const
|
|
37
|
+
const answer = await confirmDialogWithAnswer(dialog, {
|
|
23
38
|
closeOnClickOutside: false,
|
|
24
39
|
title: t("Cancel Trial?"),
|
|
25
40
|
body: [
|
|
@@ -32,9 +47,19 @@ export async function endTrialAfterWarning(
|
|
|
32
47
|
cancelLabel: t("Keep Trial"),
|
|
33
48
|
confirmVariant: "danger",
|
|
34
49
|
defaultAction: "cancel",
|
|
50
|
+
question: {
|
|
51
|
+
label: "What made you decide to cancel? (optional)",
|
|
52
|
+
choices: CANCEL_REASONS,
|
|
53
|
+
notePlaceholder: "Anything else? (optional)",
|
|
54
|
+
noteMaxLength: CLOUD_CANCEL_COMMENT_MAX,
|
|
55
|
+
},
|
|
35
56
|
});
|
|
36
|
-
if (!
|
|
57
|
+
if (!answer) return null;
|
|
37
58
|
onConfirmed?.();
|
|
38
|
-
const
|
|
59
|
+
const reason = CANCEL_REASONS.find(({ id }) => id === answer.choice)?.id;
|
|
60
|
+
const result = await end({
|
|
61
|
+
...(reason ? { reason } : {}),
|
|
62
|
+
...(answer.note ? { comment: answer.note } : {}),
|
|
63
|
+
});
|
|
39
64
|
return { endedNow: result.endedNow === true };
|
|
40
65
|
}
|
|
@@ -317,7 +317,7 @@ export function BrokerDetailContent({
|
|
|
317
317
|
// The row's STATUS, and in full what the last action on the profile came to,
|
|
318
318
|
// which outranks the profile's own status message until it is news no more.
|
|
319
319
|
// The sign-in's end has a line of its own below.
|
|
320
|
-
const status = brokerRowStatus({ ...row,
|
|
320
|
+
const status = brokerRowStatus({ ...row, signInEnd: null }, activity);
|
|
321
321
|
const note = activity.note ?? null;
|
|
322
322
|
const detailStatusMessage = note?.text ?? (row.message || t("No status message."));
|
|
323
323
|
const statusMessageColor = note
|
|
@@ -340,8 +340,10 @@ export function BrokerDetailContent({
|
|
|
340
340
|
<Text fg={statusMessageColor} width={width} wrapText>
|
|
341
341
|
{detailStatusMessage}
|
|
342
342
|
</Text>
|
|
343
|
-
{row.
|
|
344
|
-
<Text fg={colors.warning} width={width} wrapText>
|
|
343
|
+
{row.signInEnd !== null && (
|
|
344
|
+
<Text fg={row.signInEnd.soon ? colors.warning : colors.textDim} width={width} wrapText>
|
|
345
|
+
{signInEndNote(row.signInEnd.endsAt)}
|
|
346
|
+
</Text>
|
|
345
347
|
)}
|
|
346
348
|
<Text fg={colors.textMuted}>{tf("Last sync {time}", { time: formatRelativeAge(row.lastSyncedAt) })}</Text>
|
|
347
349
|
{row.instance.localOnly ? <Text fg={colors.textMuted}>{t("Account data stays on this device, out of Gloom Cloud")}</Text> : null}
|
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
type BrokerProfileRow,
|
|
38
38
|
} from "./model";
|
|
39
39
|
import { useBrokerManagerActions } from "./pane-actions";
|
|
40
|
-
import {
|
|
40
|
+
import { useSignInReads } from "./sign-in-end";
|
|
41
41
|
import {
|
|
42
42
|
buildBrokerColumns,
|
|
43
43
|
renderBrokerCell,
|
|
@@ -82,10 +82,10 @@ export function BrokersPane({ focused, width, height }: PaneProps) {
|
|
|
82
82
|
|
|
83
83
|
// Signed-in profiles take their broker's name from the connector list.
|
|
84
84
|
const signedInBrokers = useSyncExternalStore(subscribeSignedInBrokers, getSignedInBrokers, getSignedInBrokers);
|
|
85
|
-
const {
|
|
85
|
+
const { reads: signInReads, reload: reloadSignInReads } = useSignInReads(config.brokerInstances);
|
|
86
86
|
const rows = useMemo(
|
|
87
|
-
() => buildBrokerProfileRows(config, adapters, brokerAccounts,
|
|
88
|
-
[adapters, brokerAccounts, brokerSyncErrors, config, getBrokerLogo, language,
|
|
87
|
+
() => buildBrokerProfileRows(config, adapters, brokerAccounts, signInReads, getBrokerLogo, brokerSyncErrors),
|
|
88
|
+
[adapters, brokerAccounts, brokerSyncErrors, config, getBrokerLogo, language, signInReads, signedInBrokers, statusVersion],
|
|
89
89
|
);
|
|
90
90
|
const selectedIndex = Math.max(0, rows.findIndex((row) => row.id === selectedId));
|
|
91
91
|
const selectedRow = rows[selectedIndex] ?? null;
|
|
@@ -115,8 +115,8 @@ export function BrokersPane({ focused, width, height }: PaneProps) {
|
|
|
115
115
|
// After a connect or sync, which can renew a sign-in or find it ended.
|
|
116
116
|
const refreshStatuses = useCallback(() => {
|
|
117
117
|
setStatusVersion((version) => version + 1);
|
|
118
|
-
|
|
119
|
-
}, [
|
|
118
|
+
reloadSignInReads();
|
|
119
|
+
}, [reloadSignInReads]);
|
|
120
120
|
|
|
121
121
|
const {
|
|
122
122
|
busy,
|
|
@@ -4,7 +4,8 @@ import type { AppConfig, BrokerInstanceConfig } from "../../../types/config";
|
|
|
4
4
|
import type { BrokerAccount } from "../../../types/trading";
|
|
5
5
|
import { formatCurrency } from "../../../utils/format";
|
|
6
6
|
import { t } from "../../../i18n";
|
|
7
|
-
import type {
|
|
7
|
+
import type { BrokerReplacePrompt } from "../../../brokers/signed-in/client";
|
|
8
|
+
import type { SignInEnd, SignInReads } from "./sign-in-end";
|
|
8
9
|
|
|
9
10
|
export type BrokerDisplayState =
|
|
10
11
|
| "disabled"
|
|
@@ -28,8 +29,14 @@ export interface BrokerProfileRow {
|
|
|
28
29
|
accountCount: number;
|
|
29
30
|
accountSummary: string;
|
|
30
31
|
accountIds: string[];
|
|
31
|
-
/** When the broker ends this profile's sign-in,
|
|
32
|
-
|
|
32
|
+
/** When the broker ends this profile's live sign-in, for a broker that ends it on a clock. */
|
|
33
|
+
signInEnd: SignInEnd | null;
|
|
34
|
+
/**
|
|
35
|
+
* Whether the broker will or may ask to replace the Gloom connection it
|
|
36
|
+
* lists when this profile signs in again, as Gloom says; undefined when
|
|
37
|
+
* Gloom has not said (a server that predates it, or no read yet).
|
|
38
|
+
*/
|
|
39
|
+
replacePrompt?: BrokerReplacePrompt | null;
|
|
33
40
|
/** The broker's logo for the desktop and the web (brokers/logos.ts); null draws its initial. */
|
|
34
41
|
logo: string | null;
|
|
35
42
|
instance: BrokerInstanceConfig;
|
|
@@ -123,7 +130,7 @@ export function buildBrokerProfileRows(
|
|
|
123
130
|
config: AppConfig,
|
|
124
131
|
adapters: ReadonlyMap<string, BrokerAdapter | null>,
|
|
125
132
|
brokerAccounts: Record<string, BrokerAccount[]>,
|
|
126
|
-
|
|
133
|
+
signInReads: SignInReads = new Map(),
|
|
127
134
|
pluginLogo: BrokerPluginLogo = () => null,
|
|
128
135
|
syncErrors: Readonly<Record<string, string>> = {},
|
|
129
136
|
): BrokerProfileRow[] {
|
|
@@ -163,9 +170,11 @@ export function buildBrokerProfileRows(
|
|
|
163
170
|
accountSummary: summarizeBrokerAccounts(accounts),
|
|
164
171
|
accountIds: accounts.map((account) => account.accountId),
|
|
165
172
|
// Say nothing next to a failure or a profile that does not connect.
|
|
166
|
-
|
|
173
|
+
signInEnd: state.state === "error" || state.state === "sign-in" || state.state === "disabled" || state.state === "unavailable"
|
|
167
174
|
? null
|
|
168
|
-
:
|
|
175
|
+
: signInReads.get(instance.id)?.end ?? null,
|
|
176
|
+
// Said for an ended sign-in too: it is the next sign-in the broker asks about.
|
|
177
|
+
replacePrompt: signInReads.get(instance.id)?.replacePrompt,
|
|
169
178
|
logo: brokerProfileLogo(instance, adapter, pluginLogo),
|
|
170
179
|
instance,
|
|
171
180
|
adapter,
|
|
@@ -182,12 +182,19 @@ export function useBrokerManagerActions({
|
|
|
182
182
|
const { id, label } = selectedRow;
|
|
183
183
|
startRowAction(id, t("Connecting…"));
|
|
184
184
|
try {
|
|
185
|
-
// A connected broker is connected again only by a new sign-in: this renews it before the broker ends it
|
|
186
|
-
// A row that says when the sign-in ends is renewable before this
|
|
187
|
-
|
|
185
|
+
// A connected broker is connected again only by a new sign-in: this renews it before the broker ends it,
|
|
186
|
+
// at any time, for a new full lifetime. A row that says when the sign-in ends is renewable before this
|
|
187
|
+
// session's first sync too.
|
|
188
|
+
const renew = selectedRow.state === "connected" || selectedRow.signInEnd !== null;
|
|
189
|
+
// What the broker will ask about the Gloom connection it lists, as Gloom says: also after the broker ended
|
|
190
|
+
// the sign-in on its clock, and not after another app took the account. A Gloom server that predates it
|
|
191
|
+
// says nothing; then a renewal of a single-connection broker is the one case known to ask.
|
|
192
|
+
const replace = selectedRow.replacePrompt !== undefined
|
|
193
|
+
? selectedRow.replacePrompt
|
|
194
|
+
: renew && broker.capabilities.singleConnection ? "will" : null;
|
|
188
195
|
let signedIn: boolean;
|
|
189
196
|
try {
|
|
190
|
-
signedIn = await requestBrokerSignIn(broker, { renew });
|
|
197
|
+
signedIn = await requestBrokerSignIn(broker, { renew, replace });
|
|
191
198
|
} catch (error) {
|
|
192
199
|
setRowNote(id, {
|
|
193
200
|
tone: "error",
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { useCallback, useMemo, useSyncExternalStore } from "react";
|
|
2
2
|
import { apiClient } from "../../../api-client";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
type BrokerReplacePrompt,
|
|
5
|
+
fetchSignedInBrokerConnection,
|
|
6
|
+
type SignedInBrokerConnection,
|
|
7
|
+
} from "../../../brokers/signed-in/client";
|
|
4
8
|
import { isSignedInBrokerProfile, signedInBrokerId } from "../../../brokers/signed-in/profile";
|
|
5
9
|
import { tf } from "../../../i18n";
|
|
6
10
|
import { useAsyncResource } from "../../../react/async-resource";
|
|
@@ -9,16 +13,41 @@ import { formatDetailDate, formatShortDate } from "../../../utils/datetime-forma
|
|
|
9
13
|
|
|
10
14
|
/**
|
|
11
15
|
* Some brokers end a sign-in on their own clock, however often it was
|
|
12
|
-
* refreshed
|
|
13
|
-
*
|
|
16
|
+
* refreshed (IBKR: seven days after consent). While such a sign-in is live the
|
|
17
|
+
* pane always says when it ends, and Connect renews it early; Gloom flags the
|
|
18
|
+
* last stretch (`soon`), when it is time to renew. A broker with no such
|
|
19
|
+
* clock, or a sign-in that is not live, has no end to show.
|
|
14
20
|
*/
|
|
15
|
-
export
|
|
21
|
+
export interface SignInEnd {
|
|
22
|
+
endsAt: number;
|
|
23
|
+
/** Gloom says it is time to renew: within its warning window, or past the end. */
|
|
24
|
+
soon: boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** What Gloom says about a profile's sign-in: when it ends, and what the broker asks on the next one. */
|
|
28
|
+
export interface SignInRead {
|
|
29
|
+
end: SignInEnd | null;
|
|
30
|
+
/**
|
|
31
|
+
* Whether the broker will or may ask to replace the Gloom connection it
|
|
32
|
+
* lists when the user signs in again; undefined from a Gloom server that
|
|
33
|
+
* predates it.
|
|
34
|
+
*/
|
|
35
|
+
replacePrompt?: BrokerReplacePrompt | null;
|
|
36
|
+
}
|
|
16
37
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
38
|
+
export type SignInReads = ReadonlyMap<string, SignInRead>;
|
|
39
|
+
|
|
40
|
+
/** When the broker ends the live sign-in, and whether Gloom says to renew it now. */
|
|
41
|
+
export function signInEndOf(connection: Pick<SignedInBrokerConnection, "expiresAt" | "expiresSoon">): SignInEnd | null {
|
|
42
|
+
if (!connection.expiresAt) return null;
|
|
20
43
|
const endsAt = Date.parse(connection.expiresAt);
|
|
21
|
-
return Number.isFinite(endsAt) ? endsAt : null;
|
|
44
|
+
return Number.isFinite(endsAt) ? { endsAt, soon: connection.expiresSoon === true } : null;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** What Gloom says about the account's connection to a broker. */
|
|
48
|
+
export function signInReadOf(connection: SignedInBrokerConnection): SignInRead {
|
|
49
|
+
const end = signInEndOf(connection);
|
|
50
|
+
return "replacePrompt" in connection ? { end, replacePrompt: connection.replacePrompt ?? null } : { end };
|
|
22
51
|
}
|
|
23
52
|
|
|
24
53
|
/** The profile row's status, in the place of "Connected": "Ends Oct 10". */
|
|
@@ -34,13 +63,15 @@ export function signInEndNote(endsAt: number, now = Date.now()): string {
|
|
|
34
63
|
}
|
|
35
64
|
|
|
36
65
|
/**
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
66
|
+
* What Gloom says about each signed-in profile's sign-in, by instance id: when
|
|
67
|
+
* it ends, for a broker that ends it on a clock, and whether the broker will
|
|
68
|
+
* ask to replace Gloom's connection on the next one. Read from Gloom when the
|
|
69
|
+
* pane opens and after a connect or sync; a failed read is the same as
|
|
70
|
+
* nothing to say.
|
|
40
71
|
*/
|
|
41
|
-
export function
|
|
72
|
+
export function useSignInReads(
|
|
42
73
|
instances: readonly BrokerInstanceConfig[],
|
|
43
|
-
): {
|
|
74
|
+
): { reads: SignInReads; reload: () => void } {
|
|
44
75
|
const profiles = useMemo(
|
|
45
76
|
() => instances.flatMap((instance) => isSignedInBrokerProfile(instance) && instance.enabled !== false
|
|
46
77
|
? [{ id: instance.id, broker: signedInBrokerId(instance) }]
|
|
@@ -59,7 +90,7 @@ export function useSignInEnds(
|
|
|
59
90
|
? async () => {
|
|
60
91
|
const reads = await Promise.all(brokerKey.split(",").map(async (broker) => {
|
|
61
92
|
try {
|
|
62
|
-
return [broker,
|
|
93
|
+
return [broker, signInReadOf(await fetchSignedInBrokerConnection(broker))] as const;
|
|
63
94
|
} catch {
|
|
64
95
|
return [broker, null] as const;
|
|
65
96
|
}
|
|
@@ -69,14 +100,14 @@ export function useSignInEnds(
|
|
|
69
100
|
: null, [brokerKey, signedIn]);
|
|
70
101
|
const { data, reload } = useAsyncResource(loader, { keepPreviousData: true });
|
|
71
102
|
|
|
72
|
-
const
|
|
73
|
-
const byInstance = new Map<string,
|
|
103
|
+
const reads = useMemo<SignInReads>(() => {
|
|
104
|
+
const byInstance = new Map<string, SignInRead>();
|
|
74
105
|
for (const profile of profiles) {
|
|
75
|
-
const
|
|
76
|
-
if (
|
|
106
|
+
const read = data?.get(profile.broker);
|
|
107
|
+
if (read) byInstance.set(profile.id, read);
|
|
77
108
|
}
|
|
78
109
|
return byInstance;
|
|
79
110
|
}, [data, profiles]);
|
|
80
111
|
const refresh = useCallback(() => { reload(); }, [reload]);
|
|
81
|
-
return {
|
|
112
|
+
return { reads, reload: refresh };
|
|
82
113
|
}
|
|
@@ -45,15 +45,21 @@ export function buildBrokerColumns(width: number): BrokerColumn[] {
|
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
47
|
* What a profile's STATUS says, in the table and atop its detail: the action
|
|
48
|
-
* running on it, then the one that just failed on it, then
|
|
49
|
-
*
|
|
48
|
+
* running on it, then the one that just failed on it, then when the broker
|
|
49
|
+
* ends its sign-in, then its own state ("Disabled", "Sign-in needed").
|
|
50
50
|
*/
|
|
51
51
|
export function brokerRowStatus(row: BrokerProfileRow, activity: BrokerRowActivity = {}): { text: string; color: string } {
|
|
52
52
|
if (activity.busy) return { text: activity.busy, color: colors.warning };
|
|
53
53
|
// A sign-in the broker wants says more than which step ran into it.
|
|
54
54
|
if (activity.note?.status && row.state !== "sign-in") return { text: activity.note.status, color: colors.negative };
|
|
55
|
-
// A sign-in the broker
|
|
56
|
-
|
|
55
|
+
// A sign-in the broker ends on its clock says when, in place of "Connected";
|
|
56
|
+
// in the profile's state colour until it is time to renew.
|
|
57
|
+
if (row.signInEnd !== null) {
|
|
58
|
+
return {
|
|
59
|
+
text: signInEndStatus(row.signInEnd.endsAt),
|
|
60
|
+
color: row.signInEnd.soon ? colors.warning : stateColor(row.state),
|
|
61
|
+
};
|
|
62
|
+
}
|
|
57
63
|
return { text: row.stateLabel, color: stateColor(row.state) };
|
|
58
64
|
}
|
|
59
65
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ActionRow } from "../../../components/ui/action-row";
|
|
2
2
|
import { Icon } from "../../../components/ui/icon";
|
|
3
|
-
import { useMemo, useSyncExternalStore } from "react";
|
|
3
|
+
import { useMemo, useRef, useSyncExternalStore, type ReactNode } from "react";
|
|
4
4
|
import {
|
|
5
5
|
getPaneSidebarWidthRange,
|
|
6
6
|
PaneSidebar,
|
|
@@ -8,7 +8,8 @@ import {
|
|
|
8
8
|
PaneSidebarList,
|
|
9
9
|
PaneSidebarRow,
|
|
10
10
|
} from "../../../components";
|
|
11
|
-
import {
|
|
11
|
+
import { usePaneSidebarReveal } from "../../../components/layout/pane/sidebar";
|
|
12
|
+
import { Box, Span, Text, useUiCapabilities, type BoxRenderable } from "../../../ui";
|
|
12
13
|
import { TextAttributes } from "../../../ui";
|
|
13
14
|
import { blendHex, colors } from "../../../theme/colors";
|
|
14
15
|
import { t } from "../../../i18n";
|
|
@@ -65,6 +66,22 @@ function ChannelNotificationIcon({
|
|
|
65
66
|
);
|
|
66
67
|
}
|
|
67
68
|
|
|
69
|
+
/** A section's header, kept in view while the keyboard's cursor is on it. */
|
|
70
|
+
function SectionHeaderRow({ width, cursor, backgroundColor, children }: {
|
|
71
|
+
width: number;
|
|
72
|
+
cursor: boolean;
|
|
73
|
+
backgroundColor: string;
|
|
74
|
+
children: ReactNode;
|
|
75
|
+
}) {
|
|
76
|
+
const ref = useRef<BoxRenderable>(null);
|
|
77
|
+
usePaneSidebarReveal(ref, cursor);
|
|
78
|
+
return (
|
|
79
|
+
<Box ref={ref} height={1} width={width} flexDirection="row" backgroundColor={backgroundColor}>
|
|
80
|
+
{children}
|
|
81
|
+
</Box>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
68
85
|
function ProfileIcon({
|
|
69
86
|
color,
|
|
70
87
|
onMouseDown,
|
|
@@ -182,13 +199,12 @@ export function ChannelSidebar({
|
|
|
182
199
|
onResizeEnd: (nextWidth) => chatSidebarStore.commitWidth(nextWidth),
|
|
183
200
|
} : undefined}
|
|
184
201
|
>
|
|
185
|
-
{({ backgroundColor: sidebarBg, listWidth }) => {
|
|
186
|
-
const labelWidth = Math.max(listWidth - CHANNEL_ROW_INDENT - notificationWidth, 1);
|
|
202
|
+
{({ backgroundColor: sidebarBg, listWidth: sidebarWidth }) => {
|
|
187
203
|
// The fill a keyboard-focused sidebar gives the row under its cursor.
|
|
188
204
|
const cursorBackground = blendHex(colors.selected, colors.borderFocused, 0.32);
|
|
189
205
|
// Every section reads the same: a caret, a label, and an optional
|
|
190
206
|
// trailing action, so their channels can all share one indent.
|
|
191
|
-
const sectionHeader = ({ key, label, fg, unread, expanded, onToggle, action }: {
|
|
207
|
+
const sectionHeader = (listWidth: number, { key, label, fg, unread, expanded, onToggle, action }: {
|
|
192
208
|
key: string;
|
|
193
209
|
label: string;
|
|
194
210
|
fg?: string;
|
|
@@ -198,13 +214,13 @@ export function ChannelSidebar({
|
|
|
198
214
|
action?: { ariaLabel: string; onPress: () => void };
|
|
199
215
|
}) => {
|
|
200
216
|
const rowWidth = Math.max(1, listWidth - (action ? SECTION_ACTION_WIDTH : 0));
|
|
217
|
+
const cursor = keyboardFocused && cursorHeaderKey === key;
|
|
201
218
|
return (
|
|
202
|
-
<
|
|
219
|
+
<SectionHeaderRow
|
|
203
220
|
key={key}
|
|
204
|
-
height={1}
|
|
205
221
|
width={listWidth}
|
|
206
|
-
|
|
207
|
-
backgroundColor={
|
|
222
|
+
cursor={cursor}
|
|
223
|
+
backgroundColor={cursor ? cursorBackground : sidebarBg}
|
|
208
224
|
>
|
|
209
225
|
<ActionRow
|
|
210
226
|
label={truncateWithEllipsis(label, Math.max(1, rowWidth - CHANNEL_ROW_INDENT))}
|
|
@@ -225,15 +241,16 @@ export function ChannelSidebar({
|
|
|
225
241
|
)}
|
|
226
242
|
</PaneSidebarAction>
|
|
227
243
|
) : null}
|
|
228
|
-
</
|
|
244
|
+
</SectionHeaderRow>
|
|
229
245
|
);
|
|
230
246
|
};
|
|
231
247
|
return (
|
|
232
248
|
<>
|
|
233
249
|
<PaneSidebarList>
|
|
234
|
-
{sidebarRows.map((row) => {
|
|
250
|
+
{({ listWidth }) => sidebarRows.map((row) => {
|
|
251
|
+
const labelWidth = Math.max(listWidth - CHANNEL_ROW_INDENT - notificationWidth, 1);
|
|
235
252
|
if (row.kind === "public-header") {
|
|
236
|
-
return sectionHeader({
|
|
253
|
+
return sectionHeader(listWidth, {
|
|
237
254
|
key: row.key,
|
|
238
255
|
label: "Channels",
|
|
239
256
|
unread: hasUnread(row.channels),
|
|
@@ -243,7 +260,7 @@ export function ChannelSidebar({
|
|
|
243
260
|
}
|
|
244
261
|
if (row.kind === "team-header") {
|
|
245
262
|
const canAddChannel = !!row.team && !!onCreateTeamChannel;
|
|
246
|
-
return sectionHeader({
|
|
263
|
+
return sectionHeader(listWidth, {
|
|
247
264
|
key: row.key,
|
|
248
265
|
label: row.team ? `${teamPrefix(row.team)} ${row.team.name}` : "Team",
|
|
249
266
|
fg: row.team ? teamAccentHex(row.team.accentColor) : colors.textDim,
|
|
@@ -259,7 +276,7 @@ export function ChannelSidebar({
|
|
|
259
276
|
});
|
|
260
277
|
}
|
|
261
278
|
if (row.kind === "direct-header") {
|
|
262
|
-
return sectionHeader({
|
|
279
|
+
return sectionHeader(listWidth, {
|
|
263
280
|
key: row.key,
|
|
264
281
|
label: "DMs",
|
|
265
282
|
unread: hasUnread(row.channels),
|
|
@@ -325,7 +342,7 @@ export function ChannelSidebar({
|
|
|
325
342
|
<Text fg={foregroundColor} selectable={false} onMouseDown={onMouseDown}> </Text>
|
|
326
343
|
<ProfileIcon color={foregroundColor} onMouseDown={onMouseDown} />
|
|
327
344
|
<Text fg={foregroundColor} selectable={false} onMouseDown={onMouseDown}>
|
|
328
|
-
{` ${truncateWithEllipsis(t("Profile"), Math.max(
|
|
345
|
+
{` ${truncateWithEllipsis(t("Profile"), Math.max(sidebarWidth - 3, 1))}`}
|
|
329
346
|
</Text>
|
|
330
347
|
<Box flexGrow={1} onMouseDown={onMouseDown} />
|
|
331
348
|
</>
|
|
@@ -333,7 +350,7 @@ export function ChannelSidebar({
|
|
|
333
350
|
</PaneSidebarRow>
|
|
334
351
|
)}
|
|
335
352
|
{loading && focused && (
|
|
336
|
-
<Box height={1} width={
|
|
353
|
+
<Box height={1} width={sidebarWidth} flexDirection="row">
|
|
337
354
|
<Text fg={colors.textDim}>{` ${t("syncing")}`}</Text>
|
|
338
355
|
</Box>
|
|
339
356
|
)}
|