forked from marszall87/lambda-pure
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.tsx
72 lines (63 loc) · 1.71 KB
/
app.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import { Newline } from "ink";
import { useMemo } from "react";
import { useExit } from "./components/process";
import { useUpdateNotification } from "./helpers/package";
import { useAppWatch } from "./helpers/state";
import { SelectIntegration } from "./services/integrations";
import { ZshIntegration } from "./services/integrations/lambda-prompt";
import { useZshConfigurationForPrompt } from "./services/integrations/lambda-prompt/setup-zsh/configure-zsh";
import { OhMyZshIntegration } from "./services/integrations/oh-my-zsh";
import { useZshConfigurationForOmz } from "./services/integrations/oh-my-zsh/configure-zsh";
export const App = () => {
const { hasNotifiedUpdate, UpdateMessage } = useUpdateNotification();
const { isSuccess: isZshIntegrationSucceeded } = useZshConfigurationForPrompt(
{
enabled: false,
},
);
const integration = useAppWatch({
name: "integration",
});
const Integrator = useMemo(() => {
switch (integration?.value) {
case "oh-my-zsh":
return OhMyZshIntegration;
default:
return null;
}
}, [integration]);
const { error: omzIntegrationError, status: omzIntegrationStatus } =
useZshConfigurationForOmz({
enabled: false,
});
const error = omzIntegrationError;
const isDone = omzIntegrationStatus !== "pending" && integration?.value;
useExit({
error,
isDone,
});
return (
<>
{UpdateMessage && <UpdateMessage />}
{hasNotifiedUpdate && (
<>
<Newline />
<ZshIntegration />
{isZshIntegrationSucceeded && (
<>
<Newline />
<SelectIntegration />
{Integrator && (
<>
<Newline />
<Integrator />
</>
)}
</>
)}
</>
)}
{isDone && <Newline />}
</>
);
};