@knpkv/codecommit 0.1.0
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 +216 -0
- package/dist/package.json +50 -0
- package/dist/src/bin.d.ts +3 -0
- package/dist/src/bin.d.ts.map +1 -0
- package/dist/src/bin.js +204 -0
- package/dist/src/bin.js.map +1 -0
- package/dist/src/main.d.ts +2 -0
- package/dist/src/main.d.ts.map +1 -0
- package/dist/src/main.js +25 -0
- package/dist/src/main.js.map +1 -0
- package/dist/src/tui/App.d.ts +6 -0
- package/dist/src/tui/App.d.ts.map +1 -0
- package/dist/src/tui/App.js +40 -0
- package/dist/src/tui/App.js.map +1 -0
- package/dist/src/tui/Constants.d.ts +11 -0
- package/dist/src/tui/Constants.d.ts.map +1 -0
- package/dist/src/tui/Constants.js +40 -0
- package/dist/src/tui/Constants.js.map +1 -0
- package/dist/src/tui/ListBuilder.d.ts +32 -0
- package/dist/src/tui/ListBuilder.d.ts.map +1 -0
- package/dist/src/tui/ListBuilder.js +145 -0
- package/dist/src/tui/ListBuilder.js.map +1 -0
- package/dist/src/tui/atoms/actions.d.ts +39 -0
- package/dist/src/tui/atoms/actions.d.ts.map +1 -0
- package/dist/src/tui/atoms/actions.js +149 -0
- package/dist/src/tui/atoms/actions.js.map +1 -0
- package/dist/src/tui/atoms/app.d.ts +42 -0
- package/dist/src/tui/atoms/app.d.ts.map +1 -0
- package/dist/src/tui/atoms/app.js +69 -0
- package/dist/src/tui/atoms/app.js.map +1 -0
- package/dist/src/tui/atoms/index.d.ts +6 -0
- package/dist/src/tui/atoms/index.d.ts.map +1 -0
- package/dist/src/tui/atoms/index.js +7 -0
- package/dist/src/tui/atoms/index.js.map +1 -0
- package/dist/src/tui/atoms/runtime.d.ts +9 -0
- package/dist/src/tui/atoms/runtime.d.ts.map +1 -0
- package/dist/src/tui/atoms/runtime.js +22 -0
- package/dist/src/tui/atoms/runtime.js.map +1 -0
- package/dist/src/tui/atoms/ui.d.ts +103 -0
- package/dist/src/tui/atoms/ui.d.ts.map +1 -0
- package/dist/src/tui/atoms/ui.js +97 -0
- package/dist/src/tui/atoms/ui.js.map +1 -0
- package/dist/src/tui/components/Badge.d.ts +13 -0
- package/dist/src/tui/components/Badge.d.ts.map +1 -0
- package/dist/src/tui/components/Badge.js +48 -0
- package/dist/src/tui/components/Badge.js.map +1 -0
- package/dist/src/tui/components/DetailsView.d.ts +6 -0
- package/dist/src/tui/components/DetailsView.d.ts.map +1 -0
- package/dist/src/tui/components/DetailsView.js +81 -0
- package/dist/src/tui/components/DetailsView.js.map +1 -0
- package/dist/src/tui/components/ErrorBoundary.d.ts +20 -0
- package/dist/src/tui/components/ErrorBoundary.d.ts.map +1 -0
- package/dist/src/tui/components/ErrorBoundary.js +33 -0
- package/dist/src/tui/components/ErrorBoundary.js.map +1 -0
- package/dist/src/tui/components/Footer.d.ts +6 -0
- package/dist/src/tui/components/Footer.d.ts.map +1 -0
- package/dist/src/tui/components/Footer.js +29 -0
- package/dist/src/tui/components/Footer.js.map +1 -0
- package/dist/src/tui/components/Header.d.ts +6 -0
- package/dist/src/tui/components/Header.d.ts.map +1 -0
- package/dist/src/tui/components/Header.js +58 -0
- package/dist/src/tui/components/Header.js.map +1 -0
- package/dist/src/tui/components/ListItemRow.d.ts +13 -0
- package/dist/src/tui/components/ListItemRow.d.ts.map +1 -0
- package/dist/src/tui/components/ListItemRow.js +52 -0
- package/dist/src/tui/components/ListItemRow.js.map +1 -0
- package/dist/src/tui/components/MainList.d.ts +11 -0
- package/dist/src/tui/components/MainList.d.ts.map +1 -0
- package/dist/src/tui/components/MainList.js +124 -0
- package/dist/src/tui/components/MainList.js.map +1 -0
- package/dist/src/tui/components/NotificationsTable.d.ts +12 -0
- package/dist/src/tui/components/NotificationsTable.d.ts.map +1 -0
- package/dist/src/tui/components/NotificationsTable.js +72 -0
- package/dist/src/tui/components/NotificationsTable.js.map +1 -0
- package/dist/src/tui/components/QuickFilters.d.ts +6 -0
- package/dist/src/tui/components/QuickFilters.d.ts.map +1 -0
- package/dist/src/tui/components/QuickFilters.js +74 -0
- package/dist/src/tui/components/QuickFilters.js.map +1 -0
- package/dist/src/tui/components/SettingsTable.d.ts +12 -0
- package/dist/src/tui/components/SettingsTable.d.ts.map +1 -0
- package/dist/src/tui/components/SettingsTable.js +62 -0
- package/dist/src/tui/components/SettingsTable.js.map +1 -0
- package/dist/src/tui/components/Spinner.d.ts +11 -0
- package/dist/src/tui/components/Spinner.d.ts.map +1 -0
- package/dist/src/tui/components/Spinner.js +24 -0
- package/dist/src/tui/components/Spinner.js.map +1 -0
- package/dist/src/tui/components/StatusRow.d.ts +11 -0
- package/dist/src/tui/components/StatusRow.d.ts.map +1 -0
- package/dist/src/tui/components/StatusRow.js +11 -0
- package/dist/src/tui/components/StatusRow.js.map +1 -0
- package/dist/src/tui/components/Table.d.ts +20 -0
- package/dist/src/tui/components/Table.d.ts.map +1 -0
- package/dist/src/tui/components/Table.js +38 -0
- package/dist/src/tui/components/Table.js.map +1 -0
- package/dist/src/tui/components/index.d.ts +14 -0
- package/dist/src/tui/components/index.d.ts.map +1 -0
- package/dist/src/tui/components/index.js +14 -0
- package/dist/src/tui/components/index.js.map +1 -0
- package/dist/src/tui/components/mainlist-utils.d.ts +22 -0
- package/dist/src/tui/components/mainlist-utils.d.ts.map +1 -0
- package/dist/src/tui/components/mainlist-utils.js +71 -0
- package/dist/src/tui/components/mainlist-utils.js.map +1 -0
- package/dist/src/tui/components/table-utils.d.ts +25 -0
- package/dist/src/tui/components/table-utils.d.ts.map +1 -0
- package/dist/src/tui/components/table-utils.js +25 -0
- package/dist/src/tui/components/table-utils.js.map +1 -0
- package/dist/src/tui/context/dialog.d.ts +32 -0
- package/dist/src/tui/context/dialog.d.ts.map +1 -0
- package/dist/src/tui/context/dialog.js +41 -0
- package/dist/src/tui/context/dialog.js.map +1 -0
- package/dist/src/tui/context/theme.d.ts +25 -0
- package/dist/src/tui/context/theme.d.ts.map +1 -0
- package/dist/src/tui/context/theme.js +31 -0
- package/dist/src/tui/context/theme.js.map +1 -0
- package/dist/src/tui/hooks/index.d.ts +2 -0
- package/dist/src/tui/hooks/index.d.ts.map +1 -0
- package/dist/src/tui/hooks/index.js +2 -0
- package/dist/src/tui/hooks/index.js.map +1 -0
- package/dist/src/tui/hooks/useKeyboardNav.d.ts +16 -0
- package/dist/src/tui/hooks/useKeyboardNav.d.ts.map +1 -0
- package/dist/src/tui/hooks/useKeyboardNav.js +429 -0
- package/dist/src/tui/hooks/useKeyboardNav.js.map +1 -0
- package/dist/src/tui/hooks/useListNavigation.d.ts +3 -0
- package/dist/src/tui/hooks/useListNavigation.d.ts.map +1 -0
- package/dist/src/tui/hooks/useListNavigation.js +123 -0
- package/dist/src/tui/hooks/useListNavigation.js.map +1 -0
- package/dist/src/tui/mocks.d.ts +6 -0
- package/dist/src/tui/mocks.d.ts.map +1 -0
- package/dist/src/tui/mocks.js +36 -0
- package/dist/src/tui/mocks.js.map +1 -0
- package/dist/src/tui/theme/Resolver.d.ts +6 -0
- package/dist/src/tui/theme/Resolver.d.ts.map +1 -0
- package/dist/src/tui/theme/Resolver.js +73 -0
- package/dist/src/tui/theme/Resolver.js.map +1 -0
- package/dist/src/tui/theme/ThemeRegistry.d.ts +3 -0
- package/dist/src/tui/theme/ThemeRegistry.d.ts.map +1 -0
- package/dist/src/tui/theme/ThemeRegistry.js +70 -0
- package/dist/src/tui/theme/ThemeRegistry.js.map +1 -0
- package/dist/src/tui/theme/data/aura.json +69 -0
- package/dist/src/tui/theme/data/ayu.json +80 -0
- package/dist/src/tui/theme/data/carbonfox.json +248 -0
- package/dist/src/tui/theme/data/catppuccin-frappe.json +233 -0
- package/dist/src/tui/theme/data/catppuccin-macchiato.json +233 -0
- package/dist/src/tui/theme/data/catppuccin.json +112 -0
- package/dist/src/tui/theme/data/cobalt2.json +228 -0
- package/dist/src/tui/theme/data/cursor.json +249 -0
- package/dist/src/tui/theme/data/dracula.json +219 -0
- package/dist/src/tui/theme/data/everforest.json +241 -0
- package/dist/src/tui/theme/data/flexoki.json +237 -0
- package/dist/src/tui/theme/data/github.json +233 -0
- package/dist/src/tui/theme/data/gruvbox.json +242 -0
- package/dist/src/tui/theme/data/kanagawa.json +77 -0
- package/dist/src/tui/theme/data/lucent-orng.json +237 -0
- package/dist/src/tui/theme/data/material.json +235 -0
- package/dist/src/tui/theme/data/matrix.json +77 -0
- package/dist/src/tui/theme/data/mercury.json +245 -0
- package/dist/src/tui/theme/data/monokai.json +221 -0
- package/dist/src/tui/theme/data/nightowl.json +221 -0
- package/dist/src/tui/theme/data/nord.json +223 -0
- package/dist/src/tui/theme/data/one-dark.json +84 -0
- package/dist/src/tui/theme/data/opencode.json +245 -0
- package/dist/src/tui/theme/data/orng.json +249 -0
- package/dist/src/tui/theme/data/osaka-jade.json +93 -0
- package/dist/src/tui/theme/data/palenight.json +222 -0
- package/dist/src/tui/theme/data/rosepine.json +234 -0
- package/dist/src/tui/theme/data/solarized.json +223 -0
- package/dist/src/tui/theme/data/synthwave84.json +226 -0
- package/dist/src/tui/theme/data/tokyonight.json +243 -0
- package/dist/src/tui/theme/data/vercel.json +245 -0
- package/dist/src/tui/theme/data/vesper.json +218 -0
- package/dist/src/tui/theme/data/zenburn.json +223 -0
- package/dist/src/tui/theme/default.d.ts +40 -0
- package/dist/src/tui/theme/default.d.ts.map +1 -0
- package/dist/src/tui/theme/default.js +35 -0
- package/dist/src/tui/theme/default.js.map +1 -0
- package/dist/src/tui/theme/resolver-utils.d.ts +28 -0
- package/dist/src/tui/theme/resolver-utils.d.ts.map +1 -0
- package/dist/src/tui/theme/resolver-utils.js +19 -0
- package/dist/src/tui/theme/resolver-utils.js.map +1 -0
- package/dist/src/tui/theme/themes.d.ts +3 -0
- package/dist/src/tui/theme/themes.d.ts.map +1 -0
- package/dist/src/tui/theme/themes.js +13 -0
- package/dist/src/tui/theme/themes.js.map +1 -0
- package/dist/src/tui/ui/Dialog.d.ts +19 -0
- package/dist/src/tui/ui/Dialog.d.ts.map +1 -0
- package/dist/src/tui/ui/Dialog.js +39 -0
- package/dist/src/tui/ui/Dialog.js.map +1 -0
- package/dist/src/tui/ui/DialogCommand.d.ts +2 -0
- package/dist/src/tui/ui/DialogCommand.d.ts.map +1 -0
- package/dist/src/tui/ui/DialogCommand.js +182 -0
- package/dist/src/tui/ui/DialogCommand.js.map +1 -0
- package/dist/src/tui/ui/DialogCreatePR.d.ts +2 -0
- package/dist/src/tui/ui/DialogCreatePR.d.ts.map +1 -0
- package/dist/src/tui/ui/DialogCreatePR.js +397 -0
- package/dist/src/tui/ui/DialogCreatePR.js.map +1 -0
- package/dist/src/tui/ui/DialogHelp.d.ts +6 -0
- package/dist/src/tui/ui/DialogHelp.d.ts.map +1 -0
- package/dist/src/tui/ui/DialogHelp.js +93 -0
- package/dist/src/tui/ui/DialogHelp.js.map +1 -0
- package/dist/src/tui/ui/DialogTheme.d.ts +2 -0
- package/dist/src/tui/ui/DialogTheme.d.ts.map +1 -0
- package/dist/src/tui/ui/DialogTheme.js +124 -0
- package/dist/src/tui/ui/DialogTheme.js.map +1 -0
- package/dist/src/tui/ui/index.d.ts +6 -0
- package/dist/src/tui/ui/index.d.ts.map +1 -0
- package/dist/src/tui/ui/index.js +6 -0
- package/dist/src/tui/ui/index.js.map +1 -0
- package/dist/src/tui/utils/prTemplates.d.ts +19 -0
- package/dist/src/tui/utils/prTemplates.d.ts.map +1 -0
- package/dist/src/tui/utils/prTemplates.js +46 -0
- package/dist/src/tui/utils/prTemplates.js.map +1 -0
- package/dist/test/ConfigService.test.d.ts +2 -0
- package/dist/test/ConfigService.test.d.ts.map +1 -0
- package/dist/test/ConfigService.test.js +40 -0
- package/dist/test/ConfigService.test.js.map +1 -0
- package/dist/test/ListBuilder.test.d.ts +2 -0
- package/dist/test/ListBuilder.test.d.ts.map +1 -0
- package/dist/test/ListBuilder.test.js +246 -0
- package/dist/test/ListBuilder.test.js.map +1 -0
- package/dist/test/MainList.test.d.ts +2 -0
- package/dist/test/MainList.test.d.ts.map +1 -0
- package/dist/test/MainList.test.js +228 -0
- package/dist/test/MainList.test.js.map +1 -0
- package/dist/test/Resolver.test.d.ts +2 -0
- package/dist/test/Resolver.test.d.ts.map +1 -0
- package/dist/test/Resolver.test.js +81 -0
- package/dist/test/Resolver.test.js.map +1 -0
- package/dist/test/Table.test.d.ts +2 -0
- package/dist/test/Table.test.d.ts.map +1 -0
- package/dist/test/Table.test.js +100 -0
- package/dist/test/Table.test.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +50 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@opentui/react/jsx-runtime";
|
|
2
|
+
import { parseColor } from "@opentui/core";
|
|
3
|
+
import { useTheme } from "../context/theme.js";
|
|
4
|
+
import { DateUtils } from "@knpkv/codecommit-core";
|
|
5
|
+
import { Badge } from "./Badge.js";
|
|
6
|
+
/**
|
|
7
|
+
* Renders a single row in the main PR list
|
|
8
|
+
* @category components
|
|
9
|
+
*/
|
|
10
|
+
export function ListItemRow({ isFirst, item, selected }) {
|
|
11
|
+
const { theme } = useTheme();
|
|
12
|
+
const bg = selected ? theme.selectedBackground : undefined;
|
|
13
|
+
const fg = selected ? theme.selectedText : theme.text;
|
|
14
|
+
if (item.type === "header") {
|
|
15
|
+
return (_jsx("box", { style: {
|
|
16
|
+
width: "100%",
|
|
17
|
+
backgroundColor: theme.backgroundPanel,
|
|
18
|
+
paddingLeft: 2,
|
|
19
|
+
paddingTop: isFirst ? 0 : 1,
|
|
20
|
+
flexDirection: "column"
|
|
21
|
+
}, children: _jsxs("box", { border: ["bottom"], borderColor: theme.textMuted, style: {
|
|
22
|
+
flexDirection: "row",
|
|
23
|
+
paddingBottom: 1,
|
|
24
|
+
width: "100%"
|
|
25
|
+
}, children: [_jsx("text", { fg: theme.textWarning, children: item.label.toUpperCase() }), item.count > 0 && _jsx("text", { fg: theme.textMuted, children: `(${item.count})` })] }) }));
|
|
26
|
+
}
|
|
27
|
+
if (item.type === "empty") {
|
|
28
|
+
return (_jsx("box", { border: ["left"], borderColor: parseColor(theme.primary), style: {
|
|
29
|
+
width: "100%",
|
|
30
|
+
paddingLeft: 4,
|
|
31
|
+
paddingBottom: 1,
|
|
32
|
+
flexDirection: "row",
|
|
33
|
+
flexWrap: "no-wrap"
|
|
34
|
+
}, children: _jsx("text", { fg: theme.textMuted, children: "(none)" }) }));
|
|
35
|
+
}
|
|
36
|
+
if (item.type === "pr") {
|
|
37
|
+
const pr = item.pr;
|
|
38
|
+
const badge = !pr.isMergeable ? (_jsx(Badge, { variant: "error", minWidth: 14, children: "CONFLICT" })) : pr.isApproved ? (_jsx(Badge, { variant: "success", minWidth: 14, children: "APPROVED" })) : (_jsx(Badge, { variant: "neutral", minWidth: 14, children: "NOT APPROVED" }));
|
|
39
|
+
const description = pr.description ? pr.description.split("\n").slice(0, 5).join("\n") : "";
|
|
40
|
+
return (_jsxs("box", { border: ["left"], borderColor: parseColor(theme.primary), style: {
|
|
41
|
+
width: "100%",
|
|
42
|
+
...(bg ? { backgroundColor: bg } : {}),
|
|
43
|
+
paddingLeft: 2,
|
|
44
|
+
paddingBottom: 1,
|
|
45
|
+
marginBottom: 1,
|
|
46
|
+
flexDirection: "column",
|
|
47
|
+
flexWrap: "no-wrap"
|
|
48
|
+
}, children: [_jsxs("box", { style: { flexDirection: "row", width: "100%", paddingBottom: 0 }, children: [badge, _jsx("box", { style: { flexGrow: 1 } }), _jsx("text", { fg: theme.textMuted, children: `${pr.author} • ${DateUtils.formatDate(pr.creationDate)}` })] }), _jsxs("box", { style: { flexDirection: "row", width: "100%" }, children: [_jsx("text", { fg: fg, children: `${pr.repositoryName} ` }), _jsx("text", { fg: theme.textMuted, children: "\u203A" }), _jsx("text", { fg: fg, children: ` ${pr.title}` })] }), description && (_jsx("text", { fg: theme.textMuted, style: { paddingLeft: 0, paddingTop: 0 }, children: description }))] }));
|
|
49
|
+
}
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=ListItemRow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ListItemRow.js","sourceRoot":"","sources":["../../../../src/tui/components/ListItemRow.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAE9C,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAQlC;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAoB;IACvE,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,CAAA;IAC5B,MAAM,EAAE,GAAG,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC,CAAC,SAAS,CAAA;IAC1D,MAAM,EAAE,GAAG,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAA;IAErD,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC3B,OAAO,CACL,cACE,KAAK,EAAE;gBACL,KAAK,EAAE,MAAM;gBACb,eAAe,EAAE,KAAK,CAAC,eAAe;gBACtC,WAAW,EAAE,CAAC;gBACd,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC3B,aAAa,EAAE,QAAQ;aACxB,YAED,eACE,MAAM,EAAE,CAAC,QAAQ,CAAC,EAClB,WAAW,EAAE,KAAK,CAAC,SAAS,EAC5B,KAAK,EAAE;oBACL,aAAa,EAAE,KAAK;oBACpB,aAAa,EAAE,CAAC;oBAChB,KAAK,EAAE,MAAM;iBACd,aAED,eAAM,EAAE,EAAE,KAAK,CAAC,WAAW,YAAG,I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ACb,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Domain } from "@knpkv/codecommit-core";
|
|
2
|
+
interface MainListProps {
|
|
3
|
+
readonly onSelectPR?: (pr: Domain.PullRequest) => void;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Main list component showing PRs, settings, or errors based on view
|
|
7
|
+
* @category components
|
|
8
|
+
*/
|
|
9
|
+
export declare function MainList({ onSelectPR }: MainListProps): import("react").ReactNode;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=MainList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MainList.d.ts","sourceRoot":"","sources":["../../../../src/tui/components/MainList.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAmHpD,UAAU,aAAa;IACrB,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,CAAC,WAAW,KAAK,IAAI,CAAA;CACvD;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,EAAE,UAAU,EAAE,EAAE,aAAa,6BAqErD"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@opentui/react/jsx-runtime";
|
|
2
|
+
import { Result, useAtomSet, useAtomValue } from "@effect-atom/atom-react";
|
|
3
|
+
import {} from "@opentui/core";
|
|
4
|
+
import { useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
5
|
+
import { appStateAtom, notificationsAtom, toggleAccountAtom } from "../atoms/app.js";
|
|
6
|
+
import { currentPRAtom, currentUserAtom, filterTextAtom, quickFilterTypeAtom, quickFilterValuesAtom, selectedIndexAtom, selectedPrIdAtom, settingsFilterAtom, viewAtom } from "../atoms/ui.js";
|
|
7
|
+
import { useTheme } from "../context/theme.js";
|
|
8
|
+
import { useListNavigation } from "../hooks/useListNavigation.js";
|
|
9
|
+
import { buildListItems } from "../ListBuilder.js";
|
|
10
|
+
import { ListItemRow } from "./ListItemRow.js";
|
|
11
|
+
import { applySettingsFilter, computeItemPositions, findGroupHeader, findStableIndex } from "./mainlist-utils.js";
|
|
12
|
+
import { NotificationsTable } from "./NotificationsTable.js";
|
|
13
|
+
import { SettingsTable } from "./SettingsTable.js";
|
|
14
|
+
// ── Hooks ───────────────────────────────────────────────────────────
|
|
15
|
+
const defaultState = { status: "loading", pullRequests: [], accounts: [] };
|
|
16
|
+
/** Caches last successful AppState to avoid flash during reloads */
|
|
17
|
+
const useCachedAppState = (result) => {
|
|
18
|
+
const [cached, setCached] = useState(defaultState);
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
if (Result.isSuccess(result))
|
|
21
|
+
setCached(result.value);
|
|
22
|
+
}, [result]);
|
|
23
|
+
return Result.isSuccess(result) ? result.value : cached;
|
|
24
|
+
};
|
|
25
|
+
/** Builds filtered list items from app state + view + filters */
|
|
26
|
+
const useFilteredItems = (state, view) => {
|
|
27
|
+
const filterText = useAtomValue(filterTextAtom);
|
|
28
|
+
const quickFilterType = useAtomValue(quickFilterTypeAtom);
|
|
29
|
+
const quickFilterValues = useAtomValue(quickFilterValuesAtom);
|
|
30
|
+
const currentUser = useAtomValue(currentUserAtom);
|
|
31
|
+
const settingsFilter = useAtomValue(settingsFilterAtom);
|
|
32
|
+
const notificationsResult = useAtomValue(notificationsAtom);
|
|
33
|
+
const notifications = Result.getOrElse(notificationsResult, () => ({ items: [] }));
|
|
34
|
+
const quickFilter = useMemo(() => ({ type: quickFilterType, value: quickFilterValues[quickFilterType], currentUser }), [quickFilterType, quickFilterValues, currentUser]);
|
|
35
|
+
const rawItems = useMemo(() => buildListItems(state, view, filterText, notifications.items, quickFilter), [state, view, filterText, notifications.items, quickFilter]);
|
|
36
|
+
return useMemo(() => (view === "settings" ? applySettingsFilter(rawItems, settingsFilter) : rawItems), [rawItems, view, settingsFilter]);
|
|
37
|
+
};
|
|
38
|
+
/** Resolves a stable selected index that survives list refreshes */
|
|
39
|
+
const useStableIndex = (items, view) => {
|
|
40
|
+
const selectedIndex = useAtomValue(selectedIndexAtom);
|
|
41
|
+
const selectedPrId = useAtomValue(selectedPrIdAtom);
|
|
42
|
+
return useMemo(() => findStableIndex(items, view, selectedPrId, selectedIndex), [items, selectedPrId, selectedIndex, view]);
|
|
43
|
+
};
|
|
44
|
+
/** Syncs currentPR atom and selectedPrId when selection changes */
|
|
45
|
+
const useSyncCurrentPR = (items, stableIndex, view) => {
|
|
46
|
+
const setCurrentPR = useAtomSet(currentPRAtom);
|
|
47
|
+
const selectedPrId = useAtomValue(selectedPrIdAtom);
|
|
48
|
+
const setSelectedPrId = useAtomSet(selectedPrIdAtom);
|
|
49
|
+
const currentPR = useMemo(() => {
|
|
50
|
+
const item = items[stableIndex];
|
|
51
|
+
return item?.type === "pr" ? item.pr : null;
|
|
52
|
+
}, [items, stableIndex]);
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
if (view === "details")
|
|
55
|
+
return;
|
|
56
|
+
setCurrentPR(currentPR);
|
|
57
|
+
if (currentPR && currentPR.id !== selectedPrId)
|
|
58
|
+
setSelectedPrId(currentPR.id);
|
|
59
|
+
}, [currentPR, setCurrentPR, setSelectedPrId, selectedPrId, view]);
|
|
60
|
+
};
|
|
61
|
+
/** Scrolls to keep the selected item visible in the scrollbox */
|
|
62
|
+
const useScrollToSelected = (scrollRef, items, stableIndex) => {
|
|
63
|
+
const positions = useMemo(() => computeItemPositions(items), [items]);
|
|
64
|
+
useLayoutEffect(() => {
|
|
65
|
+
if (!scrollRef.current || positions.length === 0)
|
|
66
|
+
return;
|
|
67
|
+
const pos = positions[stableIndex];
|
|
68
|
+
if (!pos)
|
|
69
|
+
return;
|
|
70
|
+
const box = scrollRef.current;
|
|
71
|
+
const scale = (box.scrollHeight ?? 0) / (positions[positions.length - 1]?.end ?? 1);
|
|
72
|
+
const scaledStart = pos.start * scale;
|
|
73
|
+
const prev = stableIndex > 0 ? positions[stableIndex - 1] : null;
|
|
74
|
+
const margin = prev ? (pos.start - prev.start) * scale : 0;
|
|
75
|
+
box.scrollTo({ x: 0, y: Math.max(0, scaledStart - margin) });
|
|
76
|
+
}, [stableIndex, positions]);
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Main list component showing PRs, settings, or errors based on view
|
|
80
|
+
* @category components
|
|
81
|
+
*/
|
|
82
|
+
export function MainList({ onSelectPR }) {
|
|
83
|
+
const { theme } = useTheme();
|
|
84
|
+
const scrollRef = useRef(null);
|
|
85
|
+
const result = useAtomValue(appStateAtom);
|
|
86
|
+
const view = useAtomValue(viewAtom);
|
|
87
|
+
const setView = useAtomSet(viewAtom);
|
|
88
|
+
const toggleAccount = useAtomSet(toggleAccountAtom);
|
|
89
|
+
const state = useCachedAppState(result);
|
|
90
|
+
const items = useFilteredItems(state, view);
|
|
91
|
+
const stableIndex = useStableIndex(items, view);
|
|
92
|
+
const currentGroupHeader = useMemo(() => findGroupHeader(items, stableIndex), [items, stableIndex]);
|
|
93
|
+
useSyncCurrentPR(items, stableIndex, view);
|
|
94
|
+
useScrollToSelected(scrollRef, items, stableIndex);
|
|
95
|
+
useListNavigation(items, () => {
|
|
96
|
+
const item = items[stableIndex];
|
|
97
|
+
if (item?.type === "pr" && onSelectPR)
|
|
98
|
+
onSelectPR(item.pr);
|
|
99
|
+
else if (item?.type === "account")
|
|
100
|
+
setView("prs");
|
|
101
|
+
}, () => {
|
|
102
|
+
const item = items[stableIndex];
|
|
103
|
+
if (item?.type === "account")
|
|
104
|
+
toggleAccount(item.account.profile);
|
|
105
|
+
});
|
|
106
|
+
// ── Render ──────────────────────────────────────────────────────
|
|
107
|
+
if (items.length === 0) {
|
|
108
|
+
return (_jsx("box", { style: {
|
|
109
|
+
flexGrow: 1,
|
|
110
|
+
width: "100%",
|
|
111
|
+
padding: 1,
|
|
112
|
+
paddingLeft: 2,
|
|
113
|
+
backgroundColor: theme.backgroundPanel,
|
|
114
|
+
justifyContent: "center",
|
|
115
|
+
alignItems: "center"
|
|
116
|
+
}, children: _jsx("text", { fg: theme.textMuted, children: "No items to display" }) }));
|
|
117
|
+
}
|
|
118
|
+
if (view === "settings")
|
|
119
|
+
return _jsx(SettingsTable, { items: items, selectedIndex: stableIndex });
|
|
120
|
+
if (view === "notifications")
|
|
121
|
+
return _jsx(NotificationsTable, { items: items, selectedIndex: stableIndex });
|
|
122
|
+
return (_jsxs("box", { style: { flexGrow: 1, width: "100%", paddingLeft: 1 }, children: [_jsx("scrollbox", { ref: scrollRef, style: { flexGrow: 1, width: "100%", backgroundColor: theme.backgroundPanel }, children: _jsx("box", { style: { flexDirection: "column", width: "100%" }, children: items.map((item, i) => (_jsx(ListItemRow, { item: item, selected: i === stableIndex, isFirst: i === 0 }, i))) }) }), currentGroupHeader && (_jsx("box", { style: { position: "absolute", top: 0, width: "100%" }, children: _jsx(ListItemRow, { item: currentGroupHeader, selected: items[stableIndex] === currentGroupHeader, isFirst: true }) }))] }));
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=MainList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MainList.js","sourceRoot":"","sources":["../../../../src/tui/components/MainList.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAE1E,OAAO,EAA4B,MAAM,eAAe,CAAA;AACxD,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC7E,OAAO,EAAiB,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACnG,OAAO,EACL,aAAa,EACb,eAAe,EACf,cAAc,EACd,mBAAmB,EACnB,qBAAqB,EACrB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,QAAQ,EACT,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,QAAQ,EAAE,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GAAI,GACzG,CACP,IACG,CACP,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ListItem } from "../ListBuilder.js";
|
|
2
|
+
interface NotificationsTableProps {
|
|
3
|
+
readonly items: ReadonlyArray<ListItem>;
|
|
4
|
+
readonly selectedIndex: number;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Table for notifications view
|
|
8
|
+
* @category components
|
|
9
|
+
*/
|
|
10
|
+
export declare function NotificationsTable({ items, selectedIndex }: NotificationsTableProps): import("react").ReactNode;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=NotificationsTable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotificationsTable.d.ts","sourceRoot":"","sources":["../../../../src/tui/components/NotificationsTable.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAMjD,UAAU,uBAAuB;IAC/B,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAA;IACvC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;CAC/B;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,KAAK,EAAE,aAAa,EAAE,EAAE,uBAAuB,6BA4FnF"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { jsx as _jsx } from "@opentui/react/jsx-runtime";
|
|
2
|
+
import { useTheme } from "../context/theme.js";
|
|
3
|
+
import { Badge } from "./Badge.js";
|
|
4
|
+
import { Table } from "./Table.js";
|
|
5
|
+
const isAuthError = (message) => /ExpiredToken|Unauthorized|AuthFailure|SSO|token|credentials/i.test(message);
|
|
6
|
+
/**
|
|
7
|
+
* Table for notifications view
|
|
8
|
+
* @category components
|
|
9
|
+
*/
|
|
10
|
+
export function NotificationsTable({ items, selectedIndex }) {
|
|
11
|
+
const { theme } = useTheme();
|
|
12
|
+
const columns = [
|
|
13
|
+
{
|
|
14
|
+
header: "TYPE",
|
|
15
|
+
width: 8,
|
|
16
|
+
render: (item) => {
|
|
17
|
+
if (item.type !== "notification")
|
|
18
|
+
return null;
|
|
19
|
+
const type = item.notification.type;
|
|
20
|
+
if (type === "error") {
|
|
21
|
+
return (_jsx(Badge, { variant: "error", minWidth: 5, children: "ERR" }));
|
|
22
|
+
}
|
|
23
|
+
if (type === "warning") {
|
|
24
|
+
return (_jsx(Badge, { variant: "warning", minWidth: 5, children: "WARN" }));
|
|
25
|
+
}
|
|
26
|
+
if (type === "success") {
|
|
27
|
+
return (_jsx(Badge, { variant: "success", minWidth: 5, children: "OK" }));
|
|
28
|
+
}
|
|
29
|
+
return (_jsx(Badge, { variant: "info", minWidth: 5, children: "INFO" }));
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
header: "MESSAGE",
|
|
34
|
+
width: "auto",
|
|
35
|
+
render: (item, selected) => {
|
|
36
|
+
if (item.type !== "notification")
|
|
37
|
+
return null;
|
|
38
|
+
const fg = selected ? theme.selectedText : theme.text;
|
|
39
|
+
return _jsx("text", { fg: fg, children: `${item.notification.title}: ${item.notification.message}` });
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
header: "ACTION",
|
|
44
|
+
width: 22,
|
|
45
|
+
render: (item, selected) => {
|
|
46
|
+
if (item.type !== "notification")
|
|
47
|
+
return null;
|
|
48
|
+
if (isAuthError(item.notification.message)) {
|
|
49
|
+
const bg = selected ? theme.success : theme.primary;
|
|
50
|
+
const fg = "#ffffff";
|
|
51
|
+
return (_jsx("box", { style: {
|
|
52
|
+
backgroundColor: bg,
|
|
53
|
+
paddingLeft: 1,
|
|
54
|
+
paddingRight: 1
|
|
55
|
+
}, children: _jsx("text", { fg: fg, children: selected ? "⏎ SSO Login" : " SSO Login" }) }));
|
|
56
|
+
}
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
header: "TIME",
|
|
62
|
+
width: 15,
|
|
63
|
+
render: (item) => {
|
|
64
|
+
if (item.type !== "notification")
|
|
65
|
+
return null;
|
|
66
|
+
return (_jsx("text", { fg: theme.textMuted, children: item.notification.timestamp.toLocaleTimeString("en-GB", { hour12: false }) }));
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
];
|
|
70
|
+
return (_jsx(Table, { data: items, columns: columns, selectedIndex: selectedIndex, keyExtractor: (i) => i.type === "notification" ? i.notification.message + i.notification.timestamp.getTime() : "" }));
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=NotificationsTable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotificationsTable.js","sourceRoot":"","sources":["../../../../src/tui/components/NotificationsTable.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAE9C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAe,KAAK,EAAE,MAAM,YAAY,CAAA;AAE/C,MAAM,WAAW,GAAG,CAAC,OAAe,EAAE,EAAE,CAAC,8DAA8D,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;AAOrH;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAAC,EAAE,KAAK,EAAE,aAAa,EAA2B;IAClF,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,CAAA;IAE5B,MAAM,OAAO,GAA4B;QACvC;YACE,MAAM,EAAE,MAAM;YACd,KAAK,EAAE,CAAC;YACR,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;gBACf,IAAI,IAAI,CAAC,IAAI,KAAK,cAAc;oBAAE,OAAO,IAAI,CAAA;gBAC7C,MAAM,IAAI,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAA;gBACnC,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;oBACrB,OAAO,CACL,KAAC,KAAK,IAAC,OAAO,EAAC,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B"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@opentui/react/jsx-runtime";
|
|
2
|
+
import { Result, useAtomValue } from "@effect-atom/atom-react";
|
|
3
|
+
import { notificationsAtom } from "../atoms/app.js";
|
|
4
|
+
import { quickFilterTypeAtom, quickFilterValuesAtom } from "../atoms/ui.js";
|
|
5
|
+
import { useTheme } from "../context/theme.js";
|
|
6
|
+
/**
|
|
7
|
+
* Quick filters bar for PRs
|
|
8
|
+
* @category components
|
|
9
|
+
*/
|
|
10
|
+
export function QuickFilters() {
|
|
11
|
+
const { theme } = useTheme();
|
|
12
|
+
const filterType = useAtomValue(quickFilterTypeAtom);
|
|
13
|
+
const filterValues = useAtomValue(quickFilterValuesAtom);
|
|
14
|
+
const filterValue = filterValues[filterType];
|
|
15
|
+
const notificationsResult = useAtomValue(notificationsAtom);
|
|
16
|
+
const notifications = Result.getOrElse(notificationsResult, () => ({ items: [] }));
|
|
17
|
+
const errorCount = notifications.items.filter((n) => n.type === "error").length;
|
|
18
|
+
const totalCount = notifications.items.length;
|
|
19
|
+
return (_jsxs("box", { style: {
|
|
20
|
+
height: 1,
|
|
21
|
+
width: "100%",
|
|
22
|
+
backgroundColor: theme.backgroundElement,
|
|
23
|
+
flexDirection: "row",
|
|
24
|
+
paddingLeft: 1,
|
|
25
|
+
justifyContent: "space-between"
|
|
26
|
+
}, children: [_jsxs("box", { style: { flexDirection: "row" }, children: [_jsx("box", { style: {
|
|
27
|
+
...(filterType === "all" && { backgroundColor: theme.primary }),
|
|
28
|
+
paddingLeft: 1,
|
|
29
|
+
paddingRight: 1
|
|
30
|
+
}, children: _jsx("text", { fg: filterType === "all" ? theme.selectedText : theme.textMuted, children: "[1] All" }) }), _jsx("box", { style: {
|
|
31
|
+
...(filterType === "mine" && { backgroundColor: theme.primary }),
|
|
32
|
+
paddingLeft: 1,
|
|
33
|
+
paddingRight: 1
|
|
34
|
+
}, children: _jsxs("text", { fg: filterType === "mine" ? theme.selectedText : theme.textMuted, children: ["[2] Mine", filterType === "mine" && filterValue ? `: ${filterValue}` : ""] }) }), _jsx("box", { style: {
|
|
35
|
+
...(filterType === "account" && { backgroundColor: theme.primary }),
|
|
36
|
+
paddingLeft: 1,
|
|
37
|
+
paddingRight: 1
|
|
38
|
+
}, children: _jsxs("text", { fg: filterType === "account" ? theme.selectedText : theme.textMuted, children: ["[3] Acct", filterType === "account" && filterValue ? `: ${filterValue}` : ""] }) }), _jsx("box", { style: {
|
|
39
|
+
...(filterType === "author" && { backgroundColor: theme.primary }),
|
|
40
|
+
paddingLeft: 1,
|
|
41
|
+
paddingRight: 1
|
|
42
|
+
}, children: _jsxs("text", { fg: filterType === "author" ? theme.selectedText : theme.textMuted, children: ["[4] Auth", filterType === "author" && filterValue ? `: ${filterValue}` : ""] }) }), _jsx("box", { style: {
|
|
43
|
+
...(filterType === "scope" && { backgroundColor: theme.primary }),
|
|
44
|
+
paddingLeft: 1,
|
|
45
|
+
paddingRight: 1
|
|
46
|
+
}, children: _jsxs("text", { fg: filterType === "scope" ? theme.selectedText : theme.textMuted, children: ["[5] Scope", filterType === "scope" && filterValue ? `: ${filterValue}` : ""] }) }), _jsx("box", { style: {
|
|
47
|
+
...(filterType === "date" && { backgroundColor: theme.primary }),
|
|
48
|
+
paddingLeft: 1,
|
|
49
|
+
paddingRight: 1
|
|
50
|
+
}, children: _jsxs("text", { fg: filterType === "date" ? theme.selectedText : theme.textMuted, children: ["[6] Age", filterType === "date" && filterValue
|
|
51
|
+
? `: ${filterValue === "today"
|
|
52
|
+
? "24h"
|
|
53
|
+
: filterValue === "week"
|
|
54
|
+
? "7d"
|
|
55
|
+
: filterValue === "month"
|
|
56
|
+
? "30d"
|
|
57
|
+
: "30d+"}`
|
|
58
|
+
: ""] }) }), _jsx("box", { style: {
|
|
59
|
+
...(filterType === "repo" && { backgroundColor: theme.primary }),
|
|
60
|
+
paddingLeft: 1,
|
|
61
|
+
paddingRight: 1
|
|
62
|
+
}, children: _jsxs("text", { fg: filterType === "repo" ? theme.selectedText : theme.textMuted, children: ["[7] Repo", filterType === "repo" && filterValue ? `: ${filterValue}` : ""] }) }), _jsx("box", { style: {
|
|
63
|
+
...(filterType === "status" && { backgroundColor: theme.primary }),
|
|
64
|
+
paddingLeft: 1,
|
|
65
|
+
paddingRight: 1
|
|
66
|
+
}, children: _jsxs("text", { fg: filterType === "status" ? theme.selectedText : theme.textMuted, children: ["[8] Status", filterType === "status" && filterValue ? `: ${filterValue}` : ""] }) }), (filterType === "mine" ||
|
|
67
|
+
filterType === "account" ||
|
|
68
|
+
filterType === "author" ||
|
|
69
|
+
filterType === "scope" ||
|
|
70
|
+
filterType === "date" ||
|
|
71
|
+
filterType === "repo" ||
|
|
72
|
+
filterType === "status") && _jsx("text", { fg: theme.textMuted, children: "[\u2190\u2192]" })] }), _jsxs("box", { style: { flexDirection: "row", paddingRight: 1 }, children: [errorCount > 0 && (_jsx("box", { style: { backgroundColor: theme.error, paddingLeft: 1, paddingRight: 1, marginRight: 1 }, children: _jsxs("text", { fg: theme.selectedText, children: ["[n] Errors (", errorCount, ")"] }) })), totalCount > errorCount && (_jsx("box", { style: { paddingLeft: 1, paddingRight: 1 }, children: _jsxs("text", { fg: theme.textMuted, children: ["Notif (", totalCount, ")"] }) }))] })] }));
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=QuickFilters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QuickFilters.js","sourceRoot":"","sources":["../../../../src/tui/components/QuickFilters.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAA;AAC3E,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAE9C;;;GAGG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 +1,12 @@
|
|
|
1
|
+
import type { ListItem } from "../ListBuilder.js";
|
|
2
|
+
interface SettingsTableProps {
|
|
3
|
+
readonly items: ReadonlyArray<ListItem>;
|
|
4
|
+
readonly selectedIndex: number;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Table for settings view
|
|
8
|
+
* @category components
|
|
9
|
+
*/
|
|
10
|
+
export declare function SettingsTable({ items, selectedIndex }: SettingsTableProps): import("react").ReactNode;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=SettingsTable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SettingsTable.d.ts","sourceRoot":"","sources":["../../../../src/tui/components/SettingsTable.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAIjD,UAAU,kBAAkB;IAC1B,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAA;IACvC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;CAC/B;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,EAAE,KAAK,EAAE,aAAa,EAAE,EAAE,kBAAkB,6BA4GzE"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "@opentui/react/jsx-runtime";
|
|
2
|
+
import { useAtomValue } from "@effect-atom/atom-react";
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
import { isSettingsFilteringAtom, settingsFilterAtom } from "../atoms/ui.js";
|
|
5
|
+
import { useTheme } from "../context/theme.js";
|
|
6
|
+
import { Badge } from "./Badge.js";
|
|
7
|
+
import { Table } from "./Table.js";
|
|
8
|
+
/**
|
|
9
|
+
* Table for settings view
|
|
10
|
+
* @category components
|
|
11
|
+
*/
|
|
12
|
+
export function SettingsTable({ items, selectedIndex }) {
|
|
13
|
+
const { theme } = useTheme();
|
|
14
|
+
const settingsFilter = useAtomValue(settingsFilterAtom);
|
|
15
|
+
const isFiltering = useAtomValue(isSettingsFilteringAtom);
|
|
16
|
+
// Count enabled/total (items are already filtered by MainList)
|
|
17
|
+
const { enabledCount, totalCount } = useMemo(() => {
|
|
18
|
+
let enabled = 0;
|
|
19
|
+
let total = 0;
|
|
20
|
+
for (const item of items) {
|
|
21
|
+
if (item.type === "account") {
|
|
22
|
+
total++;
|
|
23
|
+
if (item.account.enabled)
|
|
24
|
+
enabled++;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return { enabledCount: enabled, totalCount: total };
|
|
28
|
+
}, [items]);
|
|
29
|
+
const columns = [
|
|
30
|
+
{
|
|
31
|
+
header: "STATUS",
|
|
32
|
+
width: 8,
|
|
33
|
+
render: (item) => {
|
|
34
|
+
if (item.type !== "account")
|
|
35
|
+
return null;
|
|
36
|
+
const acc = item.account;
|
|
37
|
+
if (!acc.enabled) {
|
|
38
|
+
return (_jsx(Badge, { variant: "neutral", minWidth: 5, children: "OFF" }));
|
|
39
|
+
}
|
|
40
|
+
return (_jsx(Badge, { variant: "success", minWidth: 5, children: "ON" }));
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
header: "PROFILE",
|
|
45
|
+
width: "auto",
|
|
46
|
+
render: (item, selected) => {
|
|
47
|
+
if (item.type !== "account")
|
|
48
|
+
return null;
|
|
49
|
+
const fg = selected ? theme.selectedText : theme.text;
|
|
50
|
+
return _jsx("text", { fg: fg, children: item.account.profile });
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
];
|
|
54
|
+
return (_jsxs("box", { style: { flexDirection: "column", flexGrow: 1, width: "100%" }, children: [_jsx(Table, { data: items, columns: columns, selectedIndex: selectedIndex, keyExtractor: (i) => (i.type === "account" ? i.account.profile : "") }), _jsx("box", { style: {
|
|
55
|
+
height: 1,
|
|
56
|
+
width: "100%",
|
|
57
|
+
backgroundColor: theme.backgroundElement,
|
|
58
|
+
flexDirection: "row",
|
|
59
|
+
paddingLeft: 1
|
|
60
|
+
}, children: isFiltering ? (_jsxs(_Fragment, { children: [_jsx("text", { fg: theme.background, bg: theme.primary, children: " / " }), _jsx("text", { fg: theme.textMuted, children: " Filter: " }), _jsx("text", { fg: theme.text, children: settingsFilter }), _jsx("text", { fg: theme.primary, children: "│" })] })) : (_jsxs(_Fragment, { children: [_jsx("text", { fg: theme.textMuted, children: `[←→] ` }), !settingsFilter.startsWith("on:") && !settingsFilter.startsWith("off:") ? (_jsx("text", { fg: theme.selectedText, bg: theme.primary, children: " all " })) : (_jsx("text", { fg: theme.textMuted, children: " all " })), settingsFilter.startsWith("on:") ? (_jsx("text", { fg: theme.selectedText, bg: theme.primary, children: " on " })) : (_jsx("text", { fg: theme.textMuted, children: " on " })), settingsFilter.startsWith("off:") ? (_jsx("text", { fg: theme.selectedText, bg: theme.primary, children: " off " })) : (_jsx("text", { fg: theme.textMuted, children: " off " })), _jsx("text", { fg: theme.textMuted, children: ` [/] Filter [a] Enable [d] Disable ` }), _jsx("text", { fg: theme.primary, children: `${enabledCount}/${totalCount}` })] })) })] }));
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=SettingsTable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SettingsTable.js","sourceRoot":"","sources":["../../../../src/tui/components/SettingsTable.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAC/B,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAC5E,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAE9C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAe,KAAK,EAAE,MAAM,YAAY,CAAA;AAO/C;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,EAAE,KAAK,EAAE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category components
|
|
8
|
+
*/
|
|
9
|
+
export declare function Spinner({ active, label }: SpinnerProps): import("react").ReactNode;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=Spinner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Spinner.d.ts","sourceRoot":"","sources":["../../../../src/tui/components/Spinner.tsx"],"names":[],"mappings":"AAIA,UAAU,YAAY;IACpB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CACxB;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,EAAE,MAAM,EAAE,KAAoB,EAAE,EAAE,YAAY,6BAqBrE"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsxs as _jsxs } from "@opentui/react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import { SPINNER_FRAMES } from "../Constants.js";
|
|
4
|
+
import { useTheme } from "../context/theme.js";
|
|
5
|
+
/**
|
|
6
|
+
* Animated spinner component
|
|
7
|
+
* @category components
|
|
8
|
+
*/
|
|
9
|
+
export function Spinner({ active, label = "Loading..." }) {
|
|
10
|
+
const { theme } = useTheme();
|
|
11
|
+
const [frame, setFrame] = useState(0);
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
if (!active)
|
|
14
|
+
return;
|
|
15
|
+
const interval = setInterval(() => {
|
|
16
|
+
setFrame((f) => (f + 1) % SPINNER_FRAMES.length);
|
|
17
|
+
}, 80);
|
|
18
|
+
return () => clearInterval(interval);
|
|
19
|
+
}, [active]);
|
|
20
|
+
if (!active)
|
|
21
|
+
return null;
|
|
22
|
+
return (_jsxs("text", { fg: theme.textAccent, children: [SPINNER_FRAMES[frame], " ", label] }));
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=Spinner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Spinner.js","sourceRoot":"","sources":["../../../../src/tui/components/Spinner.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAO9C;;;GAGG;AACH,MAAM,UAAU,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,GAAG,YAAY,EAAgB;IACpE,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,CAAA;IAC5B,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAA;IAErC,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,MAAM;YAAE,OAAM;QAEnB,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,EAAE;YAChC,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,cAAc,CAAC,MAAM,CAAC,CAAA;QAClD,CAAC,EAAE,EAAE,CAAC,CAAA;QAEN,OAAO,GAAG,EAAE,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAA;IACtC,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAA;IAEZ,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAA;IAExB,OAAO,CACL,gBAAM,EAAE,EAAE,KAAK,CAAC,UAAU,aACvB,cAAc,CAAC,KAAK,CAAC,OAAG,KAAK,IACzB,CACR,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface StatusRowProps {
|
|
2
|
+
readonly label: string;
|
|
3
|
+
readonly children: React.ReactNode;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Renders a label and content row for details view
|
|
7
|
+
* @category components
|
|
8
|
+
*/
|
|
9
|
+
export declare function StatusRow({ children, label }: StatusRowProps): import("react").ReactNode;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=StatusRow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StatusRow.d.ts","sourceRoot":"","sources":["../../../../src/tui/components/StatusRow.tsx"],"names":[],"mappings":"AAEA,UAAU,cAAc;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CACnC;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,cAAc,6BAW5D"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@opentui/react/jsx-runtime";
|
|
2
|
+
import { useTheme } from "../context/theme.js";
|
|
3
|
+
/**
|
|
4
|
+
* Renders a label and content row for details view
|
|
5
|
+
* @category components
|
|
6
|
+
*/
|
|
7
|
+
export function StatusRow({ children, label }) {
|
|
8
|
+
const { theme } = useTheme();
|
|
9
|
+
return (_jsxs("box", { flexDirection: "row", style: { paddingBottom: 1, alignItems: "center" }, children: [_jsx("box", { style: { width: 12 }, children: _jsx("text", { fg: theme.textMuted, children: label }) }), children] }));
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=StatusRow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StatusRow.js","sourceRoot":"","sources":["../../../../src/tui/components/StatusRow.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAO9C;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAkB;IAC3D,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,CAAA;IAE5B,OAAO,CACL,eAAK,aAAa,EAAC,KAAK,EAAC,KAAK,EAAE,EAAE,aAAa,EAAE,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,aACxE,cAAK,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,YACvB,eAAM,EAAE,EAAE,KAAK,CAAC,SAAS,YAAG,KAAK,GAAQ,GACrC,EACL,QAAQ,IACL,CACP,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface Column<T> {
|
|
2
|
+
readonly header: string;
|
|
3
|
+
readonly width?: number | `${number}%` | "auto";
|
|
4
|
+
readonly render: (item: T, selected: boolean) => React.ReactNode;
|
|
5
|
+
}
|
|
6
|
+
interface TableProps<T> {
|
|
7
|
+
readonly data: ReadonlyArray<T>;
|
|
8
|
+
readonly columns: ReadonlyArray<Column<T>>;
|
|
9
|
+
readonly keyExtractor: (item: T) => string | number;
|
|
10
|
+
readonly hideHeader?: boolean;
|
|
11
|
+
readonly selectedIndex?: number;
|
|
12
|
+
readonly renderRow?: (item: T, index: number, isSelected: boolean) => React.ReactNode;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Reusable Table component for TUI
|
|
16
|
+
* @category components
|
|
17
|
+
*/
|
|
18
|
+
export declare function Table<T>({ columns, data, hideHeader, keyExtractor, renderRow: _renderRow, selectedIndex }: TableProps<T>): import("react").ReactNode;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=Table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../../../src/tui/components/Table.tsx"],"names":[],"mappings":"AAKA,MAAM,WAAW,MAAM,CAAC,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,GAAG,MAAM,GAAG,GAAG,MAAM,CAAA;IAC/C,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,QAAQ,EAAE,OAAO,KAAK,KAAK,CAAC,SAAS,CAAA;CACjE;AAED,UAAU,UAAU,CAAC,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,CAAA;IAC/B,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;IAC1C,QAAQ,CAAC,YAAY,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,GAAG,MAAM,CAAA;IACnD,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAA;IAC7B,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAA;IAC/B,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,KAAK,KAAK,CAAC,SAAS,CAAA;CACtF;AAED;;;GAGG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,EACvB,OAAO,EACP,IAAI,EACJ,UAAU,EACV,YAAY,EACZ,SAAS,EAAE,UAAU,EACrB,aAAa,EACd,EAAE,UAAU,CAAC,CAAC,CAAC,6BA4Ef"}
|