recappi 0.1.47 → 0.1.48
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/index.js +44 -17
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -791,18 +791,24 @@ var init_RecordingHeroScreen = __esm({
|
|
|
791
791
|
// src/tui/AccountView.tsx
|
|
792
792
|
import { Box as Box3, Text as Text3 } from "ink";
|
|
793
793
|
import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
794
|
-
function AccountView({
|
|
794
|
+
function AccountView({
|
|
795
|
+
status,
|
|
796
|
+
nowMs = Date.now()
|
|
797
|
+
}) {
|
|
795
798
|
return /* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", paddingX: 1, children: [
|
|
796
799
|
/* @__PURE__ */ jsx5(Text3, { dimColor: true, children: "\u2039 Account" }),
|
|
797
800
|
status === "loading" || status === void 0 ? /* @__PURE__ */ jsx5(Box3, { marginTop: 1, children: /* @__PURE__ */ jsx5(Text3, { dimColor: true, children: "Loading account\u2026" }) }) : status === "error" ? /* @__PURE__ */ jsx5(Box3, { marginTop: 1, children: /* @__PURE__ */ jsx5(Text3, { color: "red", children: "Couldn't load account status" }) }) : !status.loggedIn ? /* @__PURE__ */ jsxs3(Box3, { marginTop: 1, flexDirection: "column", children: [
|
|
798
801
|
/* @__PURE__ */ jsx5(Text3, { color: "yellow", children: "Not signed in" }),
|
|
799
802
|
/* @__PURE__ */ jsx5(Text3, { dimColor: true, children: `origin ${status.origin}` }),
|
|
800
803
|
/* @__PURE__ */ jsx5(Text3, { dimColor: true, children: "Run `recappi auth login` to sign in." })
|
|
801
|
-
] }) : /* @__PURE__ */ jsx5(AccountBody, { status }),
|
|
804
|
+
] }) : /* @__PURE__ */ jsx5(AccountBody, { status, nowMs }),
|
|
802
805
|
/* @__PURE__ */ jsx5(Box3, { marginTop: 1, children: /* @__PURE__ */ jsx5(Text3, { dimColor: true, children: "r refresh \xB7 esc back \xB7 q quit" }) })
|
|
803
806
|
] });
|
|
804
807
|
}
|
|
805
|
-
function AccountBody({
|
|
808
|
+
function AccountBody({
|
|
809
|
+
status,
|
|
810
|
+
nowMs
|
|
811
|
+
}) {
|
|
806
812
|
return /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
807
813
|
/* @__PURE__ */ jsxs3(Box3, { marginTop: 1, flexDirection: "column", children: [
|
|
808
814
|
/* @__PURE__ */ jsxs3(Text3, { children: [
|
|
@@ -812,7 +818,7 @@ function AccountBody({ status }) {
|
|
|
812
818
|
status.email && status.userId ? /* @__PURE__ */ jsx5(Text3, { dimColor: true, children: status.userId }) : null,
|
|
813
819
|
/* @__PURE__ */ jsx5(Text3, { dimColor: true, children: `origin ${status.origin}` })
|
|
814
820
|
] }),
|
|
815
|
-
status.billing ? /* @__PURE__ */ jsx5(Usage, { billing: status.billing }) : null,
|
|
821
|
+
status.billing ? /* @__PURE__ */ jsx5(Usage, { billing: status.billing, nowMs }) : null,
|
|
816
822
|
/* @__PURE__ */ jsxs3(Box3, { marginTop: 1, flexDirection: "column", children: [
|
|
817
823
|
/* @__PURE__ */ jsx5(Text3, { bold: true, dimColor: true, children: "LOCAL STORE" }),
|
|
818
824
|
/* @__PURE__ */ jsx5(Text3, { dimColor: true, wrap: "truncate-middle", children: status.localStore.path }),
|
|
@@ -823,7 +829,10 @@ function AccountBody({ status }) {
|
|
|
823
829
|
] })
|
|
824
830
|
] });
|
|
825
831
|
}
|
|
826
|
-
function Usage({
|
|
832
|
+
function Usage({
|
|
833
|
+
billing,
|
|
834
|
+
nowMs
|
|
835
|
+
}) {
|
|
827
836
|
const minutesCap = billing.minutesCap;
|
|
828
837
|
const minutesUsed = billing.minutesUsed;
|
|
829
838
|
const storageCap = billing.storageCapBytes;
|
|
@@ -850,11 +859,11 @@ function Usage({ billing }) {
|
|
|
850
859
|
billing.isOverMinutes ? "Over minutes limit. " : "",
|
|
851
860
|
billing.isOverStorage ? "Over storage limit." : ""
|
|
852
861
|
] }) : null,
|
|
853
|
-
/* @__PURE__ */ jsx5(Text3, { dimColor: true, children: `Period ${periodText(billing)}` })
|
|
862
|
+
/* @__PURE__ */ jsx5(Text3, { dimColor: true, children: `Period ${periodText(billing, nowMs)}` })
|
|
854
863
|
] });
|
|
855
864
|
}
|
|
856
|
-
function periodText(billing) {
|
|
857
|
-
const remainingMs = epochToMs(billing.periodEnd) -
|
|
865
|
+
function periodText(billing, nowMs) {
|
|
866
|
+
const remainingMs = epochToMs(billing.periodEnd) - nowMs;
|
|
858
867
|
if (!Number.isFinite(remainingMs) || remainingMs <= 0) return "\u2014";
|
|
859
868
|
const days = Math.floor(remainingMs / 864e5);
|
|
860
869
|
if (days >= 1) return `${days}d left`;
|
|
@@ -2118,7 +2127,9 @@ function AppShell({
|
|
|
2118
2127
|
};
|
|
2119
2128
|
});
|
|
2120
2129
|
}).catch((error51) => {
|
|
2121
|
-
setLiveRecord(
|
|
2130
|
+
setLiveRecord(
|
|
2131
|
+
(current) => current?.kind === "starting" ? recordErrorState(error51, selection) : current
|
|
2132
|
+
);
|
|
2122
2133
|
});
|
|
2123
2134
|
},
|
|
2124
2135
|
[now, recordSetupModel.sources, startLiveRecord]
|
|
@@ -2138,7 +2149,7 @@ function AppShell({
|
|
|
2138
2149
|
const data = await current.session.stop();
|
|
2139
2150
|
const artifact = recordingArtifactFromRecordData(data);
|
|
2140
2151
|
const fallbackDuration = current.telemetry.startedAtMs != null ? Math.max(0, now() - current.telemetry.startedAtMs) : void 0;
|
|
2141
|
-
|
|
2152
|
+
const stoppedRecord = {
|
|
2142
2153
|
kind: "stopped",
|
|
2143
2154
|
selection: current.selection,
|
|
2144
2155
|
artifact,
|
|
@@ -2148,17 +2159,25 @@ function AppShell({
|
|
|
2148
2159
|
...artifact.durationMs == null && fallbackDuration != null ? { durationMs: fallbackDuration } : {},
|
|
2149
2160
|
status: "stopped"
|
|
2150
2161
|
}
|
|
2162
|
+
};
|
|
2163
|
+
setLiveRecord((next) => {
|
|
2164
|
+
if (next?.kind !== "stopping" || next.session !== current.session) return next;
|
|
2165
|
+
return stoppedRecord;
|
|
2151
2166
|
});
|
|
2152
2167
|
void refreshDownloadedIds();
|
|
2153
2168
|
} catch (error51) {
|
|
2154
|
-
setLiveRecord({
|
|
2155
|
-
kind
|
|
2156
|
-
|
|
2169
|
+
setLiveRecord((next) => {
|
|
2170
|
+
if (next?.kind !== "stopping" || next.session !== current.session) return next;
|
|
2171
|
+
return {
|
|
2172
|
+
kind: "error",
|
|
2173
|
+
message: error51 instanceof Error ? error51.message : String(error51)
|
|
2174
|
+
};
|
|
2157
2175
|
});
|
|
2158
2176
|
}
|
|
2159
2177
|
return;
|
|
2160
2178
|
}
|
|
2161
|
-
if (current?.kind === "stopped" || current?.kind === "error")
|
|
2179
|
+
if (current?.kind === "starting" || current?.kind === "stopping" || current?.kind === "stopped" || current?.kind === "error")
|
|
2180
|
+
setLiveRecord(void 0);
|
|
2162
2181
|
setStack([{ kind: "overview" }]);
|
|
2163
2182
|
}, [liveRecord, now, refreshDownloadedIds]);
|
|
2164
2183
|
const liveSession = liveRecord?.kind === "live" ? liveRecord.session : void 0;
|
|
@@ -2473,7 +2492,11 @@ function AppShell({
|
|
|
2473
2492
|
void transcribeStoppedRecording();
|
|
2474
2493
|
return;
|
|
2475
2494
|
}
|
|
2476
|
-
if (
|
|
2495
|
+
if (liveRecord?.kind === "stopped" && input === "n") {
|
|
2496
|
+
void stopLiveRecord();
|
|
2497
|
+
return;
|
|
2498
|
+
}
|
|
2499
|
+
if (input === "q" || key.escape || key.leftArrow) void stopLiveRecord();
|
|
2477
2500
|
return;
|
|
2478
2501
|
}
|
|
2479
2502
|
if (input === "q") return exit();
|
|
@@ -2497,6 +2520,8 @@ function AppShell({
|
|
|
2497
2520
|
}
|
|
2498
2521
|
if (input === "r") return void refresh({ resetRecordings: true });
|
|
2499
2522
|
if (screen.kind === "overview") {
|
|
2523
|
+
if (input === "g") setSelected(0);
|
|
2524
|
+
if (input === "G") setSelected(Math.max(0, recordings.length - 1));
|
|
2500
2525
|
if (key.upArrow || input === "k") setSelected((i) => Math.max(0, i - 1));
|
|
2501
2526
|
if (key.downArrow || input === "j") setSelected((i) => Math.min(recordings.length - 1, i + 1));
|
|
2502
2527
|
const rec = recordings[selected];
|
|
@@ -2506,6 +2531,8 @@ function AppShell({
|
|
|
2506
2531
|
return;
|
|
2507
2532
|
}
|
|
2508
2533
|
if (screen.kind === "jobs") {
|
|
2534
|
+
if (input === "g") setSelected(0);
|
|
2535
|
+
if (input === "G") setSelected(Math.max(0, jobs.length - 1));
|
|
2509
2536
|
if (key.upArrow || input === "k") setSelected((i) => Math.max(0, i - 1));
|
|
2510
2537
|
if (key.downArrow || input === "j") setSelected((i) => Math.min(jobs.length - 1, i + 1));
|
|
2511
2538
|
const job = jobs[selected];
|
|
@@ -2639,7 +2666,7 @@ function AppShell({
|
|
|
2639
2666
|
);
|
|
2640
2667
|
} else if (screen.kind === "account") {
|
|
2641
2668
|
position = "";
|
|
2642
|
-
body = /* @__PURE__ */ jsx18(AccountView, { status: accountStatus });
|
|
2669
|
+
body = /* @__PURE__ */ jsx18(AccountView, { status: accountStatus, nowMs: now() });
|
|
2643
2670
|
} else {
|
|
2644
2671
|
const win = listWindow(selected, jobs.length, Math.max(3, size.rows - 4));
|
|
2645
2672
|
position = jobs.length ? `${selected + 1} / ${jobs.length}` : "0";
|
|
@@ -2652,7 +2679,7 @@ function AppShell({
|
|
|
2652
2679
|
}
|
|
2653
2680
|
);
|
|
2654
2681
|
}
|
|
2655
|
-
const footerKeys = screen.kind === "jobs" ? `${position} \xB7 \u2191\u2193 select \xB7 \u23CE job \xB7 t transcript \xB7 n record \xB7 1 overview \xB7 3 account \xB7 r refresh \xB7 q quit` : screen.kind === "account" ? "
|
|
2682
|
+
const footerKeys = screen.kind === "jobs" ? `${position} \xB7 \u2191\u2193 select \xB7 \u23CE job \xB7 t transcript \xB7 n record \xB7 1 overview \xB7 3 account \xB7 r refresh \xB7 q quit` : screen.kind === "account" ? "Account \xB7 n record \xB7 1 overview \xB7 2 jobs \xB7 r refresh \xB7 q quit" : `${position} \xB7 \u2191\u2193 scroll \xB7 \u23CE open \xB7 t transcript \xB7 n record \xB7 2 jobs \xB7 3 account \xB7 r refresh \xB7 q quit`;
|
|
2656
2683
|
return /* @__PURE__ */ jsxs15(Box16, { flexDirection: "column", height: size.rows, paddingX: 1, children: [
|
|
2657
2684
|
/* @__PURE__ */ jsx18(Header, { active: tab }),
|
|
2658
2685
|
/* @__PURE__ */ jsxs15(Box16, { flexGrow: 1, flexDirection: "column", children: [
|