@gzeoneth/gov-tracker 0.2.1-alpha.cli-preview.a5817b4 → 0.2.1-alpha.cli-preview.552bbdb
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/README.md +37 -3
- package/dist/abis.d.ts.map +1 -1
- package/dist/abis.js +22 -1
- package/dist/abis.js.map +1 -1
- package/dist/cli/cli.js +206 -12
- package/dist/cli/cli.js.map +1 -1
- package/dist/cli/lib/cli.d.ts +9 -1
- package/dist/cli/lib/cli.d.ts.map +1 -1
- package/dist/cli/lib/cli.js +80 -4
- package/dist/cli/lib/cli.js.map +1 -1
- package/dist/cli/tui/App.d.ts.map +1 -1
- package/dist/cli/tui/App.js +29 -23
- package/dist/cli/tui/App.js.map +1 -1
- package/dist/cli/tui/components/StageRow.d.ts.map +1 -1
- package/dist/cli/tui/components/StageRow.js +31 -36
- package/dist/cli/tui/components/StageRow.js.map +1 -1
- package/dist/cli/tui/hooks/index.d.ts +4 -0
- package/dist/cli/tui/hooks/index.d.ts.map +1 -1
- package/dist/cli/tui/hooks/index.js +5 -1
- package/dist/cli/tui/hooks/index.js.map +1 -1
- package/dist/cli/tui/hooks/useCache.d.ts.map +1 -1
- package/dist/cli/tui/hooks/useCache.js +30 -33
- package/dist/cli/tui/hooks/useCache.js.map +1 -1
- package/dist/cli/tui/hooks/useElectionData.d.ts +14 -0
- package/dist/cli/tui/hooks/useElectionData.d.ts.map +1 -0
- package/dist/cli/tui/hooks/useElectionData.js +86 -0
- package/dist/cli/tui/hooks/useElectionData.js.map +1 -0
- package/dist/cli/tui/hooks/useElectionDetails.d.ts +18 -0
- package/dist/cli/tui/hooks/useElectionDetails.d.ts.map +1 -0
- package/dist/cli/tui/hooks/useElectionDetails.js +47 -0
- package/dist/cli/tui/hooks/useElectionDetails.js.map +1 -0
- package/dist/cli/tui/hooks/useNavigation.d.ts.map +1 -1
- package/dist/cli/tui/hooks/useNavigation.js +65 -119
- package/dist/cli/tui/hooks/useNavigation.js.map +1 -1
- package/dist/cli/tui/hooks/useProposals.d.ts.map +1 -1
- package/dist/cli/tui/hooks/useProposals.js +56 -73
- package/dist/cli/tui/hooks/useProposals.js.map +1 -1
- package/dist/cli/tui/hooks/useTracker.d.ts.map +1 -1
- package/dist/cli/tui/hooks/useTracker.js +36 -41
- package/dist/cli/tui/hooks/useTracker.js.map +1 -1
- package/dist/cli/tui/utils/calldata-formatter.d.ts +17 -0
- package/dist/cli/tui/utils/calldata-formatter.d.ts.map +1 -0
- package/dist/cli/tui/utils/calldata-formatter.js +91 -0
- package/dist/cli/tui/utils/calldata-formatter.js.map +1 -0
- package/dist/cli/tui/utils/help-data.d.ts +15 -0
- package/dist/cli/tui/utils/help-data.d.ts.map +1 -0
- package/dist/cli/tui/utils/help-data.js +88 -0
- package/dist/cli/tui/utils/help-data.js.map +1 -0
- package/dist/cli/tui/utils/index.d.ts +11 -0
- package/dist/cli/tui/utils/index.d.ts.map +1 -1
- package/dist/cli/tui/utils/index.js +24 -1
- package/dist/cli/tui/utils/index.js.map +1 -1
- package/dist/cli/tui/utils/markdown-parser.d.ts +11 -0
- package/dist/cli/tui/utils/markdown-parser.d.ts.map +1 -0
- package/dist/cli/tui/utils/markdown-parser.js +100 -0
- package/dist/cli/tui/utils/markdown-parser.js.map +1 -0
- package/dist/cli/tui/utils/proposal-detail-helpers.d.ts +17 -0
- package/dist/cli/tui/utils/proposal-detail-helpers.d.ts.map +1 -0
- package/dist/cli/tui/utils/proposal-detail-helpers.js +46 -0
- package/dist/cli/tui/utils/proposal-detail-helpers.js.map +1 -0
- package/dist/cli/tui/utils/settings-data.d.ts +36 -0
- package/dist/cli/tui/utils/settings-data.d.ts.map +1 -0
- package/dist/cli/tui/utils/settings-data.js +220 -0
- package/dist/cli/tui/utils/settings-data.js.map +1 -0
- package/dist/cli/tui/utils/stage-formatter.d.ts +13 -0
- package/dist/cli/tui/utils/stage-formatter.d.ts.map +1 -0
- package/dist/cli/tui/utils/stage-formatter.js +100 -0
- package/dist/cli/tui/utils/stage-formatter.js.map +1 -0
- package/dist/cli/tui/views/CalldataView.d.ts.map +1 -1
- package/dist/cli/tui/views/CalldataView.js +14 -85
- package/dist/cli/tui/views/CalldataView.js.map +1 -1
- package/dist/cli/tui/views/DescriptionView.d.ts.map +1 -1
- package/dist/cli/tui/views/DescriptionView.js +1 -85
- package/dist/cli/tui/views/DescriptionView.js.map +1 -1
- package/dist/cli/tui/views/ElectionView.d.ts.map +1 -1
- package/dist/cli/tui/views/ElectionView.js +269 -169
- package/dist/cli/tui/views/ElectionView.js.map +1 -1
- package/dist/cli/tui/views/HelpView.d.ts.map +1 -1
- package/dist/cli/tui/views/HelpView.js +53 -122
- package/dist/cli/tui/views/HelpView.js.map +1 -1
- package/dist/cli/tui/views/ProposalDetail.d.ts.map +1 -1
- package/dist/cli/tui/views/ProposalDetail.js +35 -80
- package/dist/cli/tui/views/ProposalDetail.js.map +1 -1
- package/dist/cli/tui/views/ProposalList.d.ts.map +1 -1
- package/dist/cli/tui/views/ProposalList.js +92 -75
- package/dist/cli/tui/views/ProposalList.js.map +1 -1
- package/dist/cli/tui/views/SettingsView.d.ts.map +1 -1
- package/dist/cli/tui/views/SettingsView.js +37 -107
- package/dist/cli/tui/views/SettingsView.js.map +1 -1
- package/dist/cli/tui/views/SimulationView.d.ts.map +1 -1
- package/dist/cli/tui/views/SimulationView.js +3 -2
- package/dist/cli/tui/views/SimulationView.js.map +1 -1
- package/dist/cli/tui/views/StageView.d.ts.map +1 -1
- package/dist/cli/tui/views/StageView.js +7 -95
- package/dist/cli/tui/views/StageView.js.map +1 -1
- package/dist/deduplication.d.ts +132 -0
- package/dist/deduplication.d.ts.map +1 -0
- package/dist/deduplication.js +270 -0
- package/dist/deduplication.js.map +1 -0
- package/dist/election.d.ts +141 -1
- package/dist/election.d.ts.map +1 -1
- package/dist/election.js +505 -88
- package/dist/election.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +27 -3
- package/dist/index.js.map +1 -1
- package/dist/stages/builder.d.ts +4 -0
- package/dist/stages/builder.d.ts.map +1 -1
- package/dist/stages/builder.js +7 -0
- package/dist/stages/builder.js.map +1 -1
- package/dist/stages/voting.d.ts.map +1 -1
- package/dist/stages/voting.js +5 -4
- package/dist/stages/voting.js.map +1 -1
- package/dist/tracker/discovery.d.ts +39 -8
- package/dist/tracker/discovery.d.ts.map +1 -1
- package/dist/tracker/discovery.js +141 -12
- package/dist/tracker/discovery.js.map +1 -1
- package/dist/tracker.d.ts +24 -4
- package/dist/tracker.d.ts.map +1 -1
- package/dist/tracker.js +57 -8
- package/dist/tracker.js.map +1 -1
- package/dist/types/core.d.ts +1 -1
- package/dist/types/core.d.ts.map +1 -1
- package/dist/types/election.d.ts +88 -0
- package/dist/types/election.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/stages.d.ts +6 -0
- package/dist/types/stages.d.ts.map +1 -1
- package/dist/types/stages.js.map +1 -1
- package/dist/types/tracking.d.ts +27 -1
- package/dist/types/tracking.d.ts.map +1 -1
- package/dist/utils/timing.d.ts +13 -0
- package/dist/utils/timing.d.ts.map +1 -1
- package/dist/utils/timing.js +35 -0
- package/dist/utils/timing.js.map +1 -1
- package/package.json +1 -1
|
@@ -7,122 +7,62 @@ exports.HelpView = HelpView;
|
|
|
7
7
|
const ink_wrapper_js_1 = require("../ink-wrapper.js");
|
|
8
8
|
const ScrollIndicator_js_1 = require("../components/ScrollIndicator.js");
|
|
9
9
|
const index_js_1 = require("../utils/index.js");
|
|
10
|
-
const HELP_SECTIONS = [
|
|
11
|
-
{
|
|
12
|
-
title: "Navigation (Vim-style)",
|
|
13
|
-
icon: "⌨",
|
|
14
|
-
shortcuts: [
|
|
15
|
-
{ key: "j/↓", description: "Move down" },
|
|
16
|
-
{ key: "k/↑", description: "Move up" },
|
|
17
|
-
{ key: "Ctrl+d/PgDn", description: "Page down (10 items)" },
|
|
18
|
-
{ key: "Ctrl+u/PgUp", description: "Page up (10 items)" },
|
|
19
|
-
{ key: "g", description: "Jump to top" },
|
|
20
|
-
{ key: "G", description: "Jump to bottom" },
|
|
21
|
-
{ key: "Enter", description: "Select / Enter view" },
|
|
22
|
-
{ key: "b/Esc", description: "Go back" },
|
|
23
|
-
],
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
title: "List View",
|
|
27
|
-
icon: "📋",
|
|
28
|
-
shortcuts: [
|
|
29
|
-
{ key: "/", description: "Start search", note: "Enter to finish, Esc to clear" },
|
|
30
|
-
{ key: "Tab", description: "Cycle filter", note: "all → active → complete → timelocks" },
|
|
31
|
-
{ key: "o", description: "Cycle sort", note: "newest → oldest → progress → status" },
|
|
32
|
-
{ key: "R", description: "Reload cache from disk" },
|
|
33
|
-
{ key: "d", description: "Discover proposals", note: "requires RPC" },
|
|
34
|
-
{ key: "e", description: "Election status", note: "requires RPC" },
|
|
35
|
-
{ key: "S", description: "Settings" },
|
|
36
|
-
{ key: "q", description: "Quit" },
|
|
37
|
-
],
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
title: "Detail View",
|
|
41
|
-
icon: "📄",
|
|
42
|
-
shortcuts: [
|
|
43
|
-
{ key: "1-7", description: "Jump to stage number" },
|
|
44
|
-
{ key: "y", description: "Copy proposal/operation ID" },
|
|
45
|
-
{ key: "Y", description: "Copy transaction hash" },
|
|
46
|
-
{ key: "d", description: "View description" },
|
|
47
|
-
{ key: "c", description: "View calldata" },
|
|
48
|
-
{ key: "s", description: "View simulation data" },
|
|
49
|
-
{ key: "r", description: "Re-track proposal", note: "requires RPC" },
|
|
50
|
-
],
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
title: "Calldata View",
|
|
54
|
-
icon: "🔍",
|
|
55
|
-
shortcuts: [
|
|
56
|
-
{ key: "←/→", description: "Navigate between actions" },
|
|
57
|
-
{ key: "Enter", description: "Toggle fold/unfold" },
|
|
58
|
-
{ key: "e", description: "Expand all" },
|
|
59
|
-
{ key: "c", description: "Collapse all" },
|
|
60
|
-
],
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
title: "Settings View",
|
|
64
|
-
icon: "⚙",
|
|
65
|
-
shortcuts: [
|
|
66
|
-
{ key: "j/k", description: "Navigate settings" },
|
|
67
|
-
{ key: "Enter/Space", description: "Edit or toggle setting" },
|
|
68
|
-
{ key: "r", description: "Reset all to defaults" },
|
|
69
|
-
{ key: "b/Esc", description: "Save and close" },
|
|
70
|
-
],
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
title: "Tips",
|
|
74
|
-
icon: "💡",
|
|
75
|
-
shortcuts: [
|
|
76
|
-
{ key: "?", description: "Show/hide this help (works in any view)" },
|
|
77
|
-
{ key: "Search", description: "Matches title and proposal ID" },
|
|
78
|
-
{ key: "RPC", description: "Use --l2-rpc for tracking features" },
|
|
79
|
-
],
|
|
80
|
-
},
|
|
81
|
-
];
|
|
82
10
|
const RESERVED_LINES = 6;
|
|
11
|
+
function buildHelpLines() {
|
|
12
|
+
return index_js_1.HELP_SECTIONS.flatMap((section) => [
|
|
13
|
+
{ text: `${section.icon ?? "•"} ${section.title}`, type: "header" },
|
|
14
|
+
...section.shortcuts.map((shortcut) => ({
|
|
15
|
+
text: (ink_wrapper_js_1.React.createElement(ink_wrapper_js_1.Box, { key: `${section.title}-${shortcut.key}` },
|
|
16
|
+
ink_wrapper_js_1.React.createElement(ink_wrapper_js_1.Text, { color: "cyan" }, shortcut.key.padEnd(12)),
|
|
17
|
+
ink_wrapper_js_1.React.createElement(ink_wrapper_js_1.Text, null, shortcut.description),
|
|
18
|
+
shortcut.note && ink_wrapper_js_1.React.createElement(ink_wrapper_js_1.Text, { color: "gray" },
|
|
19
|
+
" (",
|
|
20
|
+
shortcut.note,
|
|
21
|
+
")"))),
|
|
22
|
+
type: "shortcut",
|
|
23
|
+
})),
|
|
24
|
+
{ text: "", type: "spacer" },
|
|
25
|
+
]);
|
|
26
|
+
}
|
|
27
|
+
function renderHelpLine(line, index) {
|
|
28
|
+
switch (line.type) {
|
|
29
|
+
case "header":
|
|
30
|
+
return (ink_wrapper_js_1.React.createElement(ink_wrapper_js_1.Box, { key: index, marginTop: index === 0 ? 0 : 1 },
|
|
31
|
+
ink_wrapper_js_1.React.createElement(ink_wrapper_js_1.Text, { bold: true, color: "yellow" }, line.text)));
|
|
32
|
+
case "shortcut":
|
|
33
|
+
return ink_wrapper_js_1.React.createElement(ink_wrapper_js_1.Box, { key: index, marginLeft: 2 }, line.text);
|
|
34
|
+
case "spacer":
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
83
38
|
function HelpView({ navigation }) {
|
|
84
39
|
const { state } = navigation;
|
|
85
40
|
const visibleRows = (0, index_js_1.getVisibleRows)(RESERVED_LINES);
|
|
86
|
-
const allLines =
|
|
87
|
-
for (const section of HELP_SECTIONS) {
|
|
88
|
-
allLines.push({ text: `${section.icon ?? "•"} ${section.title}`, isHeader: true });
|
|
89
|
-
for (const shortcut of section.shortcuts) {
|
|
90
|
-
allLines.push({
|
|
91
|
-
text: (ink_wrapper_js_1.React.createElement(ink_wrapper_js_1.Box, { key: `${section.title}-${shortcut.key}` },
|
|
92
|
-
ink_wrapper_js_1.React.createElement(ink_wrapper_js_1.Text, { color: "cyan" }, shortcut.key.padEnd(12)),
|
|
93
|
-
ink_wrapper_js_1.React.createElement(ink_wrapper_js_1.Text, null, shortcut.description),
|
|
94
|
-
shortcut.note && ink_wrapper_js_1.React.createElement(ink_wrapper_js_1.Text, { color: "gray" },
|
|
95
|
-
" (",
|
|
96
|
-
shortcut.note,
|
|
97
|
-
")"))),
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
allLines.push({ text: "", isSpacer: true });
|
|
101
|
-
}
|
|
41
|
+
const allLines = buildHelpLines();
|
|
102
42
|
const visibleLines = allLines.slice(state.scrollOffset, state.scrollOffset + visibleRows);
|
|
103
|
-
const hasMore = state.scrollOffset + visibleRows < allLines.length;
|
|
104
|
-
const hasLess = state.scrollOffset > 0;
|
|
105
43
|
(0, ink_wrapper_js_1.useInput)((input, key) => {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
44
|
+
switch (true) {
|
|
45
|
+
case input === "?" || input === "b" || key.escape:
|
|
46
|
+
navigation.back();
|
|
47
|
+
break;
|
|
48
|
+
case key.upArrow || input === "k":
|
|
49
|
+
navigation.moveUp();
|
|
50
|
+
break;
|
|
51
|
+
case key.downArrow || input === "j":
|
|
52
|
+
navigation.moveDown(allLines.length);
|
|
53
|
+
break;
|
|
54
|
+
case key.pageUp || (key.ctrl && input === "u"):
|
|
55
|
+
navigation.pageUp(allLines.length);
|
|
56
|
+
break;
|
|
57
|
+
case key.pageDown || (key.ctrl && input === "d"):
|
|
58
|
+
navigation.pageDown(allLines.length);
|
|
59
|
+
break;
|
|
60
|
+
case input === "g":
|
|
61
|
+
navigation.goToTop();
|
|
62
|
+
break;
|
|
63
|
+
case input === "G":
|
|
64
|
+
navigation.goToBottom(allLines.length);
|
|
65
|
+
break;
|
|
126
66
|
}
|
|
127
67
|
});
|
|
128
68
|
return (ink_wrapper_js_1.React.createElement(ink_wrapper_js_1.Box, { flexDirection: "column", height: "100%" },
|
|
@@ -132,19 +72,10 @@ function HelpView({ navigation }) {
|
|
|
132
72
|
ink_wrapper_js_1.React.createElement(ink_wrapper_js_1.Box, { flexDirection: "column", paddingX: 2, paddingY: 1, flexGrow: 1 },
|
|
133
73
|
allLines.length > visibleRows && (ink_wrapper_js_1.React.createElement(ink_wrapper_js_1.Box, { marginBottom: 1 },
|
|
134
74
|
ink_wrapper_js_1.React.createElement(ScrollIndicator_js_1.ScrollPosition, { scrollOffset: state.scrollOffset, visibleRows: visibleRows, totalItems: allLines.length }))),
|
|
135
|
-
|
|
75
|
+
state.scrollOffset > 0 && (ink_wrapper_js_1.React.createElement(ink_wrapper_js_1.Box, { marginBottom: 1 },
|
|
136
76
|
ink_wrapper_js_1.React.createElement(ScrollIndicator_js_1.ScrollIndicatorTop, { scrollOffset: state.scrollOffset }))),
|
|
137
|
-
visibleLines.map(
|
|
138
|
-
|
|
139
|
-
return (ink_wrapper_js_1.React.createElement(ink_wrapper_js_1.Box, { key: i, marginTop: i === 0 ? 0 : 1 },
|
|
140
|
-
ink_wrapper_js_1.React.createElement(ink_wrapper_js_1.Text, { bold: true, color: "yellow" }, line.text)));
|
|
141
|
-
}
|
|
142
|
-
if (line.isSpacer) {
|
|
143
|
-
return null;
|
|
144
|
-
}
|
|
145
|
-
return ink_wrapper_js_1.React.createElement(ink_wrapper_js_1.Box, { key: i, marginLeft: 2 }, line.text);
|
|
146
|
-
}),
|
|
147
|
-
hasMore && (ink_wrapper_js_1.React.createElement(ink_wrapper_js_1.Box, { marginTop: 1 },
|
|
77
|
+
visibleLines.map(renderHelpLine),
|
|
78
|
+
state.scrollOffset + visibleRows < allLines.length && (ink_wrapper_js_1.React.createElement(ink_wrapper_js_1.Box, { marginTop: 1 },
|
|
148
79
|
ink_wrapper_js_1.React.createElement(ScrollIndicator_js_1.ScrollIndicatorBottom, { scrollOffset: state.scrollOffset, visibleRows: visibleRows, totalItems: allLines.length })))),
|
|
149
80
|
ink_wrapper_js_1.React.createElement(ink_wrapper_js_1.Box, { borderStyle: "single", borderColor: "gray", paddingX: 1 },
|
|
150
81
|
ink_wrapper_js_1.React.createElement(ink_wrapper_js_1.Text, { color: "cyan" }, "j/k"),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HelpView.js","sourceRoot":"","sources":["../../../../src/cli/tui/views/HelpView.tsx"],"names":[],"mappings":";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,GAAI,CACpD,CACP;YAEA,YAAY,CAAC,GAAG,CAAC,cAAc,CAAC;YAEhC,KAAK,CAAC,YAAY,GAAG,WAAW,GAAG,QAAQ,CAAC,MAAM,IAAI,CACrD,qCAAC,oBAAG,IAAC,SAAS,EAAE,CAAC;gBACf,qCAAC,0CAAqB,IACpB,YAAY,EAAE,KAAK,CAAC,YAAY,EAChC,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,QAAQ,CAAC,MAAM,GAC3B,CACE,CACP,CACG;QAEN,qCAAC,oBAAG,IAAC,WAAW,EAAC,QAAQ,EAAC,WAAW,EAAC,MAAM,EAAC,QAAQ,EAAE,CAAC;YACtD,qCAAC,qBAAI,IAAC,KAAK,EAAC,MAAM,UAAW;YAC7B,qCAAC,qBAAI,IAAC,KAAK,EAAC,MAAM,gBAAiB;YACnC,qCAAC,qBAAI,IAAC,KAAK,EAAC,MAAM,eAAgB;YAClC,qCAAC,qBAAI,IAAC,KAAK,EAAC,MAAM,cAAe;YACjC,qCAAC,qBAAI,IAAC,KAAK,EAAC,MAAM,UAAW;YAC7B,qCAAC,qBAAI,IAAC,KAAK,EAAC,MAAM,oBAAqB;YACvC,qCAAC,qBAAI,IAAC,KAAK,EAAC,MAAM,UAAW;YAC7B,qCAAC,qBAAI,IAAC,KAAK,EAAC,MAAM,cAAe,CAC7B,CACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProposalDetail.d.ts","sourceRoot":"","sources":["../../../../src/cli/tui/views/ProposalDetail.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,KAAK,mBAAmB,EAAe,MAAM,mBAAmB,CAAC;AAC1E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"ProposalDetail.d.ts","sourceRoot":"","sources":["../../../../src/cli/tui/views/ProposalDetail.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,KAAK,mBAAmB,EAAe,MAAM,mBAAmB,CAAC;AAC1E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAc/D,UAAU,mBAAmB;IAC3B,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,UAAU,EAAE,mBAAmB,CAAC;IAChC,OAAO,EAAE,gBAAgB,CAAC;CAC3B;AAED,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,UAAU,EACV,OAAO,GACR,EAAE,mBAAmB,GAAG,KAAK,CAAC,YAAY,CAwJ1C"}
|
|
@@ -16,97 +16,52 @@ const constants_js_1 = require("../../../constants.js");
|
|
|
16
16
|
const stages_js_1 = require("../../../types/stages.js");
|
|
17
17
|
const CopyableText_js_1 = require("../components/CopyableText.js");
|
|
18
18
|
const ErrorDisplay_js_1 = require("../components/ErrorDisplay.js");
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return "Unknown";
|
|
22
|
-
return new Date(timestamp).toLocaleString();
|
|
23
|
-
}
|
|
19
|
+
const proposal_detail_helpers_js_1 = require("../utils/proposal-detail-helpers.js");
|
|
20
|
+
const index_js_2 = require("../utils/index.js");
|
|
24
21
|
function ProposalDetail({ proposal, navigation, tracker, }) {
|
|
25
22
|
const { state } = navigation;
|
|
26
23
|
const stages = proposal.checkpoint.cachedData.completedStages ?? [];
|
|
27
24
|
const input = proposal.checkpoint.input;
|
|
28
25
|
const { feedback, feedbackType, copy } = (0, CopyableText_js_1.useCopyState)();
|
|
26
|
+
const txHash = (0, proposal_detail_helpers_js_1.getTxHash)(input);
|
|
27
|
+
const proposalId = (0, proposal_detail_helpers_js_1.getProposalIdDisplay)(input);
|
|
29
28
|
(0, ink_wrapper_js_1.useInput)((inputKey, key) => {
|
|
30
|
-
if (inputKey === "b" || key.escape)
|
|
31
|
-
navigation.back();
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
navigation.
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
navigation.
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
navigation.
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
else if (inputKey === "G") {
|
|
58
|
-
navigation.goToBottom(index_js_1.STAGE_COUNT);
|
|
59
|
-
}
|
|
60
|
-
else if (inputKey >= "1" && inputKey <= "7") {
|
|
29
|
+
if (inputKey === "b" || key.escape)
|
|
30
|
+
return navigation.back();
|
|
31
|
+
if (key.upArrow || inputKey === "k")
|
|
32
|
+
return navigation.moveUp();
|
|
33
|
+
if (key.downArrow || inputKey === "j")
|
|
34
|
+
return navigation.moveDown(index_js_1.STAGE_COUNT);
|
|
35
|
+
if (key.return && stages[state.selectedStageIndex])
|
|
36
|
+
return navigation.goToStage(state.selectedStageIndex);
|
|
37
|
+
if (inputKey === "c")
|
|
38
|
+
return navigation.goToCalldata();
|
|
39
|
+
if (inputKey === "s")
|
|
40
|
+
return navigation.goToSimulation();
|
|
41
|
+
if (inputKey === "d")
|
|
42
|
+
return navigation.goToDescription();
|
|
43
|
+
if (inputKey === "r" && tracker.canTrack && !tracker.isTracking)
|
|
44
|
+
return void tracker.track(proposal);
|
|
45
|
+
if (inputKey === "g")
|
|
46
|
+
return navigation.goToTop();
|
|
47
|
+
if (inputKey === "G")
|
|
48
|
+
return navigation.goToBottom(index_js_1.STAGE_COUNT);
|
|
49
|
+
if (inputKey === "?")
|
|
50
|
+
return navigation.goToHelp();
|
|
51
|
+
if (inputKey === "y")
|
|
52
|
+
return copy(proposalId, "Proposal ID");
|
|
53
|
+
if (inputKey === "Y" && txHash)
|
|
54
|
+
return copy(txHash, "TX Hash");
|
|
55
|
+
if (inputKey >= "1" && inputKey <= "7") {
|
|
61
56
|
const stageIndex = parseInt(inputKey, 10) - 1;
|
|
62
|
-
if (stages[stageIndex])
|
|
57
|
+
if (stages[stageIndex])
|
|
63
58
|
navigation.goToStage(stageIndex);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
else if (inputKey === "?") {
|
|
67
|
-
navigation.goToHelp();
|
|
68
|
-
}
|
|
69
|
-
else if (inputKey === "y") {
|
|
70
|
-
// Copy based on context - proposal ID by default
|
|
71
|
-
const proposalId = getProposalIdDisplay();
|
|
72
|
-
copy(proposalId, "Proposal ID");
|
|
73
|
-
}
|
|
74
|
-
else if (inputKey === "Y") {
|
|
75
|
-
// Copy transaction hash
|
|
76
|
-
const hash = getTxHash();
|
|
77
|
-
if (hash) {
|
|
78
|
-
copy(hash, "TX Hash");
|
|
79
|
-
}
|
|
80
59
|
}
|
|
81
60
|
});
|
|
82
|
-
const getTxHash = () => {
|
|
83
|
-
if (input.type === "governor")
|
|
84
|
-
return input.creationTxHash;
|
|
85
|
-
if (input.type === "timelock")
|
|
86
|
-
return input.scheduledTxHash;
|
|
87
|
-
if (input.type === "discovery")
|
|
88
|
-
return "";
|
|
89
|
-
return "";
|
|
90
|
-
};
|
|
91
|
-
const getProposalIdDisplay = () => {
|
|
92
|
-
if (input.type === "governor") {
|
|
93
|
-
return input.proposalId;
|
|
94
|
-
}
|
|
95
|
-
if (input.type === "timelock") {
|
|
96
|
-
return input.operationId;
|
|
97
|
-
}
|
|
98
|
-
if (input.type === "discovery") {
|
|
99
|
-
return input.id;
|
|
100
|
-
}
|
|
101
|
-
return "";
|
|
102
|
-
};
|
|
103
|
-
const txHash = getTxHash();
|
|
104
61
|
const txUrl = txHash ? (0, constants_js_1.getTxUrl)(constants_js_1.CHAIN_IDS.ARB_ONE, txHash) : null;
|
|
105
62
|
const votingStage = stages.find((s) => (0, stages_js_1.isStageType)(s, "VOTING_ACTIVE"));
|
|
106
63
|
const votingData = votingStage?.data;
|
|
107
|
-
const shortTitle = proposal.title
|
|
108
|
-
? proposal.title.substring(0, 40) + "..."
|
|
109
|
-
: proposal.title;
|
|
64
|
+
const shortTitle = (0, index_js_2.truncate)(proposal.title, 40);
|
|
110
65
|
return (ink_wrapper_js_1.React.createElement(ink_wrapper_js_1.Box, { flexDirection: "column", height: "100%" },
|
|
111
66
|
ink_wrapper_js_1.React.createElement(Header_js_1.Header, { view: "detail", filter: state.filter, stats: null, hasProviders: tracker.canTrack, isTracking: tracker.isTracking, title: proposal.title, position: { current: state.selectedStageIndex + 1, total: index_js_1.STAGE_COUNT }, breadcrumb: ["Proposals", shortTitle] }),
|
|
112
67
|
ink_wrapper_js_1.React.createElement(ink_wrapper_js_1.Box, { flexDirection: "column", paddingX: 1, flexGrow: 1 },
|
|
@@ -121,13 +76,13 @@ function ProposalDetail({ proposal, navigation, tracker, }) {
|
|
|
121
76
|
ink_wrapper_js_1.React.createElement(ink_wrapper_js_1.Text, { color: "gray" },
|
|
122
77
|
input.type === "governor" ? "Proposal ID" : "Operation ID",
|
|
123
78
|
": "),
|
|
124
|
-
ink_wrapper_js_1.React.createElement(ink_wrapper_js_1.Text, null,
|
|
79
|
+
ink_wrapper_js_1.React.createElement(ink_wrapper_js_1.Text, null, proposalId)),
|
|
125
80
|
ink_wrapper_js_1.React.createElement(ink_wrapper_js_1.Box, null,
|
|
126
81
|
ink_wrapper_js_1.React.createElement(ink_wrapper_js_1.Text, { color: "gray" }, "TX: "),
|
|
127
82
|
ink_wrapper_js_1.React.createElement(ink_wrapper_js_1.Text, { color: "blue" }, txHash)),
|
|
128
83
|
ink_wrapper_js_1.React.createElement(ink_wrapper_js_1.Box, null,
|
|
129
84
|
ink_wrapper_js_1.React.createElement(ink_wrapper_js_1.Text, { color: "gray" }, "Created: "),
|
|
130
|
-
ink_wrapper_js_1.React.createElement(ink_wrapper_js_1.Text, null, formatDate(proposal.createdAt))),
|
|
85
|
+
ink_wrapper_js_1.React.createElement(ink_wrapper_js_1.Text, null, (0, proposal_detail_helpers_js_1.formatDate)(proposal.createdAt))),
|
|
131
86
|
txUrl && (ink_wrapper_js_1.React.createElement(ink_wrapper_js_1.Box, null,
|
|
132
87
|
ink_wrapper_js_1.React.createElement(ink_wrapper_js_1.Text, { color: "gray" }, "Explorer: "),
|
|
133
88
|
ink_wrapper_js_1.React.createElement(ink_wrapper_js_1.Text, { color: "blue" }, txUrl)))),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProposalDetail.js","sourceRoot":"","sources":["../../../../src/cli/tui/views/ProposalDetail.tsx"],"names":[],"mappings":";AAAA;;GAEG;;
|
|
1
|
+
{"version":3,"file":"ProposalDetail.js","sourceRoot":"","sources":["../../../../src/cli/tui/views/ProposalDetail.tsx"],"names":[],"mappings":";AAAA;;GAEG;;AAyBH,wCA4JC;AAnLD,sDAAyE;AAEzE,gDAA0E;AAE1E,uDAAiD;AACjD,yDAAmD;AACnD,2DAAqD;AACrD,iEAA2D;AAC3D,iEAA2D;AAC3D,qEAA+D;AAC/D,wDAA4D;AAC5D,wDAAuD;AACvD,mEAA2E;AAC3E,mEAA4D;AAC5D,oFAAkG;AAClG,gDAA6C;AAQ7C,SAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,UAAU,EACV,OAAO,GACa;IACpB,MAAM,EAAE,KAAK,EAAE,GAAG,UAAU,CAAC;IAC7B,MAAM,MAAM,GAAG,QAAQ,CAAC,UAAU,CAAC,UAAU,CAAC,eAAe,IAAI,EAAE,CAAC;IACpE,MAAM,KAAK,GAAG,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC;IACxC,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,GAAG,IAAA,8BAAY,GAAE,CAAC;IAExD,MAAM,MAAM,GAAG,IAAA,sCAAS,EAAC,KAAK,CAAC,CAAC;IAChC,MAAM,UAAU,GAAG,IAAA,iDAAoB,EAAC,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AO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAS/D,UAAU,iBAAiB;IACzB,KAAK,EAAE,gBAAgB,EAAE,CAAC;IAC1B,IAAI,EAAE,SAAS,GAAG,IAAI,CAAC;IACvB,UAAU,EAAE,mBAAmB,CAAC;IAChC,OAAO,EAAE,gBAAgB,CAAC;IAC1B,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;
|
|
1
|
+
{"version":3,"file":"ProposalList.d.ts","sourceRoot":"","sources":["../../../../src/cli/tui/views/ProposalList.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAS/D,UAAU,iBAAiB;IACzB,KAAK,EAAE,gBAAgB,EAAE,CAAC;IAC1B,IAAI,EAAE,SAAS,GAAG,IAAI,CAAC;IACvB,UAAU,EAAE,mBAAmB,CAAC;IAChC,OAAO,EAAE,gBAAgB,CAAC;IAC1B,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAwBD,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,IAAI,EACJ,UAAU,EACV,OAAO,EACP,MAAM,EACN,QAAQ,GACT,EAAE,iBAAiB,GAAG,KAAK,CAAC,YAAY,CA6JxC"}
|
|
@@ -13,79 +13,106 @@ const EmptyState_js_1 = require("../components/EmptyState.js");
|
|
|
13
13
|
const SearchBar_js_1 = require("../components/SearchBar.js");
|
|
14
14
|
const ErrorDisplay_js_1 = require("../components/ErrorDisplay.js");
|
|
15
15
|
const RESERVED_LINES = 8;
|
|
16
|
+
function getEmptyStateMessage(searchQuery, filter, totalCount) {
|
|
17
|
+
if (searchQuery) {
|
|
18
|
+
return `No results for "${searchQuery}"`;
|
|
19
|
+
}
|
|
20
|
+
if (totalCount === 0) {
|
|
21
|
+
return "Cache is empty";
|
|
22
|
+
}
|
|
23
|
+
return `No proposals match filter [${filter}]`;
|
|
24
|
+
}
|
|
25
|
+
function getEmptyStateHint(searchQuery, totalCount, canTrack) {
|
|
26
|
+
if (searchQuery) {
|
|
27
|
+
return "Press / to modify search";
|
|
28
|
+
}
|
|
29
|
+
if (totalCount === 0) {
|
|
30
|
+
return canTrack ? "Press d to discover proposals" : "Use --l2-rpc to enable discovery";
|
|
31
|
+
}
|
|
32
|
+
return "Press Tab to change filter";
|
|
33
|
+
}
|
|
16
34
|
function ProposalList({ items, data, navigation, tracker, onQuit, onReload, }) {
|
|
17
35
|
const { state } = navigation;
|
|
18
36
|
const selectedIndex = state.selectedIndex;
|
|
19
37
|
const visibleRows = (0, index_js_1.getVisibleRows)(RESERVED_LINES);
|
|
20
38
|
const startIndex = Math.max(0, Math.min(selectedIndex - Math.floor(visibleRows / 2), Math.max(0, items.length - visibleRows)));
|
|
21
39
|
const visibleItems = items.slice(startIndex, startIndex + visibleRows);
|
|
22
|
-
|
|
23
|
-
if (
|
|
24
|
-
|
|
25
|
-
navigation.clearSearch();
|
|
26
|
-
}
|
|
27
|
-
else if (key.return) {
|
|
28
|
-
navigation.finishSearch();
|
|
29
|
-
}
|
|
30
|
-
else if (key.backspace || key.delete) {
|
|
31
|
-
navigation.deleteSearchChar();
|
|
32
|
-
}
|
|
33
|
-
else if (input && input.length === 1 && !key.ctrl && !key.meta) {
|
|
34
|
-
navigation.appendSearchChar(input);
|
|
35
|
-
}
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
if (input === "q") {
|
|
39
|
-
onQuit();
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
if (input === "/") {
|
|
43
|
-
navigation.startSearch();
|
|
44
|
-
}
|
|
45
|
-
else if (key.escape && state.searchQuery) {
|
|
46
|
-
navigation.setSearchQuery("");
|
|
47
|
-
}
|
|
48
|
-
else if (key.upArrow || input === "k") {
|
|
49
|
-
navigation.moveUp();
|
|
50
|
-
}
|
|
51
|
-
else if (key.downArrow || input === "j") {
|
|
52
|
-
navigation.moveDown(items.length);
|
|
53
|
-
}
|
|
54
|
-
else if (key.pageUp || (key.ctrl && input === "u")) {
|
|
55
|
-
navigation.pageUp(items.length);
|
|
56
|
-
}
|
|
57
|
-
else if (key.pageDown || (key.ctrl && input === "d")) {
|
|
58
|
-
navigation.pageDown(items.length);
|
|
40
|
+
const handleSearchInput = (input, key) => {
|
|
41
|
+
if (key.escape) {
|
|
42
|
+
navigation.clearSearch();
|
|
59
43
|
}
|
|
60
44
|
else if (key.return) {
|
|
61
|
-
navigation.
|
|
62
|
-
}
|
|
63
|
-
else if (key.
|
|
64
|
-
navigation.
|
|
65
|
-
}
|
|
66
|
-
else if (input ===
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
45
|
+
navigation.finishSearch();
|
|
46
|
+
}
|
|
47
|
+
else if (key.backspace || key.delete) {
|
|
48
|
+
navigation.deleteSearchChar();
|
|
49
|
+
}
|
|
50
|
+
else if (input && input.length === 1 && !key.ctrl && !key.meta) {
|
|
51
|
+
navigation.appendSearchChar(input);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
const handleNormalInput = (input, key) => {
|
|
55
|
+
const itemCount = items.length;
|
|
56
|
+
switch (true) {
|
|
57
|
+
case input === "q":
|
|
58
|
+
onQuit();
|
|
59
|
+
break;
|
|
60
|
+
case input === "/":
|
|
61
|
+
navigation.startSearch();
|
|
62
|
+
break;
|
|
63
|
+
case key.escape && !!state.searchQuery:
|
|
64
|
+
navigation.setSearchQuery("");
|
|
65
|
+
break;
|
|
66
|
+
case key.upArrow || input === "k":
|
|
67
|
+
navigation.moveUp();
|
|
68
|
+
break;
|
|
69
|
+
case key.downArrow || input === "j":
|
|
70
|
+
navigation.moveDown(itemCount);
|
|
71
|
+
break;
|
|
72
|
+
case key.pageUp || (key.ctrl && input === "u"):
|
|
73
|
+
navigation.pageUp(itemCount);
|
|
74
|
+
break;
|
|
75
|
+
case key.pageDown || (key.ctrl && input === "d"):
|
|
76
|
+
navigation.pageDown(itemCount);
|
|
77
|
+
break;
|
|
78
|
+
case key.return:
|
|
79
|
+
navigation.enter(items);
|
|
80
|
+
break;
|
|
81
|
+
case key.tab:
|
|
82
|
+
navigation.cycleFilter();
|
|
83
|
+
break;
|
|
84
|
+
case input === "d" && !tracker.isTracking:
|
|
85
|
+
void tracker.discover();
|
|
86
|
+
break;
|
|
87
|
+
case input === "e" && tracker.canTrack:
|
|
88
|
+
navigation.goToElection();
|
|
89
|
+
break;
|
|
90
|
+
case input === "g":
|
|
91
|
+
navigation.goToTop();
|
|
92
|
+
break;
|
|
93
|
+
case input === "G":
|
|
94
|
+
navigation.goToBottom(itemCount);
|
|
95
|
+
break;
|
|
96
|
+
case input === "R":
|
|
97
|
+
onReload();
|
|
98
|
+
break;
|
|
99
|
+
case input === "o":
|
|
100
|
+
navigation.cycleSort();
|
|
101
|
+
break;
|
|
102
|
+
case input === "?":
|
|
103
|
+
navigation.goToHelp();
|
|
104
|
+
break;
|
|
105
|
+
case input === "S":
|
|
106
|
+
navigation.goToSettings();
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
(0, ink_wrapper_js_1.useInput)((input, key) => {
|
|
111
|
+
if (state.isSearching) {
|
|
112
|
+
handleSearchInput(input, key);
|
|
86
113
|
}
|
|
87
|
-
else
|
|
88
|
-
|
|
114
|
+
else {
|
|
115
|
+
handleNormalInput(input, key);
|
|
89
116
|
}
|
|
90
117
|
});
|
|
91
118
|
return (ink_wrapper_js_1.React.createElement(ink_wrapper_js_1.Box, { flexDirection: "column", height: "100%" },
|
|
@@ -96,17 +123,7 @@ function ProposalList({ items, data, navigation, tracker, onQuit, onReload, }) {
|
|
|
96
123
|
ink_wrapper_js_1.React.createElement(ink_wrapper_js_1.Text, { color: "yellow" }, tracker.progress))),
|
|
97
124
|
tracker.error && (ink_wrapper_js_1.React.createElement(ink_wrapper_js_1.Box, { marginBottom: 1 },
|
|
98
125
|
ink_wrapper_js_1.React.createElement(ErrorDisplay_js_1.ErrorBanner, { error: tracker.error }))),
|
|
99
|
-
items.length === 0 ? (ink_wrapper_js_1.React.createElement(EmptyState_js_1.EmptyState, { title: "No proposals found", message: state.searchQuery
|
|
100
|
-
? `No results for "${state.searchQuery}"`
|
|
101
|
-
: (data?.stats?.total ?? 0) === 0
|
|
102
|
-
? "Cache is empty"
|
|
103
|
-
: `No proposals match filter [${state.filter}]`, hint: state.searchQuery
|
|
104
|
-
? "Press / to modify search"
|
|
105
|
-
: (data?.stats?.total ?? 0) === 0
|
|
106
|
-
? tracker.canTrack
|
|
107
|
-
? "Press d to discover proposals"
|
|
108
|
-
: "Use --l2-rpc to enable discovery"
|
|
109
|
-
: "Press Tab to change filter" })) : (ink_wrapper_js_1.React.createElement(ink_wrapper_js_1.Box, { flexDirection: "column" },
|
|
126
|
+
items.length === 0 ? (ink_wrapper_js_1.React.createElement(EmptyState_js_1.EmptyState, { title: "No proposals found", message: getEmptyStateMessage(state.searchQuery, state.filter, data?.stats?.total ?? 0), hint: getEmptyStateHint(state.searchQuery, data?.stats?.total ?? 0, tracker.canTrack) })) : (ink_wrapper_js_1.React.createElement(ink_wrapper_js_1.Box, { flexDirection: "column" },
|
|
110
127
|
startIndex > 0 && ink_wrapper_js_1.React.createElement(ink_wrapper_js_1.Text, { color: "gray" },
|
|
111
128
|
" \u2191 ",
|
|
112
129
|
startIndex,
|