@siegesailor/terminal-sigma 1.0.0 → 1.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 +84 -34
- package/build/app.js +308 -0
- package/build/app.js.map +1 -0
- package/build/command-line-interface.js +41 -4
- package/build/command-line-interface.js.map +1 -1
- package/build/components/character.js +16 -292
- package/build/components/character.js.map +1 -1
- package/build/components/entry-form.js +52 -0
- package/build/components/entry-form.js.map +1 -0
- package/build/components/footer.js +25 -0
- package/build/components/footer.js.map +1 -0
- package/build/components/logs-view.js +96 -0
- package/build/components/logs-view.js.map +1 -0
- package/build/components/menu-grid.js +26 -45
- package/build/components/menu-grid.js.map +1 -1
- package/build/components/today-panel.js +23 -0
- package/build/components/today-panel.js.map +1 -0
- package/build/content.js +176 -0
- package/build/content.js.map +1 -0
- package/build/i18n.js +254 -0
- package/build/i18n.js.map +1 -0
- package/build/pixel-art.js +402 -0
- package/build/pixel-art.js.map +1 -0
- package/build/progress.js +59 -33
- package/build/progress.js.map +1 -1
- package/build/quotes.js +52 -5
- package/build/quotes.js.map +1 -1
- package/build/theme.js +37 -0
- package/build/theme.js.map +1 -0
- package/package.json +1 -3
- package/build/commands/index.js +0 -274
- package/build/commands/index.js.map +0 -1
- package/build/components/status-panel.js +0 -19
- package/build/components/status-panel.js.map +0 -1
package/build/quotes.js
CHANGED
|
@@ -1,69 +1,116 @@
|
|
|
1
1
|
import process from "node:process";
|
|
2
2
|
import zod from "zod";
|
|
3
3
|
export const bundledQuotes = [
|
|
4
|
-
{
|
|
4
|
+
{
|
|
5
|
+
quote: "A healthy mind in a healthy body.",
|
|
6
|
+
author: "Juvenal",
|
|
7
|
+
zh: { quote: "健全的精神寓於健全的身體。", author: "尤維納利斯" },
|
|
8
|
+
},
|
|
5
9
|
{
|
|
6
10
|
quote: "Do what you can, with what you have, where you are.",
|
|
7
11
|
author: "Theodore Roosevelt",
|
|
12
|
+
zh: {
|
|
13
|
+
quote: "在你所在之處,用你所擁有的,做你能做的。",
|
|
14
|
+
author: "西奧多·羅斯福",
|
|
15
|
+
},
|
|
8
16
|
},
|
|
9
17
|
{
|
|
10
18
|
quote: "Energy and persistence conquer all things.",
|
|
11
19
|
author: "Benjamin Franklin",
|
|
20
|
+
zh: { quote: "精力與毅力能征服一切。", author: "班傑明·富蘭克林" },
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
quote: "Fall seven times, stand up eight.",
|
|
24
|
+
author: "Japanese Proverb",
|
|
25
|
+
zh: { quote: "七轉八起。", author: "日本諺語" },
|
|
12
26
|
},
|
|
13
|
-
{ quote: "Fall seven times, stand up eight.", author: "Japanese Proverb" },
|
|
14
27
|
{
|
|
15
28
|
quote: "First say to yourself what you would be; and then do what you have to do.",
|
|
16
29
|
author: "Epictetus",
|
|
30
|
+
zh: {
|
|
31
|
+
quote: "先告訴自己你想成為什麼樣的人,然後去做你該做的事。",
|
|
32
|
+
author: "愛比克泰德",
|
|
33
|
+
},
|
|
17
34
|
},
|
|
18
35
|
{
|
|
19
36
|
quote: "Habit is a cable; we weave a thread of it each day, and at last we cannot break it.",
|
|
20
37
|
author: "Horace Mann",
|
|
38
|
+
zh: {
|
|
39
|
+
quote: "習慣如纜繩,我們每天編進一縷,最終再也無法扯斷。",
|
|
40
|
+
author: "賀拉斯·曼",
|
|
41
|
+
},
|
|
21
42
|
},
|
|
22
43
|
{
|
|
23
44
|
quote: "He who has a why to live can bear almost any how.",
|
|
24
45
|
author: "Friedrich Nietzsche",
|
|
46
|
+
zh: { quote: "知道為何而活的人,幾乎能忍受任何生活。", author: "尼采" },
|
|
25
47
|
},
|
|
26
48
|
{
|
|
27
49
|
quote: "It does not matter how slowly you go as long as you do not stop.",
|
|
28
50
|
author: "Confucius",
|
|
51
|
+
zh: { quote: "只要不停下腳步,走得多慢都無妨。", author: "孔子" },
|
|
29
52
|
},
|
|
30
53
|
{
|
|
31
54
|
quote: "It is not that we have a short time to live, but that we waste a lot of it.",
|
|
32
55
|
author: "Seneca",
|
|
56
|
+
zh: { quote: "不是我們的生命短暫,而是我們浪費了太多。", author: "塞內卡" },
|
|
33
57
|
},
|
|
34
58
|
{
|
|
35
59
|
quote: "Knowing is not enough; we must apply.",
|
|
36
60
|
author: "Johann Wolfgang von Goethe",
|
|
61
|
+
zh: { quote: "知道是不夠的,我們必須應用。", author: "歌德" },
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
quote: "Lost time is never found again.",
|
|
65
|
+
author: "Benjamin Franklin",
|
|
66
|
+
zh: { quote: "失去的時間永遠找不回來。", author: "班傑明·富蘭克林" },
|
|
37
67
|
},
|
|
38
|
-
{ quote: "Lost time is never found again.", author: "Benjamin Franklin" },
|
|
39
68
|
{
|
|
40
69
|
quote: "No man is free who is not master of himself.",
|
|
41
70
|
author: "Epictetus",
|
|
71
|
+
zh: { quote: "不能主宰自己的人,就不是自由的人。", author: "愛比克泰德" },
|
|
42
72
|
},
|
|
43
73
|
{
|
|
44
74
|
quote: "Patience is bitter, but its fruit is sweet.",
|
|
45
75
|
author: "Jean-Jacques Rousseau",
|
|
76
|
+
zh: { quote: "忍耐是苦澀的,但它的果實是甜美的。", author: "盧梭" },
|
|
46
77
|
},
|
|
47
78
|
{
|
|
48
79
|
quote: "The journey of a thousand miles begins with one step.",
|
|
49
80
|
author: "Lao Tzu",
|
|
81
|
+
zh: { quote: "千里之行,始於足下。", author: "老子" },
|
|
50
82
|
},
|
|
51
83
|
{
|
|
52
84
|
quote: "Waste no more time arguing about what a good man should be. Be one.",
|
|
53
85
|
author: "Marcus Aurelius",
|
|
86
|
+
zh: {
|
|
87
|
+
quote: "別再浪費時間爭論好人該是什麼樣子,去成為一個好人。",
|
|
88
|
+
author: "馬可·奧理略",
|
|
89
|
+
},
|
|
54
90
|
},
|
|
55
91
|
{
|
|
56
92
|
quote: "We suffer more often in imagination than in reality.",
|
|
57
93
|
author: "Seneca",
|
|
94
|
+
zh: { quote: "我們在想像中受的苦,往往多於現實。", author: "塞內卡" },
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
quote: "Well begun is half done.",
|
|
98
|
+
author: "Aristotle",
|
|
99
|
+
zh: { quote: "好的開始是成功的一半。", author: "亞里斯多德" },
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
quote: "Well done is better than well said.",
|
|
103
|
+
author: "Benjamin Franklin",
|
|
104
|
+
zh: { quote: "做得好勝過說得好。", author: "班傑明·富蘭克林" },
|
|
58
105
|
},
|
|
59
|
-
{ quote: "Well begun is half done.", author: "Aristotle" },
|
|
60
|
-
{ quote: "Well done is better than well said.", author: "Benjamin Franklin" },
|
|
61
106
|
];
|
|
62
107
|
export const quoteRefreshMinutes = 30;
|
|
108
|
+
export const hasQuoteApi = () => Boolean(process.env.API_NINJAS_KEY);
|
|
63
109
|
export const randomBundledQuote = () => bundledQuotes[Math.floor(Math.random() * bundledQuotes.length)] ?? {
|
|
64
110
|
quote: "Well begun is half done.",
|
|
65
111
|
author: "Aristotle",
|
|
66
112
|
};
|
|
113
|
+
export const localizedQuote = (quote, language) => language === "zh-TW" && quote.zh ? quote.zh : quote;
|
|
67
114
|
const apiResponse = zod
|
|
68
115
|
.array(zod.object({ quote: zod.string().min(1), author: zod.string() }))
|
|
69
116
|
.min(1);
|
package/build/quotes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quotes.js","sourceRoot":"","sources":["../source/quotes.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,GAAG,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"quotes.js","sourceRoot":"","sources":["../source/quotes.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,GAAG,MAAM,KAAK,CAAC;AAQtB,MAAM,CAAC,MAAM,aAAa,GAAqB;IAC9C;QACC,KAAK,EAAE,mCAAmC;QAC1C,MAAM,EAAE,SAAS;QACjB,EA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AAO,KAAK,IAAI,kBAAkB,EAAE,CAAC;IACtC,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,kBAAkB,EAAE,CAAC;IAC7B,CAAC;AACF,CAAC"}
|
package/build/theme.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { extendTheme, defaultTheme } from "@inkjs/ui";
|
|
2
|
+
// The palette Claude Code uses, so the dashboard feels at home next to it.
|
|
3
|
+
export const colors = {
|
|
4
|
+
accent: "#D97757",
|
|
5
|
+
border: "#888888",
|
|
6
|
+
error: "#FF6B80",
|
|
7
|
+
focus: "#4EBA65",
|
|
8
|
+
diet: "#FFC107",
|
|
9
|
+
workout: "#B48EF2",
|
|
10
|
+
};
|
|
11
|
+
// Claude Code's spinner: the glyphs grow, then shrink back.
|
|
12
|
+
const spinnerGlyphs = ["·", "✢", "✳", "✶", "✻", "✽"];
|
|
13
|
+
export const spinnerFrames = [
|
|
14
|
+
...spinnerGlyphs,
|
|
15
|
+
...spinnerGlyphs.slice(1, -1).toReversed(),
|
|
16
|
+
];
|
|
17
|
+
export const uiTheme = extendTheme(defaultTheme, {
|
|
18
|
+
components: {
|
|
19
|
+
// Keys are @inkjs/ui component names.
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
21
|
+
Select: {
|
|
22
|
+
styles: {
|
|
23
|
+
focusIndicator: () => ({ color: colors.accent }),
|
|
24
|
+
label: ({ isFocused }) => ({
|
|
25
|
+
color: isFocused ? colors.accent : undefined,
|
|
26
|
+
}),
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
30
|
+
TextInput: {
|
|
31
|
+
styles: {
|
|
32
|
+
value: () => ({ color: colors.accent }),
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
//# sourceMappingURL=theme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.js","source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9
|
"command-line-tool",
|
|
10
10
|
"ink",
|
|
11
|
-
"pastel",
|
|
12
11
|
"pomodoro",
|
|
13
12
|
"self-development",
|
|
14
13
|
"terminal-dashboard",
|
|
@@ -23,7 +22,7 @@
|
|
|
23
22
|
"bugs": {
|
|
24
23
|
"url": "https://github.com/SiegeSailor/Terminal-Sigma/issues"
|
|
25
24
|
},
|
|
26
|
-
"version": "1.
|
|
25
|
+
"version": "1.1.0",
|
|
27
26
|
"bin": {
|
|
28
27
|
"siegesailor-terminal-sigma": "build/command-line-interface.js"
|
|
29
28
|
},
|
|
@@ -53,7 +52,6 @@
|
|
|
53
52
|
"@inkjs/ui": "2.0.0",
|
|
54
53
|
"ink": "7.0.0",
|
|
55
54
|
"meow": "14.1.0",
|
|
56
|
-
"pastel": "4.0.1",
|
|
57
55
|
"react": "19.2.5",
|
|
58
56
|
"zod": "4.3.6"
|
|
59
57
|
},
|
package/build/commands/index.js
DELETED
|
@@ -1,274 +0,0 @@
|
|
|
1
|
-
import { homedir } from "node:os";
|
|
2
|
-
import process from "node:process";
|
|
3
|
-
import zod from "zod";
|
|
4
|
-
import React from "react";
|
|
5
|
-
import { TextInput } from "@inkjs/ui";
|
|
6
|
-
import { Box, Text, useApp, useInput, useWindowSize } from "ink";
|
|
7
|
-
import Character from "../components/character.js";
|
|
8
|
-
import MenuGrid from "../components/menu-grid.js";
|
|
9
|
-
import StatusPanel from "../components/status-panel.js";
|
|
10
|
-
import { dailyGoals, experienceOf, experiencePerLevel, experiencePerMeal, levelOf, loadProgress, parseEntry, progressFile, saveProgress, todayOf, } from "../progress.js";
|
|
11
|
-
import { fetchQuote, quoteRefreshMinutes, randomBundledQuote, } from "../quotes.js";
|
|
12
|
-
import { advanceTimer, formatClock, idleTimer, remainingOf, toggleTimer, } from "../timer.js";
|
|
13
|
-
const clamp = (value, minimum, maximum) => Math.min(Math.max(value, minimum), maximum);
|
|
14
|
-
const percentOf = (value, goal) => Math.min(Math.round((value / goal) * 100), 100);
|
|
15
|
-
const goalSignal = (value, goal) => {
|
|
16
|
-
if (value >= goal) {
|
|
17
|
-
return { signal: "Done", badgeColor: "green" };
|
|
18
|
-
}
|
|
19
|
-
return value > 0
|
|
20
|
-
? { signal: "Going", badgeColor: "yellow" }
|
|
21
|
-
: { signal: "Start", badgeColor: "blue" };
|
|
22
|
-
};
|
|
23
|
-
export const options = zod.object({
|
|
24
|
-
name: zod.string().describe("Your name").default("Rook Sigma"),
|
|
25
|
-
focus: zod.number().int().positive().describe("Focus minutes").default(25),
|
|
26
|
-
break: zod.number().int().positive().describe("Break minutes").default(5),
|
|
27
|
-
});
|
|
28
|
-
export default function Index({ options }) {
|
|
29
|
-
const { exit } = useApp();
|
|
30
|
-
const { columns } = useWindowSize();
|
|
31
|
-
const file = React.useMemo(() => progressFile(), []);
|
|
32
|
-
const [progress, setProgress] = React.useState(() => loadProgress(file));
|
|
33
|
-
const [now, setNow] = React.useState(Date.now);
|
|
34
|
-
const durations = React.useMemo(() => ({ focus: options.focus, break: options.break }), [options.focus, options.break]);
|
|
35
|
-
const [timer, setTimer] = React.useState(() => idleTimer(durations));
|
|
36
|
-
const [quote, setQuote] = React.useState(randomBundledQuote);
|
|
37
|
-
const [entry, setEntry] = React.useState();
|
|
38
|
-
const [message, setMessage] = React.useState(`Progress is saved to ${file.replace(homedir(), "~")}.`);
|
|
39
|
-
const record = React.useCallback((update, text) => {
|
|
40
|
-
const next = update(progress);
|
|
41
|
-
try {
|
|
42
|
-
saveProgress(file, next);
|
|
43
|
-
}
|
|
44
|
-
catch (error) {
|
|
45
|
-
setMessage(`Not saved: ${String(error)}`);
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
const before = levelOf(experienceOf(progress));
|
|
49
|
-
const after = levelOf(experienceOf(next));
|
|
50
|
-
setProgress(next);
|
|
51
|
-
setMessage(after > before ? `${text} Level up! LV ${after}.` : text);
|
|
52
|
-
}, [file, progress]);
|
|
53
|
-
React.useEffect(() => {
|
|
54
|
-
const interval = setInterval(() => {
|
|
55
|
-
setNow(Date.now());
|
|
56
|
-
}, 1000);
|
|
57
|
-
return () => {
|
|
58
|
-
clearInterval(interval);
|
|
59
|
-
};
|
|
60
|
-
}, []);
|
|
61
|
-
React.useEffect(() => {
|
|
62
|
-
const { timer: next, finished } = advanceTimer(timer, now, durations);
|
|
63
|
-
if (!finished) {
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
setTimer(next);
|
|
67
|
-
process.stdout.write("\u0007");
|
|
68
|
-
if (finished === "break") {
|
|
69
|
-
setMessage("Break over. Select Tomato Timer and press Enter to focus.");
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
record((current) => ({
|
|
73
|
-
...current,
|
|
74
|
-
focus: [
|
|
75
|
-
...current.focus,
|
|
76
|
-
{ at: new Date(now).toISOString(), minutes: durations.focus },
|
|
77
|
-
],
|
|
78
|
-
}), `Focus complete, +${durations.focus} XP. ${durations.break}-minute break started.`);
|
|
79
|
-
}, [now, timer, durations, record]);
|
|
80
|
-
React.useEffect(() => {
|
|
81
|
-
let isMounted = true;
|
|
82
|
-
const refresh = async () => {
|
|
83
|
-
const next = await fetchQuote();
|
|
84
|
-
if (isMounted) {
|
|
85
|
-
setQuote(next);
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
void refresh();
|
|
89
|
-
const interval = setInterval(() => {
|
|
90
|
-
void refresh();
|
|
91
|
-
}, quoteRefreshMinutes * 60_000);
|
|
92
|
-
return () => {
|
|
93
|
-
isMounted = false;
|
|
94
|
-
clearInterval(interval);
|
|
95
|
-
};
|
|
96
|
-
}, []);
|
|
97
|
-
useInput((input, key) => {
|
|
98
|
-
if (entry) {
|
|
99
|
-
if (key.escape) {
|
|
100
|
-
setEntry(undefined);
|
|
101
|
-
setMessage("Nothing logged.");
|
|
102
|
-
}
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
if (input === "q") {
|
|
106
|
-
exit();
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
const submitEntry = (text) => {
|
|
110
|
-
const parsed = parseEntry(text);
|
|
111
|
-
const at = new Date().toISOString();
|
|
112
|
-
setEntry(undefined);
|
|
113
|
-
if (!parsed) {
|
|
114
|
-
setMessage("Nothing logged.");
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
if (entry === "meal") {
|
|
118
|
-
record((current) => ({
|
|
119
|
-
...current,
|
|
120
|
-
meals: [
|
|
121
|
-
...current.meals,
|
|
122
|
-
{ at, food: parsed.label, calories: parsed.amount },
|
|
123
|
-
],
|
|
124
|
-
}), `Logged ${parsed.label}, +${experiencePerMeal} XP.`);
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
if (!parsed.amount) {
|
|
128
|
-
setMessage("Add the minutes to log a workout, e.g. Run 30.");
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
const minutes = parsed.amount;
|
|
132
|
-
record((current) => ({
|
|
133
|
-
...current,
|
|
134
|
-
workouts: [
|
|
135
|
-
...current.workouts,
|
|
136
|
-
{ at, activity: parsed.label, minutes },
|
|
137
|
-
],
|
|
138
|
-
}), `Logged ${parsed.label} for ${minutes} minutes, +${minutes} XP.`);
|
|
139
|
-
};
|
|
140
|
-
const selectMenu = (index) => {
|
|
141
|
-
switch (index) {
|
|
142
|
-
case 0: {
|
|
143
|
-
const next = toggleTimer(timer, Date.now());
|
|
144
|
-
setTimer(next);
|
|
145
|
-
setMessage(next.endsAt === undefined
|
|
146
|
-
? "Timer paused."
|
|
147
|
-
: `${next.phase === "focus" ? "Focus" : "Break"} running.`);
|
|
148
|
-
break;
|
|
149
|
-
}
|
|
150
|
-
case 1: {
|
|
151
|
-
setEntry("meal");
|
|
152
|
-
break;
|
|
153
|
-
}
|
|
154
|
-
case 2: {
|
|
155
|
-
setEntry("workout");
|
|
156
|
-
break;
|
|
157
|
-
}
|
|
158
|
-
default: {
|
|
159
|
-
void fetchQuote().then(setQuote);
|
|
160
|
-
setMessage("New quote drawn.");
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
};
|
|
164
|
-
const experience = experienceOf(progress);
|
|
165
|
-
const level = levelOf(experience);
|
|
166
|
-
const levelExperience = experience % experiencePerLevel;
|
|
167
|
-
const today = todayOf(progress, now);
|
|
168
|
-
const isIdle = timer.endsAt === undefined &&
|
|
169
|
-
timer.phase === "focus" &&
|
|
170
|
-
timer.remaining === durations.focus * 60_000;
|
|
171
|
-
const clock = formatClock(remainingOf(timer, now));
|
|
172
|
-
const phaseLabel = timer.phase.toUpperCase();
|
|
173
|
-
let timerSignal = `${phaseLabel} ${clock}`;
|
|
174
|
-
let timerStatus = `${phaseLabel} ${clock} left`;
|
|
175
|
-
if (isIdle) {
|
|
176
|
-
timerSignal = "Ready";
|
|
177
|
-
timerStatus = "";
|
|
178
|
-
}
|
|
179
|
-
else if (timer.endsAt === undefined) {
|
|
180
|
-
timerSignal = "Paused";
|
|
181
|
-
timerStatus = `${phaseLabel} paused at ${clock}`;
|
|
182
|
-
}
|
|
183
|
-
const realtime = [
|
|
184
|
-
new Date(now).toTimeString().slice(0, 8),
|
|
185
|
-
timerStatus,
|
|
186
|
-
message,
|
|
187
|
-
]
|
|
188
|
-
.filter(Boolean)
|
|
189
|
-
.join(" | ");
|
|
190
|
-
const metrics = [
|
|
191
|
-
{
|
|
192
|
-
label: "Character Progression",
|
|
193
|
-
value: percentOf(levelExperience, experiencePerLevel),
|
|
194
|
-
detail: `${experiencePerLevel - levelExperience} XP to level ${level + 1}.`,
|
|
195
|
-
signal: `LV ${level}`,
|
|
196
|
-
badgeColor: "blue",
|
|
197
|
-
numberColor: "cyanBright",
|
|
198
|
-
},
|
|
199
|
-
{
|
|
200
|
-
label: "Tomato Timer",
|
|
201
|
-
value: percentOf(today.focusSessions, dailyGoals.focusSessions),
|
|
202
|
-
detail: `${today.focusSessions} of ${dailyGoals.focusSessions} focus sessions today.`,
|
|
203
|
-
...goalSignal(today.focusSessions, dailyGoals.focusSessions),
|
|
204
|
-
numberColor: "greenBright",
|
|
205
|
-
},
|
|
206
|
-
{
|
|
207
|
-
label: "Diet Tracker",
|
|
208
|
-
value: percentOf(today.meals, dailyGoals.meals),
|
|
209
|
-
detail: `${today.meals} of ${dailyGoals.meals} meals, ${today.calories} kcal today.`,
|
|
210
|
-
...goalSignal(today.meals, dailyGoals.meals),
|
|
211
|
-
numberColor: "yellowBright",
|
|
212
|
-
},
|
|
213
|
-
{
|
|
214
|
-
label: "Workout Tracker",
|
|
215
|
-
value: percentOf(today.workoutMinutes, dailyGoals.workoutMinutes),
|
|
216
|
-
detail: `${today.workoutMinutes} of ${dailyGoals.workoutMinutes} workout minutes today.`,
|
|
217
|
-
...goalSignal(today.workoutMinutes, dailyGoals.workoutMinutes),
|
|
218
|
-
numberColor: "magentaBright",
|
|
219
|
-
},
|
|
220
|
-
];
|
|
221
|
-
const menuItems = [
|
|
222
|
-
{
|
|
223
|
-
label: "Tomato Timer",
|
|
224
|
-
signal: timerSignal,
|
|
225
|
-
description: `Enter starts or pauses a ${durations.focus}-minute focus. Each finished focus earns ${durations.focus} XP, then a ${durations.break}-minute break begins.`,
|
|
226
|
-
color: "greenBright",
|
|
227
|
-
},
|
|
228
|
-
{
|
|
229
|
-
label: "Diet Tracker",
|
|
230
|
-
signal: `${today.meals} meals`,
|
|
231
|
-
description: `Enter logs a meal as food and optional calories, e.g. Oatmeal 350. Each meal earns ${experiencePerMeal} XP.`,
|
|
232
|
-
color: "yellowBright",
|
|
233
|
-
},
|
|
234
|
-
{
|
|
235
|
-
label: "Workout Tracker",
|
|
236
|
-
signal: `${today.workoutMinutes} min`,
|
|
237
|
-
description: "Enter logs a workout as activity and minutes, e.g. Run 30. Each minute earns 1 XP.",
|
|
238
|
-
color: "magentaBright",
|
|
239
|
-
},
|
|
240
|
-
{
|
|
241
|
-
label: "Everyday Quotes",
|
|
242
|
-
signal: "New",
|
|
243
|
-
description: `Enter draws a new quote. It also refreshes every ${quoteRefreshMinutes} minutes, from API Ninjas when API_NINJAS_KEY is set.`,
|
|
244
|
-
color: "cyanBright",
|
|
245
|
-
},
|
|
246
|
-
];
|
|
247
|
-
const terminalWidth = columns || 100;
|
|
248
|
-
const panelWidth = Math.min(clamp(terminalWidth - 4, 68, 112), terminalWidth);
|
|
249
|
-
const contentWidth = Math.max(panelWidth - 4, 40);
|
|
250
|
-
const shouldStackTopRow = contentWidth < 88;
|
|
251
|
-
const characterWidth = shouldStackTopRow ? contentWidth : 32;
|
|
252
|
-
const statusWidth = shouldStackTopRow
|
|
253
|
-
? contentWidth
|
|
254
|
-
: Math.max(contentWidth - characterWidth - 3, 32);
|
|
255
|
-
const menuColumns = contentWidth < 56 ? 1 : 2;
|
|
256
|
-
return (React.createElement(Box, { flexDirection: "column", width: panelWidth },
|
|
257
|
-
React.createElement(Box, { borderStyle: "round", borderColor: "gray", flexDirection: "column", paddingX: 1, paddingY: 1, width: panelWidth },
|
|
258
|
-
React.createElement(Text, { color: "cyanBright" }, "TERMINAL SIGMA"),
|
|
259
|
-
React.createElement(Text, { color: "gray", wrap: "truncate-end" }, realtime),
|
|
260
|
-
React.createElement(Box, { flexDirection: shouldStackTopRow ? "column" : "row", justifyContent: "space-between", marginTop: 1 },
|
|
261
|
-
React.createElement(StatusPanel, { metrics: metrics, quote: quote, width: statusWidth }),
|
|
262
|
-
React.createElement(Box, { marginLeft: shouldStackTopRow ? 0 : 3, marginTop: shouldStackTopRow ? 1 : 0 },
|
|
263
|
-
React.createElement(Character, { level: level, name: options.name, width: characterWidth }))),
|
|
264
|
-
React.createElement(Box, { marginTop: 1 },
|
|
265
|
-
React.createElement(Text, { color: "gray" }, "-".repeat(contentWidth))),
|
|
266
|
-
React.createElement(Box, { marginTop: 1 },
|
|
267
|
-
React.createElement(MenuGrid, { columns: menuColumns, isActive: !entry, items: menuItems, title: "NAVIGATION MENU", width: contentWidth, onSelect: selectMenu })),
|
|
268
|
-
entry ? (React.createElement(Box, { marginTop: 1 },
|
|
269
|
-
React.createElement(Text, { color: "cyanBright" }, entry === "meal" ? "Meal > " : "Workout > "),
|
|
270
|
-
React.createElement(TextInput, { placeholder: entry === "meal"
|
|
271
|
-
? "Oatmeal 350, Enter to log, Esc to cancel"
|
|
272
|
-
: "Run 30, Enter to log, Esc to cancel", onSubmit: submitEntry }))) : null)));
|
|
273
|
-
}
|
|
274
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/commands/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACjE,OAAO,SAAS,MAAM,4BAA4B,CAAC;AACnD,OAAO,QAA2B,MAAM,4BAA4B,CAAC;AACrE,OAAO,WAAkC,MAAM,+BAA+B,CAAC;AAC/E,OAAO,EACN,UAAU,EACV,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,OAAO,EACP,YAAY,EACZ,UAAU,EAEV,YAAY,EACZ,YAAY,EACZ,OAAO,GACP,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACN,UAAU,EACV,mBAAmB,EACnB,kBAAkB,GAClB,MAAM,cAAc,CAAC;AACtB,OAAO,EACN,YAAY,EACZ,WAAW,EACX,SAAS,EACT,WAAW,EACX,WAAW,GACX,MAAM,aAAa,CAAC;AAErB,MAAM,KAAK,GAAG,CAAC,KAAa,EAAE,OAAe,EAAE,OAAe,EAAE,EAAE,CACjE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE,OAAO,CAA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{ Box, Text } from "ink";
|
|
4
|
-
export default function StatusPanel({ width, quote, metrics, }) {
|
|
5
|
-
const progressWidth = Math.max(width - 2, 18);
|
|
6
|
-
return (React.createElement(Box, { flexDirection: "column", width: width },
|
|
7
|
-
React.createElement(Text, { color: "yellowBright" }, "STATUS BOARD"),
|
|
8
|
-
React.createElement(Text, { color: "gray" }, `"${quote.quote}" - ${quote.author}`),
|
|
9
|
-
metrics.map((metric) => (React.createElement(Box, { key: metric.label, flexDirection: "column", marginTop: 1 },
|
|
10
|
-
React.createElement(Box, { justifyContent: "space-between" },
|
|
11
|
-
React.createElement(Text, { color: "whiteBright" }, metric.label),
|
|
12
|
-
React.createElement(Text, { color: metric.numberColor }, `${metric.value}%`)),
|
|
13
|
-
React.createElement(Box, { width: progressWidth },
|
|
14
|
-
React.createElement(ProgressBar, { value: metric.value })),
|
|
15
|
-
React.createElement(Box, { justifyContent: "space-between" },
|
|
16
|
-
React.createElement(Text, { color: "gray" }, metric.detail),
|
|
17
|
-
React.createElement(Badge, { color: metric.badgeColor }, metric.signal)))))));
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=status-panel.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"status-panel.js","sourceRoot":"","sources":["../../source/components/status-panel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAqBhC,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EACnC,KAAK,EACL,KAAK,EACL,OAAO,GACW;IAClB,MAAM,aAAa,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;IAE9C,OAAO,CACN,oBAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,KAAK,EAAE,KAAK;QACv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