Skip to content

Commit fc2b0a7

Browse files
committed
feat: show dual install commands for configs with openboot package
- Detect if config includes 'openboot' package - If yes, show recommended CLI command (openboot install user/slug) - Also show fallback curl command for first-time installation - Highlight recommended command with green accent - Add command labels to distinguish usage scenarios - Updated all seed configs to include openboot package
1 parent c9f9f8f commit fc2b0a7

File tree

1 file changed

+84
-8
lines changed

1 file changed

+84
-8
lines changed

src/routes/[username]/[slug]/+page.svelte

Lines changed: 84 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
77
let activeTab = $state('overview');
88
let copied = $state(false);
9+
let copiedCli = $state(false);
910
let showShareModal = $state(false);
1011
let shareCopied = $state(false);
1112
let forking = $state(false);
@@ -15,12 +16,22 @@
1516
return `curl -fsSL https://openboot.dev/${data.configUser.username}/${data.config.slug} | bash`;
1617
}
1718
19+
function getCliInstallCommand() {
20+
return `openboot install ${data.configUser.username}/${data.config.slug}`;
21+
}
22+
1823
function copyCommand() {
1924
navigator.clipboard.writeText(getInstallCommand());
2025
copied = true;
2126
setTimeout(() => (copied = false), 2000);
2227
}
2328
29+
function copyCliCommand() {
30+
navigator.clipboard.writeText(getCliInstallCommand());
31+
copiedCli = true;
32+
setTimeout(() => (copiedCli = false), 2000);
33+
}
34+
2435
function getShareUrl() {
2536
return `https://openboot.dev/${data.configUser.username}/${data.config.slug}`;
2637
}
@@ -108,6 +119,8 @@
108119
? data.config.packages.map((p: any) => (typeof p === 'string' ? { name: p, type: 'formula' } : p))
109120
: []);
110121
122+
const hasOpenBootPackage = $derived(configPkgs.some((p: any) => p.name === 'openboot'));
123+
111124
const configCli = $derived(configPkgs.filter((p: any) => p.type !== 'cask' && p.type !== 'npm'));
112125
const configApps = $derived(configPkgs.filter((p: any) => p.type === 'cask'));
113126
const configNpm = $derived(configPkgs.filter((p: any) => p.type === 'npm'));
@@ -163,12 +176,38 @@
163176

164177
<div class="install-box">
165178
<div class="install-label">Install with one command</div>
166-
<div class="install-command">
167-
<code>{getInstallCommand()}</code>
168-
<button class="copy-btn" onclick={copyCommand}>
169-
{copied ? 'Copied!' : 'Copy'}
170-
</button>
171-
</div>
179+
{#if hasOpenBootPackage}
180+
<div class="install-command recommended">
181+
<div class="command-label">
182+
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/><polyline points="22 4 12 14.01 9 11.01"/></svg>
183+
Recommended (with OpenBoot installed)
184+
</div>
185+
<div class="command-row">
186+
<code>{getCliInstallCommand()}</code>
187+
<button class="copy-btn" onclick={copyCliCommand}>
188+
{copiedCli ? 'Copied!' : 'Copy'}
189+
</button>
190+
</div>
191+
</div>
192+
<div class="install-command">
193+
<div class="command-label">First time installation</div>
194+
<div class="command-row">
195+
<code>{getInstallCommand()}</code>
196+
<button class="copy-btn" onclick={copyCommand}>
197+
{copied ? 'Copied!' : 'Copy'}
198+
</button>
199+
</div>
200+
</div>
201+
{:else}
202+
<div class="install-command single">
203+
<div class="command-row">
204+
<code>{getInstallCommand()}</code>
205+
<button class="copy-btn" onclick={copyCommand}>
206+
{copied ? 'Copied!' : 'Copy'}
207+
</button>
208+
</div>
209+
</div>
210+
{/if}
172211
<button class="fork-btn" onclick={forkConfig} disabled={forking}>
173212
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="18" r="3"/><circle cx="6" cy="6" r="3"/><circle cx="18" cy="6" r="3"/><path d="M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9"/><path d="M12 12v3"/></svg>
174213
{forking ? 'Forking...' : 'Fork Config'}
@@ -591,12 +630,49 @@
591630
592631
.install-command {
593632
display: flex;
594-
align-items: center;
595-
gap: 12px;
633+
flex-direction: column;
634+
gap: 8px;
596635
background: var(--bg-tertiary);
597636
border: 1px solid var(--border);
598637
border-radius: 8px;
599638
padding: 12px 16px;
639+
margin-bottom: 12px;
640+
}
641+
642+
.install-command.single {
643+
flex-direction: row;
644+
align-items: center;
645+
gap: 12px;
646+
}
647+
648+
.install-command:last-of-type {
649+
margin-bottom: 16px;
650+
}
651+
652+
.install-command.recommended {
653+
background: color-mix(in srgb, var(--accent) 5%, var(--bg-tertiary));
654+
border-color: color-mix(in srgb, var(--accent) 30%, var(--border));
655+
}
656+
657+
.command-label {
658+
display: flex;
659+
align-items: center;
660+
gap: 6px;
661+
font-size: 0.75rem;
662+
color: var(--text-muted);
663+
font-weight: 500;
664+
text-transform: uppercase;
665+
letter-spacing: 0.05em;
666+
}
667+
668+
.command-label svg {
669+
color: var(--accent);
670+
}
671+
672+
.command-row {
673+
display: flex;
674+
align-items: center;
675+
gap: 12px;
600676
}
601677
602678
.install-command code {

0 commit comments

Comments
 (0)