Skip to content

Commit b50875f

Browse files
authored
Update InstallBtn.tsx
1 parent 2f1c1e7 commit b50875f

1 file changed

Lines changed: 17 additions & 4 deletions

File tree

source-code/src/components/InstallBtn.tsx

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Show } from "solid-js";
2-
import { Loader2, CheckCircle, Trash2 } from "lucide-solid";
2+
import { Loader2, CheckCircle, Trash2, Lock } from "lucide-solid";
33
import type { Package } from "../data/packages";
44
import { useI18n } from "../hooks/useI18n";
55

@@ -8,6 +8,10 @@ export function InstallBtn(props: {
88
version?: string; onInstall: (p: Package) => void; onUninstall: (p: Package) => void;
99
}) {
1010
const { t } = useI18n();
11+
// Defaults to removable (true) — only false for entries that explicitly
12+
// opt out, currently just the HackerOS Ecosystem's Hydra (see
13+
// data/packages.ts).
14+
const removable = () => props.pkg.uninstallable !== false;
1115
return (
1216
<Show
1317
when={!props.uninstalling}
@@ -25,9 +29,18 @@ export function InstallBtn(props: {
2529
<CheckCircle size={13} /> {t("btn.installed")}
2630
</button>
2731
<Show when={props.version}><span class="installed-version">{props.version}</span></Show>
28-
<button class="btn-uninstall" onClick={() => props.onUninstall(props.pkg)} title={t("btn.uninstall")} aria-label={`${t("btn.uninstall")} ${props.pkg.name}`}>
29-
<Trash2 size={13} />
30-
</button>
32+
<Show
33+
when={removable()}
34+
fallback={
35+
<span class="btn-uninstall btn-uninstall--locked" title={t("btn.cannotUninstall")} aria-label={t("btn.cannotUninstall")}>
36+
<Lock size={13} />
37+
</span>
38+
}
39+
>
40+
<button class="btn-uninstall" onClick={() => props.onUninstall(props.pkg)} title={t("btn.uninstall")} aria-label={`${t("btn.uninstall")} ${props.pkg.name}`}>
41+
<Trash2 size={13} />
42+
</button>
43+
</Show>
3144
</div>
3245
}
3346
>

0 commit comments

Comments
 (0)