@siegesailor/terminal-sigma 1.1.0 → 1.2.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 +59 -24
- package/build/app.js +150 -71
- package/build/app.js.map +1 -1
- package/build/command-line-interface.js +1 -1
- package/build/components/character.js +7 -7
- package/build/components/character.js.map +1 -1
- package/build/components/choice.js +32 -0
- package/build/components/choice.js.map +1 -0
- package/build/components/entry-form.js +9 -7
- package/build/components/entry-form.js.map +1 -1
- package/build/components/footer.js +10 -8
- package/build/components/footer.js.map +1 -1
- package/build/components/logs-view.js +35 -29
- package/build/components/logs-view.js.map +1 -1
- package/build/components/menu-grid.js +3 -2
- package/build/components/menu-grid.js.map +1 -1
- package/build/components/today-panel.js +20 -13
- package/build/components/today-panel.js.map +1 -1
- package/build/content.js +150 -40
- package/build/content.js.map +1 -1
- package/build/health.js +90 -0
- package/build/health.js.map +1 -0
- package/build/i18n.js +379 -30
- package/build/i18n.js.map +1 -1
- package/build/pixel-art.js +262 -305
- package/build/pixel-art.js.map +1 -1
- package/build/progress.js +14 -2
- package/build/progress.js.map +1 -1
- package/build/quotes.js +132 -27
- package/build/quotes.js.map +1 -1
- package/build/theme.js +119 -19
- package/build/theme.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Box, Text, useInput } from "ink";
|
|
3
|
+
import { usePalette } from "../theme.js";
|
|
4
|
+
// A vertical list in Claude Code's style. Unlike @inkjs/ui's Select, Enter on
|
|
5
|
+
// the preselected option still counts, which editing a saved value needs.
|
|
6
|
+
export default function Choice({ options, onSelect, initialValue, isActive = true, }) {
|
|
7
|
+
const palette = usePalette();
|
|
8
|
+
const [index, setIndex] = React.useState(() => Math.max(options.findIndex((option) => option.value === initialValue), 0));
|
|
9
|
+
useInput((input, key) => {
|
|
10
|
+
const count = options.length;
|
|
11
|
+
if (key.upArrow || input === "k") {
|
|
12
|
+
setIndex((current) => (current - 1 + count) % count);
|
|
13
|
+
}
|
|
14
|
+
else if (key.downArrow || input === "j") {
|
|
15
|
+
setIndex((current) => (current + 1) % count);
|
|
16
|
+
}
|
|
17
|
+
else if (key.return) {
|
|
18
|
+
const option = options[index];
|
|
19
|
+
if (option) {
|
|
20
|
+
onSelect(option.value);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}, { isActive });
|
|
24
|
+
return (React.createElement(Box, { flexDirection: "column" }, options.map((option, optionIndex) => {
|
|
25
|
+
const isFocused = optionIndex === index;
|
|
26
|
+
return (React.createElement(Box, { key: option.value, gap: 1 },
|
|
27
|
+
React.createElement(Text, { color: palette.accent }, isFocused ? "❯" : " "),
|
|
28
|
+
React.createElement(Text, { bold: isFocused, color: isFocused ? palette.accent : undefined }, option.label),
|
|
29
|
+
option.hint));
|
|
30
|
+
})));
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=choice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"choice.js","sourceRoot":"","sources":["../../source/components/choice.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAezC,8EAA8E;AAC9E,0EAA0E;AAC1E,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAC9B,OAAO,EACP,QAAQ,EACR,YAAY,EACZ,QAAQ,GAAG,IAAI,GACF;IACb,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,CAC7C,IAAI,CAAC,GAAG,CACP,OAAO,CAAC,SAAS,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,KAAK,YAA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C,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,IAE5C,MAAM,CAAC,KAAK,CACP;YACN,MAAM,CAAC,IAAI,CACP,CACN,CAAC;IACH,CAAC,CAAC,CACG,CACN,CAAC;AACH,CAAC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { TextInput } from "@inkjs/ui";
|
|
3
3
|
import { Box, Text } from "ink";
|
|
4
4
|
import { parseWholeNumber } from "../progress.js";
|
|
5
|
-
import {
|
|
5
|
+
import { usePalette } from "../theme.js";
|
|
6
|
+
import Choice from "./choice.js";
|
|
6
7
|
export default function EntryForm({ title, fields, messages, onSubmit, onValues, }) {
|
|
8
|
+
const palette = usePalette();
|
|
7
9
|
const [values, setValues] = React.useState({});
|
|
8
10
|
const [error, setError] = React.useState();
|
|
9
11
|
const field = fields[Object.keys(values).length];
|
|
@@ -35,18 +37,18 @@ export default function EntryForm({ title, fields, messages, onSubmit, onValues,
|
|
|
35
37
|
: value;
|
|
36
38
|
};
|
|
37
39
|
return (React.createElement(Box, { flexDirection: "column" },
|
|
38
|
-
React.createElement(Text, { bold: true, color:
|
|
40
|
+
React.createElement(Text, { bold: true, color: palette.accent }, title),
|
|
39
41
|
fields
|
|
40
42
|
.filter((done) => done.key in values)
|
|
41
|
-
.map((done) => (React.createElement(Text, { key: done.key },
|
|
42
|
-
React.createElement(Text, { color:
|
|
43
|
+
.map((done) => (React.createElement(Text, { key: done.key, wrap: "truncate-end" },
|
|
44
|
+
React.createElement(Text, { color: palette.success }, "\u2713 "),
|
|
43
45
|
React.createElement(Text, { dimColor: true }, `${done.label}: `),
|
|
44
46
|
React.createElement(Text, null, shown(done))))),
|
|
45
47
|
field ? (React.createElement(Box, { flexDirection: "column" },
|
|
46
48
|
React.createElement(Text, { bold: true }, `❯ ${field.label}`),
|
|
47
|
-
React.createElement(Box, { paddingLeft: 2 }, field.kind === "select" ? (React.createElement(
|
|
49
|
+
React.createElement(Box, { paddingLeft: 2 }, field.kind === "select" ? (React.createElement(Choice, { key: field.key, initialValue: field.defaultValue, options: field.options, onSelect: accept })) : (React.createElement(TextInput, { key: field.key, defaultValue: field.defaultValue, placeholder: field.kind === "text"
|
|
48
50
|
? field.placeholder
|
|
49
51
|
: `${field.minimum} - ${field.maximum}`, onSubmit: accept }))))) : null,
|
|
50
|
-
error ? React.createElement(Text, { color:
|
|
52
|
+
error ? React.createElement(Text, { color: palette.error }, error) : null));
|
|
51
53
|
}
|
|
52
54
|
//# sourceMappingURL=entry-form.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entry-form.js","sourceRoot":"","sources":["../../source/components/entry-form.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"entry-form.js","sourceRoot":"","sources":["../../source/components/entry-form.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAEhC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,MAAuB,MAAM,aAAa,CAAC;AAkBlD,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EACjC,KAAK,EACL,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,QAAQ,GACQ;IAChB,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAyB,EAAE,CAAC,CAAC;IACvE,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAU,CAAC;IACnD,MAAM,KAAK,GAAG,MAAM,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d,YAAY,EAAE,KAAK,CAAC,YAAY,EAChC,WAAW,EACV,KAAK,CAAC,IAAI,KAAK,MAAM;oBACpB,CAAC,CAAC,KAAK,CAAC,WAAW;oBACnB,CAAC,CAAC,GAAG,KAAK,CAAC,OAAO,MAAM,KAAK,CAAC,OAAO,EAAE,EAEzC,QAAQ,EAAE,MAAM,GACf,CACF,CACI,CACD,CACN,CAAC,CAAC,CAAC,IAAI;QACP,KAAK,CAAC,CAAC,CAAC,oBAAC,IAAI,IAAC,KAAK,EAAE,OAAO,CAAC,KAAK,IAAG,KAAK,CAAQ,CAAC,CAAC,CAAC,IAAI,CACrD,CACN,CAAC;AACH,CAAC"}
|
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Box, Text, useAnimation } from "ink";
|
|
3
|
-
import {
|
|
3
|
+
import { spinnerFrames, usePalette } from "../theme.js";
|
|
4
4
|
function Spinner() {
|
|
5
|
+
const palette = usePalette();
|
|
5
6
|
const { frame } = useAnimation({ interval: 120 });
|
|
6
|
-
return (React.createElement(Text, { color:
|
|
7
|
+
return (React.createElement(Text, { color: palette.accent }, spinnerFrames[frame % spinnerFrames.length]));
|
|
7
8
|
}
|
|
8
|
-
const toneColor = {
|
|
9
|
-
info: undefined,
|
|
10
|
-
success: colors.focus,
|
|
11
|
-
error: colors.error,
|
|
12
|
-
};
|
|
13
9
|
// Like Claude Code's status line: a spinner while something runs, a bullet otherwise.
|
|
14
10
|
export default function Footer({ status, message, tone, hint }) {
|
|
11
|
+
const palette = usePalette();
|
|
12
|
+
const toneColor = {
|
|
13
|
+
info: undefined,
|
|
14
|
+
success: palette.success,
|
|
15
|
+
error: palette.error,
|
|
16
|
+
};
|
|
15
17
|
return (React.createElement(Box, { flexShrink: 0, gap: 2, justifyContent: "space-between", paddingX: 1 },
|
|
16
18
|
React.createElement(Text, { wrap: "truncate-end" }, status ? (React.createElement(React.Fragment, null,
|
|
17
19
|
React.createElement(Spinner, null),
|
|
18
|
-
React.createElement(Text, { color:
|
|
20
|
+
React.createElement(Text, { color: palette.accent }, ` ${status}`),
|
|
19
21
|
React.createElement(Text, { dimColor: true }, ` ${message}`))) : (React.createElement(React.Fragment, null,
|
|
20
22
|
React.createElement(Text, { color: toneColor[tone], dimColor: tone === "info" }, "\u23FA"),
|
|
21
23
|
React.createElement(Text, null, ` ${message}`)))),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"footer.js","sourceRoot":"","sources":["../../source/components/footer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,KAAK,CAAC;AAC9C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"footer.js","sourceRoot":"","sources":["../../source/components/footer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,KAAK,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAWxD,SAAS,OAAO;IACf,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,EAAE,KAAK,EAAE,GAAG,YAAY,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC;IAClD,OAAO,CACN,oBAAC,IAAI,IAAC,KAAK,EAAE,OAAO,CAAC,MAAM,IACzB,aAAa,CAAC,KAAK,GAAG,aAAa,CAAC,MAAM,CAAC,CACtC,CACP,CAAC;AACH,CAAC;AAED,sFAAsF;AACtF,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAe;IAC1E,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,SAAS,GAAqC;QACnD,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,KAAK,EAAE,OAAO,CAAC,KAAK;KACpB,CAAC;IAEF,OAAO,CACN,oBAAC,GAAG,IAAC,UAAU,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,cAAc,EAAC,eAAe,EAAC,QAAQ,EAAE,CAAC;QACrE,oBAAC,IAAI,IAAC,IAAI,EAAC,cAAc,IACvB,MAAM,CAAC,CAAC,CAAC,CACT;YACC,oBAAC,OAAO,OAAG;YACX,oBAAC,IAAI,IAAC,KAAK,EAAE,OAAO,CAAC,MAAM,IAAG,IAAI,MAAM,EAAE,CAAQ;YAClD,oBAAC,IAAI,IAAC,QAAQ,UAAE,KAAK,OAAO,EAAE,CAAQ,CACpC,CACH,CAAC,CAAC,CAAC,CACH;YACC,oBAAC,IAAI,IAAC,KAAK,EAAE,SAAS,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,KAAK,MAAM,aAEhD;YACP,oBAAC,IAAI,QAAE,IAAI,OAAO,EAAE,CAAQ,CAC1B,CACH,CACK;QACP,oBAAC,GAAG,IAAC,UAAU,EAAE,CAAC;YACjB,oBAAC,IAAI,IAAC,QAAQ,UAAE,IAAI,CAAQ,CACvB,CACD,CACN,CAAC;AACH,CAAC"}
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Box, Text, useInput } from "ink";
|
|
3
3
|
import { formatNumber, workoutActivities, } from "../i18n.js";
|
|
4
|
-
import {
|
|
4
|
+
import { usePalette } from "../theme.js";
|
|
5
5
|
const filters = ["all", "focus", "meal", "workout"];
|
|
6
|
-
const kindColor = {
|
|
7
|
-
focus: colors.focus,
|
|
8
|
-
meal: colors.diet,
|
|
9
|
-
workout: colors.workout,
|
|
10
|
-
};
|
|
11
6
|
const isWorkoutActivity = (activity) => workoutActivities.includes(activity);
|
|
12
7
|
export function describeLog(log, language, messages) {
|
|
13
8
|
const amount = (value) => value === undefined ? "-" : formatNumber(language, value);
|
|
@@ -26,18 +21,18 @@ export function describeLog(log, language, messages) {
|
|
|
26
21
|
}
|
|
27
22
|
}
|
|
28
23
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
focus:
|
|
39
|
-
meal:
|
|
40
|
-
workout:
|
|
24
|
+
const kindLabels = (messages) => ({
|
|
25
|
+
all: messages.logs.all,
|
|
26
|
+
focus: messages.logs.focus,
|
|
27
|
+
meal: messages.logs.diet,
|
|
28
|
+
workout: messages.logs.workout,
|
|
29
|
+
});
|
|
30
|
+
export function LogRow({ log, language, messages }) {
|
|
31
|
+
const palette = usePalette();
|
|
32
|
+
const kindColor = {
|
|
33
|
+
focus: palette.metrics.focus,
|
|
34
|
+
meal: palette.metrics.protein,
|
|
35
|
+
workout: palette.metrics.workout,
|
|
41
36
|
};
|
|
42
37
|
const formatDate = new Intl.DateTimeFormat(language, {
|
|
43
38
|
month: "2-digit",
|
|
@@ -46,6 +41,25 @@ export default function LogsView({ logs, language, messages, height, }) {
|
|
|
46
41
|
minute: "2-digit",
|
|
47
42
|
hour12: false,
|
|
48
43
|
});
|
|
44
|
+
return (React.createElement(Box, { gap: 2 },
|
|
45
|
+
React.createElement(Box, { flexShrink: 0, width: 12 },
|
|
46
|
+
React.createElement(Text, { dimColor: true }, formatDate.format(new Date(log.at)))),
|
|
47
|
+
React.createElement(Box, { flexShrink: 0, width: 8 },
|
|
48
|
+
React.createElement(Text, { color: kindColor[log.kind], wrap: "truncate-end" }, kindLabels(messages)[log.kind])),
|
|
49
|
+
React.createElement(Box, { flexGrow: 1 },
|
|
50
|
+
React.createElement(Text, { wrap: "truncate-end" }, describeLog(log, language, messages))),
|
|
51
|
+
React.createElement(Box, { flexShrink: 0, justifyContent: "flex-end", width: 8 },
|
|
52
|
+
React.createElement(Text, { color: palette.accent }, `+${log.experience} XP`))));
|
|
53
|
+
}
|
|
54
|
+
export default function LogsView({ logs, language, messages, height, }) {
|
|
55
|
+
const palette = usePalette();
|
|
56
|
+
const [filter, setFilter] = React.useState("all");
|
|
57
|
+
const [offset, setOffset] = React.useState(0);
|
|
58
|
+
const shown = logs.filter((log) => filter === "all" || log.kind === filter);
|
|
59
|
+
// Title, tabs, summary, and their spacing take 4 rows.
|
|
60
|
+
const pageSize = Math.max(height - 4, 3);
|
|
61
|
+
const maximumOffset = Math.max(shown.length - pageSize, 0);
|
|
62
|
+
const labels = kindLabels(messages);
|
|
49
63
|
useInput((input, key) => {
|
|
50
64
|
const move = (step) => {
|
|
51
65
|
const next = filters[(filters.indexOf(filter) + step + filters.length) % filters.length];
|
|
@@ -78,19 +92,11 @@ export default function LogsView({ logs, language, messages, height, }) {
|
|
|
78
92
|
});
|
|
79
93
|
return (React.createElement(Box, { flexDirection: "column", flexGrow: 1 },
|
|
80
94
|
React.createElement(Box, { gap: 2 },
|
|
81
|
-
React.createElement(Text, { bold: true, color:
|
|
82
|
-
filters.map((option) => (React.createElement(Text, { key: option, bold: option === filter, color: option === filter ?
|
|
95
|
+
React.createElement(Text, { bold: true, color: palette.accent }, messages.logs.title),
|
|
96
|
+
filters.map((option) => (React.createElement(Text, { key: option, bold: option === filter, color: option === filter ? palette.accent : undefined, dimColor: option !== filter, underline: option === filter }, labels[option])))),
|
|
83
97
|
React.createElement(Text, { dimColor: true }, messages.logs.summary(shown.length, shown.reduce((total, log) => total + log.experience, 0))),
|
|
84
98
|
React.createElement(Box, { flexDirection: "column", marginTop: 1 },
|
|
85
99
|
shown.length === 0 ? (React.createElement(Text, { dimColor: true }, messages.logs.empty)) : null,
|
|
86
|
-
shown.slice(offset, offset + pageSize).map((log) => (React.createElement(
|
|
87
|
-
React.createElement(Box, { flexShrink: 0, width: 12 },
|
|
88
|
-
React.createElement(Text, { dimColor: true }, formatDate.format(new Date(log.at)))),
|
|
89
|
-
React.createElement(Box, { flexShrink: 0, width: 8 },
|
|
90
|
-
React.createElement(Text, { color: kindColor[log.kind] }, labels[log.kind])),
|
|
91
|
-
React.createElement(Box, { flexGrow: 1 },
|
|
92
|
-
React.createElement(Text, { wrap: "truncate-end" }, describeLog(log, language, messages))),
|
|
93
|
-
React.createElement(Box, { flexShrink: 0, justifyContent: "flex-end", width: 8 },
|
|
94
|
-
React.createElement(Text, { color: colors.accent }, `+${log.experience} XP`))))))));
|
|
100
|
+
shown.slice(offset, offset + pageSize).map((log) => (React.createElement(LogRow, { key: `${log.kind}-${log.at}`, language: language, log: log, messages: messages }))))));
|
|
95
101
|
}
|
|
96
102
|
//# sourceMappingURL=logs-view.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logs-view.js","sourceRoot":"","sources":["../../source/components/logs-view.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAC1C,OAAO,EACN,YAAY,EAGZ,iBAAiB,GAEjB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"logs-view.js","sourceRoot":"","sources":["../../source/components/logs-view.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAC1C,OAAO,EACN,YAAY,EAGZ,iBAAiB,GAEjB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,OAAO,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,CAAU,CAAC;AAG7D,MAAM,iBAAiB,GAAG,CAAC,QAAgB,EAA+B,EAAE,CAC1E,iBAAuC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAE7D,MAAM,UAAU,WAAW,CAAC,GAAQ,EAAE,QAAkB,EAAE,QAAk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
import { Box, Text, useInput } from "ink";
|
|
3
|
-
import {
|
|
3
|
+
import { usePalette } from "../theme.js";
|
|
4
4
|
const clamp = (value, minimum, maximum) => Math.min(Math.max(value, minimum), maximum);
|
|
5
5
|
export default function MenuGrid({ items, columns, onSelect, isActive = true, }) {
|
|
6
|
+
const palette = usePalette();
|
|
6
7
|
const [selectedIndex, setSelectedIndex] = React.useState(0);
|
|
7
8
|
const last = items.length - 1;
|
|
8
9
|
useInput((input, key) => {
|
|
@@ -32,7 +33,7 @@ export default function MenuGrid({ items, columns, onSelect, isActive = true, })
|
|
|
32
33
|
const index = rowIndex * columns + columnIndex;
|
|
33
34
|
const isSelected = index === selectedIndex;
|
|
34
35
|
return (React.createElement(Box, { key: item.label, flexBasis: 0, flexGrow: 1, justifyContent: "space-between" },
|
|
35
|
-
React.createElement(Text, { bold: isSelected, color: isSelected ?
|
|
36
|
+
React.createElement(Text, { bold: isSelected, color: isSelected ? palette.accent : undefined, wrap: "truncate-end" }, `${isSelected ? "❯" : " "} ${index + 1}. ${item.label}`),
|
|
36
37
|
React.createElement(Text, { dimColor: true }, item.signal)));
|
|
37
38
|
}),
|
|
38
39
|
Array.from({ length: columns - row.length }, (_, filler) => (React.createElement(Box, { key: `filler-${filler}`, flexBasis: 0, flexGrow: 1 })))))),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu-grid.js","sourceRoot":"","sources":["../../source/components/menu-grid.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAC1C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"menu-grid.js","sourceRoot":"","sources":["../../source/components/menu-grid.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;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a,CAAC;gBAE3C,OAAO,CACN,oBAAC,GAAG,IACH,GAAG,EAAE,IAAI,CAAC,KAAK,EACf,SAAS,EAAE,CAAC,EACZ,QAAQ,EAAE,CAAC,EACX,cAAc,EAAC,eAAe;oBAE9B,oBAAC,IAAI,IACJ,IAAI,EAAE,UAAU,EAChB,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,EAC9C,IAAI,EAAC,cAAc,IAElB,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,KAAK,GAAG,CAAC,KAAK,IAAI,CAAC,KAAK,EAAE,CAClD;oBACP,oBAAC,IAAI,IAAC,QAAQ,UAAE,IAAI,CAAC,MAAM,CAAQ,CAC9B,CACN,CAAC;YACH,CAAC,CAAC;YACD,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,OAAO,GAAG,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,CAC5D,oBAAC,GAAG,IAAC,GAAG,EAAE,UAAU,MAAM,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,GAAI,CAC3D,CAAC,CACG,CACN,CAAC;QACF,oBAAC,GAAG,IAAC,SAAS,EAAE,CAAC;YAChB,oBAAC,IAAI,IAAC,QAAQ,UAAE,KAAK,CAAC,aAAa,CAAC,EAAE,WAAW,CAAQ,CACpD,CACD,CACN,CAAC;AACH,CAAC"}
|
|
@@ -1,23 +1,30 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Box, Text } from "ink";
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import { usePalette } from "../theme.js";
|
|
4
|
+
function Bar({ metric, width }) {
|
|
5
|
+
const value = Math.min(Math.max(Math.round(metric.value), 0), 100);
|
|
6
|
+
const filled = Math.round((value / 100) * width);
|
|
7
|
+
return (React.createElement(Text, null,
|
|
8
|
+
React.createElement(Text, { color: metric.color }, "█".repeat(filled)),
|
|
9
|
+
React.createElement(Text, { dimColor: true }, "░".repeat(width - filled)),
|
|
10
|
+
React.createElement(Text, null, ` ${String(value).padStart(3)}%`)));
|
|
11
|
+
}
|
|
12
|
+
export default function TodayPanel({ title, sections, width, }) {
|
|
13
|
+
const palette = usePalette();
|
|
5
14
|
// Border and padding take 4 columns, and " 100%" takes 5.
|
|
6
15
|
const barWidth = Math.max(width - 9, 4);
|
|
7
|
-
return (React.createElement(Box, { borderColor:
|
|
16
|
+
return (React.createElement(Box, { borderColor: palette.border, borderStyle: "round", flexDirection: "column", flexShrink: 0, paddingX: 1, width: width },
|
|
8
17
|
React.createElement(Text, { bold: true }, title),
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return (React.createElement(Box, { key: metric.label, flexDirection: "column", marginTop: index === 0 ? 0 : 1 },
|
|
18
|
+
sections.map((section, index) => (React.createElement(Box, { key: section.title ?? `section-${index}`, flexDirection: "column", marginTop: index === 0 ? 0 : 1 },
|
|
19
|
+
section.title ? (React.createElement(Text, { bold: true, color: palette.soft }, section.title)) : null,
|
|
20
|
+
section.metrics.map((metric) => (React.createElement(Box, { key: metric.label, flexDirection: "column" },
|
|
13
21
|
React.createElement(Box, { gap: 1, justifyContent: "space-between" },
|
|
14
22
|
React.createElement(Box, { flexShrink: 0 },
|
|
15
|
-
React.createElement(Text, {
|
|
23
|
+
React.createElement(Text, { color: metric.color }, metric.label)),
|
|
16
24
|
React.createElement(Text, { dimColor: true, wrap: "truncate-end" }, metric.detail)),
|
|
17
|
-
React.createElement(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
})));
|
|
25
|
+
React.createElement(Bar, { metric: metric, width: barWidth })))),
|
|
26
|
+
section.advice ? (React.createElement(Text, { wrap: "truncate-end" },
|
|
27
|
+
React.createElement(Text, { color: section.advice.isDone ? palette.success : palette.accent }, "⏺ "),
|
|
28
|
+
React.createElement(Text, { dimColor: true }, section.advice.text))) : null)))));
|
|
22
29
|
}
|
|
23
30
|
//# sourceMappingURL=today-panel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"today-panel.js","sourceRoot":"","sources":["../../source/components/today-panel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"today-panel.js","sourceRoot":"","sources":["../../source/components/today-panel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAqBzC,SAAS,GAAG,CAAC,EAAE,MAAM,EAAE,KAAK,EAA+C;IAC1E,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACnE,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC;IAEjD,OAAO,CACN,oBAAC,IAAI;QACJ,oBAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,KAAK,IAAG,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAQ;QACtD,oBAAC,IAAI,IAAC,QAAQ,UAAE,GAAG,CAAC,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,CAAQ;QAClD,oBAAC,IAAI,QAAE,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAQ,CACzC,CACP,CAAC;AACH,CAAC;AAED,MAAM,CAAC,OAAO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,CAC3C;oBACN,oBAAC,IAAI,IAAC,QAAQ,QAAC,IAAI,EAAC,cAAc,IAChC,MAAM,CAAC,MAAM,CACR,CACF;gBACN,oBAAC,GAAG,IAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,GAAI,CACnC,CACN,CAAC;YACD,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CACjB,oBAAC,IAAI,IAAC,IAAI,EAAC,cAAc;gBACxB,oBAAC,IAAI,IACJ,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,IAE9D,IAAI,CACC;gBACP,oBAAC,IAAI,IAAC,QAAQ,UAAE,OAAO,CAAC,MAAM,CAAC,IAAI,CAAQ,CACrC,CACP,CAAC,CAAC,CAAC,IAAI,CACH,CACN,CAAC,CACG,CACN,CAAC;AACH,CAAC"}
|
package/build/content.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { adviceOf, targetsOf } from "./health.js";
|
|
2
|
+
import { formatNumber, genders, healthGoals, intensities, messagesOf, workoutActivities, workStyles, } from "./i18n.js";
|
|
2
3
|
import { dailyGoals, experienceOf, experiencePerLevel, todayOf, } from "./progress.js";
|
|
3
4
|
import { quoteRefreshMinutes } from "./quotes.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
//
|
|
5
|
+
export const characterWidth = 26;
|
|
6
|
+
// Header and footer take 5 rows. The character panel is 18 rows tall, Today
|
|
7
|
+
// 17, and the menu with its recent logs at least 16.
|
|
7
8
|
const chromeRows = 5;
|
|
8
|
-
const
|
|
9
|
+
const characterRows = 18;
|
|
10
|
+
const todayRows = 17;
|
|
11
|
+
const panelRows = 16;
|
|
9
12
|
// The panel that takes input always shows; the rest appears as space allows.
|
|
10
13
|
export function layoutOf(columns, rows) {
|
|
11
14
|
const menuColumnsOf = (panelWidth) => {
|
|
@@ -34,7 +37,7 @@ export function layoutOf(columns, rows) {
|
|
|
34
37
|
todayWidth: columns,
|
|
35
38
|
menuColumns: menuColumnsOf(panelWidth),
|
|
36
39
|
showCharacter: true,
|
|
37
|
-
showToday: rows >= chromeRows +
|
|
40
|
+
showToday: rows >= chromeRows + characterRows + todayRows,
|
|
38
41
|
todayBeside: false,
|
|
39
42
|
stacked: false,
|
|
40
43
|
};
|
|
@@ -43,54 +46,93 @@ export function layoutOf(columns, rows) {
|
|
|
43
46
|
panelWidth: columns,
|
|
44
47
|
todayWidth: columns,
|
|
45
48
|
menuColumns: menuColumnsOf(columns),
|
|
46
|
-
showCharacter: rows >= chromeRows + panelRows
|
|
47
|
-
showToday: rows >= chromeRows + panelRows
|
|
49
|
+
showCharacter: rows >= chromeRows + panelRows + characterRows,
|
|
50
|
+
showToday: rows >= chromeRows + panelRows + characterRows + todayRows,
|
|
48
51
|
todayBeside: false,
|
|
49
52
|
stacked: true,
|
|
50
53
|
};
|
|
51
54
|
}
|
|
52
55
|
const percentOf = (value, goal) => (value / goal) * 100;
|
|
53
|
-
export function
|
|
56
|
+
export function sectionsOf(language, palette, progress, now) {
|
|
57
|
+
const messages = messagesOf(language);
|
|
54
58
|
const today = todayOf(progress, now);
|
|
59
|
+
const targets = targetsOf(progress.profile);
|
|
55
60
|
const experience = experienceOf(progress);
|
|
56
61
|
const level = Math.floor(experience / experiencePerLevel) + 1;
|
|
57
62
|
const levelExperience = experience % experiencePerLevel;
|
|
63
|
+
const advice = adviceOf(progress.profile, today, language, messages);
|
|
64
|
+
const format = (value) => formatNumber(language, value);
|
|
58
65
|
return [
|
|
59
66
|
{
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
67
|
+
metrics: [
|
|
68
|
+
{
|
|
69
|
+
label: messages.today.character,
|
|
70
|
+
detail: messages.today.characterDetail(level + 1, experiencePerLevel - levelExperience),
|
|
71
|
+
value: percentOf(levelExperience, experiencePerLevel),
|
|
72
|
+
color: palette.metrics.character,
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
label: messages.today.focus,
|
|
76
|
+
detail: messages.today.focusDetail(today.focusSessions, dailyGoals.focusSessions),
|
|
77
|
+
value: percentOf(today.focusSessions, dailyGoals.focusSessions),
|
|
78
|
+
color: palette.metrics.focus,
|
|
79
|
+
},
|
|
80
|
+
],
|
|
64
81
|
},
|
|
65
82
|
{
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
83
|
+
title: progress.profile
|
|
84
|
+
? messages.health.title(messages.goal[progress.profile.goal])
|
|
85
|
+
: messages.today.health,
|
|
86
|
+
metrics: [
|
|
87
|
+
{
|
|
88
|
+
label: messages.today.protein,
|
|
89
|
+
detail: messages.today.proteinDetail(format(today.protein), format(targets.protein)),
|
|
90
|
+
value: percentOf(today.protein, targets.protein),
|
|
91
|
+
color: palette.metrics.protein,
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
label: messages.today.calories,
|
|
95
|
+
detail: messages.today.caloriesDetail(format(today.calories), format(targets.calories), today.meals),
|
|
96
|
+
value: percentOf(today.calories, targets.calories),
|
|
97
|
+
color: palette.metrics.calories,
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
label: messages.today.workout,
|
|
101
|
+
detail: messages.today.workoutDetail(today.workoutMinutes, targets.workoutMinutes),
|
|
102
|
+
value: percentOf(today.workoutMinutes, targets.workoutMinutes),
|
|
103
|
+
color: palette.metrics.workout,
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
advice: progress.profile
|
|
107
|
+
? (advice.find((item) => !item.isDone) ?? advice[0])
|
|
108
|
+
: { text: messages.health.noProfile, isDone: false },
|
|
82
109
|
},
|
|
83
110
|
];
|
|
84
111
|
}
|
|
85
112
|
export const menuOrder = [
|
|
86
113
|
"timer",
|
|
87
|
-
"
|
|
88
|
-
"workout",
|
|
114
|
+
"health",
|
|
89
115
|
"logs",
|
|
90
116
|
"quotes",
|
|
117
|
+
"profile",
|
|
118
|
+
"theme",
|
|
91
119
|
"language",
|
|
92
120
|
];
|
|
121
|
+
const languageSignal = {
|
|
122
|
+
en: "EN",
|
|
123
|
+
"zh-TW": "繁中",
|
|
124
|
+
ko: "한국어",
|
|
125
|
+
};
|
|
93
126
|
export function menuItemsOf(messages, language, state) {
|
|
127
|
+
const { profile } = state.progress;
|
|
128
|
+
const proteinLeft = targetsOf(profile).protein - todayOf(state.progress, state.now).protein;
|
|
129
|
+
let healthSignal = messages.signal.setUp;
|
|
130
|
+
if (profile) {
|
|
131
|
+
healthSignal =
|
|
132
|
+
proteinLeft > 0
|
|
133
|
+
? messages.signal.proteinLeft(proteinLeft)
|
|
134
|
+
: messages.signal.onTrack;
|
|
135
|
+
}
|
|
94
136
|
return [
|
|
95
137
|
{
|
|
96
138
|
label: messages.menu.timer,
|
|
@@ -98,14 +140,9 @@ export function menuItemsOf(messages, language, state) {
|
|
|
98
140
|
description: messages.describe.timer(state.focus, state.rest),
|
|
99
141
|
},
|
|
100
142
|
{
|
|
101
|
-
label: messages.menu.
|
|
102
|
-
signal:
|
|
103
|
-
description: messages.describe.
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
label: messages.menu.workout,
|
|
107
|
-
signal: messages.signal.minutes(state.workoutMinutes),
|
|
108
|
-
description: messages.describe.workout,
|
|
143
|
+
label: messages.menu.health,
|
|
144
|
+
signal: healthSignal,
|
|
145
|
+
description: messages.describe.health,
|
|
109
146
|
},
|
|
110
147
|
{
|
|
111
148
|
label: messages.menu.logs,
|
|
@@ -117,9 +154,19 @@ export function menuItemsOf(messages, language, state) {
|
|
|
117
154
|
signal: messages.signal.newQuote,
|
|
118
155
|
description: messages.describe.quotes(quoteRefreshMinutes),
|
|
119
156
|
},
|
|
157
|
+
{
|
|
158
|
+
label: messages.menu.profile,
|
|
159
|
+
signal: profile?.name ?? messages.signal.setUp,
|
|
160
|
+
description: messages.describe.profile,
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
label: messages.menu.theme,
|
|
164
|
+
signal: messages.themes.names[state.theme],
|
|
165
|
+
description: messages.describe.theme,
|
|
166
|
+
},
|
|
120
167
|
{
|
|
121
168
|
label: messages.menu.language,
|
|
122
|
-
signal: language
|
|
169
|
+
signal: languageSignal[language],
|
|
123
170
|
description: messages.describe.language,
|
|
124
171
|
},
|
|
125
172
|
];
|
|
@@ -173,4 +220,67 @@ export const workoutFieldsOf = (messages) => [
|
|
|
173
220
|
})),
|
|
174
221
|
},
|
|
175
222
|
];
|
|
223
|
+
// Saved values come back as defaults, so editing the profile is a run of Enter.
|
|
224
|
+
export const profileFieldsOf = (messages, profile, name) => [
|
|
225
|
+
{
|
|
226
|
+
key: "name",
|
|
227
|
+
label: messages.form.name,
|
|
228
|
+
kind: "text",
|
|
229
|
+
defaultValue: profile?.name ?? name,
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
key: "age",
|
|
233
|
+
label: messages.form.age,
|
|
234
|
+
kind: "number",
|
|
235
|
+
minimum: 10,
|
|
236
|
+
maximum: 100,
|
|
237
|
+
defaultValue: profile ? String(profile.age) : undefined,
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
key: "height",
|
|
241
|
+
label: messages.form.height,
|
|
242
|
+
kind: "number",
|
|
243
|
+
minimum: 100,
|
|
244
|
+
maximum: 250,
|
|
245
|
+
defaultValue: profile ? String(profile.height) : undefined,
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
key: "weight",
|
|
249
|
+
label: messages.form.weight,
|
|
250
|
+
kind: "number",
|
|
251
|
+
minimum: 30,
|
|
252
|
+
maximum: 300,
|
|
253
|
+
defaultValue: profile ? String(profile.weight) : undefined,
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
key: "gender",
|
|
257
|
+
label: messages.form.gender,
|
|
258
|
+
kind: "select",
|
|
259
|
+
options: genders.map((option) => ({
|
|
260
|
+
label: messages.gender[option],
|
|
261
|
+
value: option,
|
|
262
|
+
})),
|
|
263
|
+
defaultValue: profile?.gender,
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
key: "workStyle",
|
|
267
|
+
label: messages.form.workStyle,
|
|
268
|
+
kind: "select",
|
|
269
|
+
options: workStyles.map((option) => ({
|
|
270
|
+
label: messages.workStyle[option],
|
|
271
|
+
value: option,
|
|
272
|
+
})),
|
|
273
|
+
defaultValue: profile?.workStyle,
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
key: "goal",
|
|
277
|
+
label: messages.form.goal,
|
|
278
|
+
kind: "select",
|
|
279
|
+
options: healthGoals.map((option) => ({
|
|
280
|
+
label: messages.goal[option],
|
|
281
|
+
value: option,
|
|
282
|
+
})),
|
|
283
|
+
defaultValue: profile?.goal,
|
|
284
|
+
},
|
|
285
|
+
];
|
|
176
286
|
//# sourceMappingURL=content.js.map
|