-
Notifications
You must be signed in to change notification settings - Fork 50
Expand file tree
/
Copy pathupgrade-indicator.tsx
More file actions
28 lines (24 loc) · 915 Bytes
/
upgrade-indicator.tsx
File metadata and controls
28 lines (24 loc) · 915 Bytes
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
import { createMemo, Show } from "solid-js"
import { useTheme } from "@tui/context/theme"
import { useKV } from "../context/kv"
import { Installation } from "@/installation"
import { UPGRADE_KV_KEY, getAvailableVersion } from "./upgrade-indicator-utils"
export { UPGRADE_KV_KEY } from "./upgrade-indicator-utils"
export function UpgradeIndicator() {
const { theme } = useTheme()
const kv = useKV()
const latestVersion = createMemo(() => getAvailableVersion(kv.get(UPGRADE_KV_KEY)))
return (
<Show when={latestVersion()}>
{(version) => (
<box flexDirection="row" gap={1} flexShrink={0}>
<text fg={theme.textMuted}>
{Installation.VERSION} → <span style={{ fg: theme.accent }}>{version()}</span>
</text>
<text fg={theme.textMuted}>·</text>
<text fg={theme.textMuted}>altimate upgrade</text>
</box>
)}
</Show>
)
}