epiq 0.0.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/dist/app.d.ts +5 -0
- package/dist/app.js +12 -0
- package/dist/board/actions/board-action-map.d.ts +11 -0
- package/dist/board/actions/board-action-map.js +11 -0
- package/dist/board/actions/move-actions-routes.d.ts +4 -0
- package/dist/board/actions/move-actions-routes.js +31 -0
- package/dist/board/actions/move-actions.d.ts +5 -0
- package/dist/board/actions/move-actions.js +49 -0
- package/dist/board/board-action-map.d.ts +9 -0
- package/dist/board/board-action-map.js +7 -0
- package/dist/board/components/Board.d.ts +6 -0
- package/dist/board/components/Board.js +19 -0
- package/dist/board/components/Help.d.ts +4 -0
- package/dist/board/components/Help.js +21 -0
- package/dist/board/components/Logo.d.ts +2 -0
- package/dist/board/components/Logo.js +21 -0
- package/dist/board/components/ScrollBox.d.ts +9 -0
- package/dist/board/components/ScrollBox.js +22 -0
- package/dist/board/components/Swimlane.d.ts +8 -0
- package/dist/board/components/Swimlane.js +10 -0
- package/dist/board/components/Swimlanes.d.ts +8 -0
- package/dist/board/components/Swimlanes.js +20 -0
- package/dist/board/components/TicketListItem.d.ts +6 -0
- package/dist/board/components/TicketListItem.js +12 -0
- package/dist/board/components/TicketUI.d.ts +8 -0
- package/dist/board/components/TicketUI.js +9 -0
- package/dist/board/mock/board.d.ts +2 -0
- package/dist/board/mock/board.js +474 -0
- package/dist/board/model/board.model.d.ts +26 -0
- package/dist/board/model/board.model.js +6 -0
- package/dist/board/move-actions-routes.d.ts +4 -0
- package/dist/board/move-actions-routes.js +31 -0
- package/dist/board/move-actions.d.ts +5 -0
- package/dist/board/move-actions.js +49 -0
- package/dist/board/render/color.d.ts +7 -0
- package/dist/board/render/color.js +21 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +57 -0
- package/dist/components/Board.d.ts +6 -0
- package/dist/components/Board.js +15 -0
- package/dist/components/Help.d.ts +4 -0
- package/dist/components/Help.js +21 -0
- package/dist/components/Swimlane.d.ts +8 -0
- package/dist/components/Swimlane.js +10 -0
- package/dist/components/TicketListItem.d.ts +6 -0
- package/dist/components/TicketListItem.js +12 -0
- package/dist/lib/actions/board-action-map.d.ts +9 -0
- package/dist/lib/actions/board-action-map.js +7 -0
- package/dist/lib/actions/move-actions-utils.d.ts +5 -0
- package/dist/lib/actions/move-actions-utils.js +43 -0
- package/dist/lib/actions/move-actions.d.ts +4 -0
- package/dist/lib/actions/move-actions.js +31 -0
- package/dist/lib/board/board-action-map.d.ts +9 -0
- package/dist/lib/board/board-action-map.js +7 -0
- package/dist/lib/board/move-actions-routes.d.ts +4 -0
- package/dist/lib/board/move-actions-routes.js +31 -0
- package/dist/lib/board/move-actions.d.ts +5 -0
- package/dist/lib/board/move-actions.js +43 -0
- package/dist/lib/board-utils.d.ts +7 -0
- package/dist/lib/board-utils.js +33 -0
- package/dist/lib/default-actions-routes.d.ts +4 -0
- package/dist/lib/default-actions-routes.js +47 -0
- package/dist/lib/default-actions.d.ts +4 -0
- package/dist/lib/default-actions.js +47 -0
- package/dist/lib/navigation-context.d.ts +16 -0
- package/dist/lib/navigation-context.js +1 -0
- package/dist/lib/navigation.d.ts +10 -0
- package/dist/lib/navigation.js +74 -0
- package/dist/lib/render-utils.d.ts +10 -0
- package/dist/lib/render-utils.js +12 -0
- package/dist/lib/state.d.ts +8 -0
- package/dist/lib/state.js +8 -0
- package/dist/lib/types/action-map.model.d.ts +14 -0
- package/dist/lib/types/action-map.model.js +4 -0
- package/dist/lib/types/board.model.d.ts +21 -0
- package/dist/lib/types/board.model.js +5 -0
- package/dist/lib/types/navigation.model.d.ts +9 -0
- package/dist/lib/types/navigation.model.js +1 -0
- package/dist/lib/utils/array-utils.d.ts +5 -0
- package/dist/lib/utils/array-utils.js +7 -0
- package/dist/lib/utils/default-action-utils.d.ts +7 -0
- package/dist/lib/utils/default-action-utils.js +50 -0
- package/dist/lib/utils/default-actions.d.ts +7 -0
- package/dist/lib/utils/default-actions.js +50 -0
- package/dist/lib/utils/key-intent.d.ts +16 -0
- package/dist/lib/utils/key-intent.js +65 -0
- package/dist/lib/utils.d.ts +10 -0
- package/dist/lib/utils.js +12 -0
- package/dist/mock/board.d.ts +2 -0
- package/dist/mock/board.js +139 -0
- package/dist/navigation/actions/default-actions-routes.d.ts +4 -0
- package/dist/navigation/actions/default-actions-routes.js +47 -0
- package/dist/navigation/actions/default-actions.d.ts +7 -0
- package/dist/navigation/actions/default-actions.js +48 -0
- package/dist/navigation/model/action-map.model.d.ts +14 -0
- package/dist/navigation/model/action-map.model.js +4 -0
- package/dist/navigation/model/navigation-ctx.model.d.ts +16 -0
- package/dist/navigation/model/navigation-ctx.model.js +2 -0
- package/dist/navigation/model/navigation-tree.model.d.ts +9 -0
- package/dist/navigation/model/navigation-tree.model.js +1 -0
- package/dist/navigation/navigation.d.ts +10 -0
- package/dist/navigation/navigation.js +74 -0
- package/dist/navigation/state/state.d.ts +11 -0
- package/dist/navigation/state/state.js +10 -0
- package/dist/navigation/utils/key-intent.d.ts +16 -0
- package/dist/navigation/utils/key-intent.js +65 -0
- package/package.json +57 -0
- package/readme.md +37 -0
package/dist/app.d.ts
ADDED
package/dist/app.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Box } from 'ink';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { BoardUI } from './board/components/Board.js';
|
|
4
|
+
import { HelpUI } from './board/components/Help.js';
|
|
5
|
+
export default function App({ board }) {
|
|
6
|
+
const width = process.stdout.columns || 120;
|
|
7
|
+
const swimlaneWidth = Math.floor(width / board.children.length);
|
|
8
|
+
const renderedWidth = swimlaneWidth * board.children.length;
|
|
9
|
+
return (React.createElement(Box, { flexDirection: "column" },
|
|
10
|
+
React.createElement(BoardUI, { board: board, swimlaneWidth: swimlaneWidth }),
|
|
11
|
+
React.createElement(HelpUI, { width: renderedWidth })));
|
|
12
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ActionMap } from '../../navigation/model/action-map.model.js';
|
|
2
|
+
import { NavigateCtx } from '../../navigation/model/navigation-ctx.model.js';
|
|
3
|
+
import { BoardItemTypes } from '../model/board.model.js';
|
|
4
|
+
type BoardActionMap = ActionMap<{
|
|
5
|
+
[BoardItemTypes.BOARD]: [NavigateCtx];
|
|
6
|
+
[BoardItemTypes.SWIMLANE]: [NavigateCtx];
|
|
7
|
+
[BoardItemTypes.TICKET_LIST_ITEM]: [NavigateCtx];
|
|
8
|
+
[BoardItemTypes.TICKET]: [NavigateCtx];
|
|
9
|
+
}>;
|
|
10
|
+
export declare const BoardActions: BoardActionMap;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BoardItemTypes } from '../model/board.model.js';
|
|
2
|
+
import { moveAcrossParents, moveWithinParent } from './move-actions-routes.js';
|
|
3
|
+
export const BoardActions = {
|
|
4
|
+
[BoardItemTypes.BOARD]: [],
|
|
5
|
+
[BoardItemTypes.SWIMLANE]: [...moveWithinParent],
|
|
6
|
+
[BoardItemTypes.TICKET_LIST_ITEM]: [
|
|
7
|
+
...moveWithinParent,
|
|
8
|
+
...moveAcrossParents,
|
|
9
|
+
],
|
|
10
|
+
[BoardItemTypes.TICKET]: [],
|
|
11
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ActionEntry } from '../../navigation/model/action-map.model.js';
|
|
2
|
+
import { NavigateCtx } from '../../navigation/model/navigation-ctx.model.js';
|
|
3
|
+
export declare const moveWithinParent: ActionEntry<[NavigateCtx]>[];
|
|
4
|
+
export declare const moveAcrossParents: ActionEntry<[NavigateCtx]>[];
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Mode } from '../../navigation/model/action-map.model.js';
|
|
2
|
+
import { KeyIntent } from '../../navigation/utils/key-intent.js';
|
|
3
|
+
import { moveChildNextWithinParent, moveChildPreviousWithinParent, moveChildToNextParent, moveChildToPreviousParent, } from './move-actions.js';
|
|
4
|
+
export const moveWithinParent = [
|
|
5
|
+
{
|
|
6
|
+
mode: Mode.DEFAULT,
|
|
7
|
+
description: '[SHIFT + ARROW KEYS] Move item',
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
intent: KeyIntent.MovePreviousItem,
|
|
11
|
+
mode: Mode.DEFAULT,
|
|
12
|
+
action: moveChildPreviousWithinParent,
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
intent: KeyIntent.MoveNextItem,
|
|
16
|
+
mode: Mode.DEFAULT,
|
|
17
|
+
action: moveChildNextWithinParent,
|
|
18
|
+
},
|
|
19
|
+
];
|
|
20
|
+
export const moveAcrossParents = [
|
|
21
|
+
{
|
|
22
|
+
intent: KeyIntent.MoveToNextContainer,
|
|
23
|
+
mode: Mode.DEFAULT,
|
|
24
|
+
action: moveChildToNextParent,
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
intent: KeyIntent.MoveToPreviousContainer,
|
|
28
|
+
mode: Mode.DEFAULT,
|
|
29
|
+
action: moveChildToPreviousParent,
|
|
30
|
+
},
|
|
31
|
+
];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { NavigateCtx } from '../../navigation/model/navigation-ctx.model.js';
|
|
2
|
+
export declare const moveChildToNextParent: (ctx: NavigateCtx) => void;
|
|
3
|
+
export declare const moveChildToPreviousParent: (ctx: NavigateCtx) => void;
|
|
4
|
+
export declare const moveChildPreviousWithinParent: (ctx: NavigateCtx) => void;
|
|
5
|
+
export declare const moveChildNextWithinParent: (ctx: NavigateCtx) => void;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
function moveItemInArray({ array, from, to, }) {
|
|
2
|
+
if (from < 0 || from >= array.length || to < 0 || to >= array.length)
|
|
3
|
+
return;
|
|
4
|
+
const [item] = array.splice(from, 1);
|
|
5
|
+
if (item)
|
|
6
|
+
array.splice(to, 0, item);
|
|
7
|
+
}
|
|
8
|
+
function moveNodeToSiblingContainer(ctx, direction) {
|
|
9
|
+
const ancestors = ctx.breadCrumb;
|
|
10
|
+
const parent = ancestors.at(-1);
|
|
11
|
+
const grandParent = ancestors.at(-2);
|
|
12
|
+
if (!parent || !grandParent)
|
|
13
|
+
return;
|
|
14
|
+
const parentIndex = grandParent.children.findIndex(x => x.id === parent.id);
|
|
15
|
+
const targetIndex = parentIndex + direction;
|
|
16
|
+
if (parentIndex < 0 ||
|
|
17
|
+
targetIndex < 0 ||
|
|
18
|
+
targetIndex >= grandParent.children.length)
|
|
19
|
+
return;
|
|
20
|
+
const sibling = grandParent.children[targetIndex];
|
|
21
|
+
if (!sibling)
|
|
22
|
+
return;
|
|
23
|
+
if (!sibling?.children?.length && !Array.isArray(sibling.children))
|
|
24
|
+
return;
|
|
25
|
+
const currentIndex = ctx._selectedIndex;
|
|
26
|
+
if (currentIndex < 0 || currentIndex >= parent.children.length)
|
|
27
|
+
return;
|
|
28
|
+
const [node] = parent.children.splice(currentIndex, 1);
|
|
29
|
+
sibling.children.push(node);
|
|
30
|
+
const newBreadCrumb = [...ctx.breadCrumb.slice(0, -1), sibling];
|
|
31
|
+
const newIndex = sibling.children.length - 1;
|
|
32
|
+
ctx.reInvokeNavigate(newIndex, newBreadCrumb);
|
|
33
|
+
}
|
|
34
|
+
export const moveChildToNextParent = (ctx) => moveNodeToSiblingContainer(ctx, 1);
|
|
35
|
+
export const moveChildToPreviousParent = (ctx) => moveNodeToSiblingContainer(ctx, -1);
|
|
36
|
+
function moveChildWithinParent(ctx, direction) {
|
|
37
|
+
const from = ctx._selectedIndex;
|
|
38
|
+
const to = from + direction;
|
|
39
|
+
if (to < 0 || to >= ctx.navigationNode.children.length)
|
|
40
|
+
return;
|
|
41
|
+
moveItemInArray({
|
|
42
|
+
array: ctx.navigationNode.children,
|
|
43
|
+
from,
|
|
44
|
+
to,
|
|
45
|
+
});
|
|
46
|
+
ctx.select(to);
|
|
47
|
+
}
|
|
48
|
+
export const moveChildPreviousWithinParent = (ctx) => moveChildWithinParent(ctx, -1);
|
|
49
|
+
export const moveChildNextWithinParent = (ctx) => moveChildWithinParent(ctx, 1);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ActionMap } from '../navigation/model/action-map.model.js';
|
|
2
|
+
import { NavigateCtx } from '../navigation/model/navigation-ctx.model.js';
|
|
3
|
+
type BoardActionMap = ActionMap<{
|
|
4
|
+
BOARD: [NavigateCtx];
|
|
5
|
+
SWIMLANE: [NavigateCtx];
|
|
6
|
+
TICKET: [NavigateCtx];
|
|
7
|
+
}>;
|
|
8
|
+
export declare const BoardActions: BoardActionMap;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BoardItemTypes } from './model/board.model.js';
|
|
2
|
+
import { moveAcrossParents, moveWithinParent, } from './actions/move-actions-routes.js';
|
|
3
|
+
export const BoardActions = {
|
|
4
|
+
[BoardItemTypes.BOARD]: [],
|
|
5
|
+
[BoardItemTypes.SWIMLANE]: [...moveWithinParent],
|
|
6
|
+
[BoardItemTypes.TICKET]: [...moveWithinParent, ...moveAcrossParents],
|
|
7
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Box, Text, useApp, useInput } from 'ink';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { BoardContentUI } from './Swimlanes.js';
|
|
4
|
+
export const BoardUI = ({ board, swimlaneWidth, }) => {
|
|
5
|
+
const { exit } = useApp();
|
|
6
|
+
useInput((input, key) => {
|
|
7
|
+
if (key.escape || input === 'q') {
|
|
8
|
+
exit();
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
return (React.createElement(Box, { flexDirection: "column" },
|
|
12
|
+
React.createElement(Box, { padding: 1, justifyContent: "center" },
|
|
13
|
+
React.createElement(Text, null,
|
|
14
|
+
"--- ",
|
|
15
|
+
board.name,
|
|
16
|
+
" ---")),
|
|
17
|
+
React.createElement(Box, { flexDirection: "row" },
|
|
18
|
+
React.createElement(BoardContentUI, { items: board.children, width: swimlaneWidth }))));
|
|
19
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Box, Text } from 'ink';
|
|
2
|
+
import { navigationState } from '../../navigation/state/state.js';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
export const HelpUI = ({ width }) => (React.createElement(Box, { flexDirection: "column", paddingLeft: 1, paddingRight: 1, borderColor: "gray", borderStyle: "round", width: width },
|
|
5
|
+
React.createElement(Box, null,
|
|
6
|
+
React.createElement(Text, { color: "gray" }, "H: help")),
|
|
7
|
+
navigationState.viewHelp
|
|
8
|
+
? navigationState.availableActions
|
|
9
|
+
.filter(action => Boolean(action.description))
|
|
10
|
+
.filter(x => x.mode === navigationState.mode)
|
|
11
|
+
.map((action, index) => {
|
|
12
|
+
const [leftRaw, rightRaw] = action.description.split(']');
|
|
13
|
+
const left = leftRaw?.replace('[', '');
|
|
14
|
+
const right = rightRaw?.trim(); // no extra space
|
|
15
|
+
return (React.createElement(Box, { paddingLeft: 1, key: index, flexDirection: "row" },
|
|
16
|
+
React.createElement(Box, { width: 20 },
|
|
17
|
+
React.createElement(Text, { color: "cyan" }, left)),
|
|
18
|
+
React.createElement(Box, { flexGrow: 1 },
|
|
19
|
+
React.createElement(Text, { color: "white" }, right))));
|
|
20
|
+
})
|
|
21
|
+
: null));
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Box, Text } from 'ink';
|
|
2
|
+
import { highlight } from '../render/color.js';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
function replaceRange(str, start, end, replacement) {
|
|
5
|
+
return str.slice(0, start) + replacement + str.slice(end);
|
|
6
|
+
}
|
|
7
|
+
const logoLines = [
|
|
8
|
+
` ______ _____ _____ _____`,
|
|
9
|
+
`| ____| __ \\ |_ _| / ____|`,
|
|
10
|
+
`| |__ | |__)\\ | | | | `,
|
|
11
|
+
`| __| | ___/ | | | | `,
|
|
12
|
+
`| |____| | _| |_ | |____ `,
|
|
13
|
+
`|______|__| |_____| \\____ |`,
|
|
14
|
+
` (_|`,
|
|
15
|
+
];
|
|
16
|
+
const coloredLogo = logoLines
|
|
17
|
+
.map(line => replaceRange(line, 0, 7, highlight(line.slice(0, 7), 'cyan')))
|
|
18
|
+
.map(line => replaceRange(line, 31, 39, highlight(line.slice(31, 39), 'yellow')));
|
|
19
|
+
export default function Logo() {
|
|
20
|
+
return (React.createElement(Box, { flexDirection: "column", marginBottom: 1 }, coloredLogo.map((line, idx) => (React.createElement(Text, { key: idx }, line)))));
|
|
21
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Box, Text } from 'ink';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export const ScrollBoxUI = ({ children = [], size, selectedIndex, }) => {
|
|
4
|
+
if (children.length === 0) {
|
|
5
|
+
return null;
|
|
6
|
+
}
|
|
7
|
+
const scrollIndex = Math.floor(Math.max(selectedIndex, 0) / size);
|
|
8
|
+
const start = scrollIndex * size;
|
|
9
|
+
const end = start + size;
|
|
10
|
+
// Clamp values to avoid overflow
|
|
11
|
+
const visibleChildren = children.slice(start, end);
|
|
12
|
+
// Scrollbar calculations
|
|
13
|
+
const scrollBarHeight = size;
|
|
14
|
+
const scrollSteps = Math.floor(children.length / size) + 1;
|
|
15
|
+
const indexBarHeight = Math.ceil(scrollBarHeight / scrollSteps);
|
|
16
|
+
const barOffset = scrollIndex * indexBarHeight;
|
|
17
|
+
return (React.createElement(Box, { flexDirection: "row" },
|
|
18
|
+
children.length > size && (React.createElement(Box, { flexDirection: "column", width: 1, height: scrollBarHeight, marginRight: 1 }, Array.from({ length: scrollBarHeight }).map((_, i) => (React.createElement(Text, { key: i, color: i >= barOffset && i < barOffset + indexBarHeight
|
|
19
|
+
? 'cyan'
|
|
20
|
+
: 'gray' }, "\u2502"))))),
|
|
21
|
+
React.createElement(Box, { flexDirection: "column" }, visibleChildren)));
|
|
22
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Box, Text } from 'ink';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { ScrollBoxUI } from './ScrollBox.js';
|
|
4
|
+
import { TicketListItemUI } from './TicketListItem.js';
|
|
5
|
+
export const SwimlaneUI = ({ item, width }) => {
|
|
6
|
+
return (React.createElement(Box, { flexDirection: "column", width: width, borderStyle: "round", borderColor: item.isSelected ? 'cyan' : 'gray', paddingRight: 1, paddingLeft: 1, paddingBottom: 1, minHeight: 15 },
|
|
7
|
+
React.createElement(Box, { borderStyle: "round", borderColor: 'gray', justifyContent: "center" },
|
|
8
|
+
React.createElement(Text, { bold: true }, item.name)),
|
|
9
|
+
React.createElement(ScrollBoxUI, { selectedIndex: item.children.findIndex(x => x.isSelected), width: width, size: 10, children: item.children.map((ticket, index) => (React.createElement(TicketListItemUI, { key: index, width: width, ticket: ticket }))) })));
|
|
10
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Box } from 'ink';
|
|
3
|
+
import { navigationState } from '../../navigation/state/state.js';
|
|
4
|
+
import { BoardItemTypes } from '../model/board.model.js';
|
|
5
|
+
import { SwimlaneUI } from './Swimlane.js';
|
|
6
|
+
import { TicketUI } from './TicketUI.js';
|
|
7
|
+
export const BoardContentUI = ({ items, width }) => {
|
|
8
|
+
const actionContext = navigationState?.currentNode?.actionContext;
|
|
9
|
+
const isSwimlaneContext = [
|
|
10
|
+
undefined,
|
|
11
|
+
BoardItemTypes.BOARD,
|
|
12
|
+
BoardItemTypes.SWIMLANE,
|
|
13
|
+
BoardItemTypes.TICKET_LIST_ITEM,
|
|
14
|
+
].includes(actionContext);
|
|
15
|
+
const isTicketContext = actionContext === BoardItemTypes.TICKET;
|
|
16
|
+
return (React.createElement(Box, { flexDirection: "row" },
|
|
17
|
+
isSwimlaneContext &&
|
|
18
|
+
items.map((lane, index) => (React.createElement(SwimlaneUI, { key: index, width: width, item: lane }))),
|
|
19
|
+
isTicketContext && navigationState.currentNode && (React.createElement(TicketUI, { width: width * items.length, item: navigationState.currentNode }))));
|
|
20
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Box, Text } from 'ink';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { navigationState } from '../../navigation/state/state.js';
|
|
4
|
+
const truncateWithEllipsis = (str, width) => str.length >= width ? str.slice(0, width - 3) + '...' : str;
|
|
5
|
+
export const TicketListItemUI = ({ width, ticket }) => (React.createElement(Box, { borderBottom: true },
|
|
6
|
+
React.createElement(Text, { color: ticket.isSelected && navigationState.mode === 'move'
|
|
7
|
+
? 'white'
|
|
8
|
+
: ticket.isSelected
|
|
9
|
+
? 'cyan'
|
|
10
|
+
: navigationState.mode === 'move'
|
|
11
|
+
? 'gray'
|
|
12
|
+
: 'white' }, truncateWithEllipsis(ticket.id + ' - ' + ticket.name, width - 6))));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Box, Text } from 'ink';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export const TicketUI = ({ item, width }) => {
|
|
4
|
+
return (React.createElement(Box, { flexDirection: "row", padding: 1, paddingLeft: 2, borderStyle: 'round', width: width, minHeight: 16, borderColor: 'gray' },
|
|
5
|
+
React.createElement(Box, { flexDirection: "row" },
|
|
6
|
+
React.createElement(Box, { width: 20 },
|
|
7
|
+
React.createElement(Text, { color: 'cyan' }, 'Description: ')),
|
|
8
|
+
React.createElement(Text, null, item.name))));
|
|
9
|
+
};
|