Skip to content

Commit c0d5627

Browse files
committed
Improve upload status loading and correct bolt site and project info.
Add open github repo button in Home
1 parent 6c81722 commit c0d5627

File tree

4 files changed

+43
-20
lines changed

4 files changed

+43
-20
lines changed

src/content/upload-status.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ function initializeUI() {
2727
});
2828
}
2929

30-
// Initialize UI
31-
initializeUI();
32-
3330
// Cleanup on navigation
3431
window.addEventListener('unload', () => {
3532
if (app) {
@@ -42,3 +39,9 @@ window.addEventListener('unload', () => {
4239
chrome.runtime.onConnect.addListener(() => {
4340
initializeUI();
4441
});
42+
43+
// Export initialization function for the loader
44+
export const onExecute = ({ perf }: { perf: { injectTime: number; loadTime: number } }) => {
45+
console.log('🚀 Upload status initializing...', perf);
46+
initializeUI();
47+
};

src/lib/components/NotBoltSite.svelte

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,41 @@
33
import { Button } from "$lib/components/ui/button";
44
55
export let currentUrl: string = '';
6+
export let noProjectLoaded: boolean = false;
67
78
function openBolt() {
89
chrome.tabs.create({ url: 'https://bolt.new' });
910
}
10-
</script>
11+
12+
$: isBoltSite = currentUrl.includes('bolt.new');
13+
</script>
1114

12-
<div class="flex flex-col items-center justify-center p-4 text-center space-y-6">
15+
<div class="flex flex-col items-center justify-center p-4 text-center space-y-6">
1316
<div class="rounded-full bg-slate-800 p-3">
1417
<AlertCircle class="w-6 h-6 text-slate-200" />
1518
</div>
1619

1720
<div class="space-y-2">
18-
<h3 class="text-lg font-semibold text-slate-200">Not a Bolt Website</h3>
21+
<h3 class="text-lg font-semibold text-slate-200">Not a Bolt Project</h3>
1922
<p class="text-sm text-slate-400">
20-
This extension only works with bolt.new websites.
21-
{#if currentUrl}
23+
This extension only works with bolt.new projects.
24+
{#if currentUrl && !noProjectLoaded}
2225
<br/>Current site: <span class="text-slate-500">{currentUrl}</span>
2326
{/if}
2427
</p>
2528
</div>
2629

27-
<Button
28-
variant="outline"
29-
class="border-slate-800 hover:bg-slate-800 text-slate-200"
30-
on:click={openBolt}
31-
>
32-
Go to bolt.new
33-
</Button>
34-
</div>
35-
30+
{#if isBoltSite && noProjectLoaded}
31+
<p class="text-sm text-amber-300 font-semibold">
32+
Load a Bolt project to continue
33+
</p>
34+
{:else if !isBoltSite}
35+
<Button
36+
variant="outline"
37+
class="border-slate-800 hover:bg-slate-800 text-slate-200"
38+
on:click={openBolt}
39+
>
40+
Go to bolt.new
41+
</Button>
42+
{/if}
43+
</div>

src/lib/components/StatusAlert.svelte

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
1010
export let isSettingsValid: boolean;
1111
export let projectId: string | null;
12+
export let gitHubUsername: string;
1213
export let repoName: string;
1314
export let branch: string;
1415
@@ -23,6 +24,11 @@
2324
}
2425
}
2526
27+
function openGitHub(event: MouseEvent | KeyboardEvent) {
28+
event.stopPropagation();
29+
chrome.tabs.create({ url: `https://github.com/${gitHubUsername}/${repoName}` });
30+
}
31+
2632
$: console.log(`📄 StatusAlert: ${projectId}`);
2733
</script>
2834

@@ -64,8 +70,13 @@
6470
<span class="font-mono">{repoName}</span>
6571
<span>Branch:</span>
6672
<span class="font-mono">{branch}</span>
67-
<span class="col-span-2 text-sm text-slate-400 mt-1">Click to edit settings</span>
6873
</div>
74+
<button
75+
class="col-span-2 text-sm mt-2 border border-slate-700 rounded px-2 py-1 text-slate-400 hover:bg-slate-800 hover:text-slate-300 transition-colors"
76+
on:click|stopPropagation={openGitHub}
77+
>
78+
Open GitHub repository
79+
</button>
6980
</AlertDescription>
7081
</Alert>
7182
{/if}

src/popup/App.svelte

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@
121121
</script>
122122

123123
<main class="w-[400px] min-h-[400px] p-4 bg-slate-950 text-slate-50">
124-
{#if isBoltSite}
124+
{#if isBoltSite && parsedProjectId}
125125
<Tabs bind:value={activeTab} class="w-full">
126126
<Header />
127127

@@ -140,6 +140,7 @@
140140
<StatusAlert
141141
{isSettingsValid}
142142
projectId={parsedProjectId}
143+
gitHubUsername={repoOwner}
143144
{repoName}
144145
{branch}
145146
on:switchTab={handleSwitchTab}
@@ -182,7 +183,7 @@
182183
{:else}
183184
<Card class="border-slate-800 bg-slate-900">
184185
<CardContent>
185-
<NotBoltSite {currentUrl} />
186+
<NotBoltSite {currentUrl} noProjectLoaded={!parsedProjectId} />
186187
</CardContent>
187188
<Footer />
188189
</Card>

0 commit comments

Comments
 (0)