File tree Expand file tree Collapse file tree 4 files changed +43
-20
lines changed Expand file tree Collapse file tree 4 files changed +43
-20
lines changed Original file line number Diff line number Diff line change @@ -27,9 +27,6 @@ function initializeUI() {
27
27
} ) ;
28
28
}
29
29
30
- // Initialize UI
31
- initializeUI ( ) ;
32
-
33
30
// Cleanup on navigation
34
31
window . addEventListener ( 'unload' , ( ) => {
35
32
if ( app ) {
@@ -42,3 +39,9 @@ window.addEventListener('unload', () => {
42
39
chrome . runtime . onConnect . addListener ( ( ) => {
43
40
initializeUI ( ) ;
44
41
} ) ;
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
+ } ;
Original file line number Diff line number Diff line change 3
3
import { Button } from " $lib/components/ui/button" ;
4
4
5
5
export let currentUrl: string = ' ' ;
6
+ export let noProjectLoaded: boolean = false ;
6
7
7
8
function openBolt() {
8
9
chrome .tabs .create ({ url: ' https://bolt.new' });
9
10
}
10
- </script >
11
+
12
+ $ : isBoltSite = currentUrl .includes (' bolt.new' );
13
+ </script >
11
14
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" >
13
16
<div class =" rounded-full bg-slate-800 p-3" >
14
17
<AlertCircle class =" w-6 h-6 text-slate-200" />
15
18
</div >
16
19
17
20
<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 >
19
22
<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 }
22
25
<br />Current site: <span class ="text-slate-500" >{currentUrl }</span >
23
26
{/if }
24
27
</p >
25
28
</div >
26
29
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 >
Original file line number Diff line number Diff line change 9
9
10
10
export let isSettingsValid: boolean ;
11
11
export let projectId: string | null ;
12
+ export let gitHubUsername: string ;
12
13
export let repoName: string ;
13
14
export let branch: string ;
14
15
23
24
}
24
25
}
25
26
27
+ function openGitHub(event : MouseEvent | KeyboardEvent ) {
28
+ event .stopPropagation ();
29
+ chrome .tabs .create ({ url: ` https://github.com/${gitHubUsername }/${repoName } ` });
30
+ }
31
+
26
32
$ : console .log (` 📄 StatusAlert: ${projectId } ` );
27
33
</script >
28
34
64
70
<span class ="font-mono" >{repoName }</span >
65
71
<span >Branch:</span >
66
72
<span class ="font-mono" >{branch }</span >
67
- <span class =" col-span-2 text-sm text-slate-400 mt-1" >Click to edit settings</span >
68
73
</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 >
69
80
</AlertDescription >
70
81
</Alert >
71
82
{/if }
Original file line number Diff line number Diff line change 121
121
</script >
122
122
123
123
<main class =" w-[400px] min-h-[400px] p-4 bg-slate-950 text-slate-50" >
124
- {#if isBoltSite }
124
+ {#if isBoltSite && parsedProjectId }
125
125
<Tabs bind:value ={activeTab } class =" w-full" >
126
126
<Header />
127
127
140
140
<StatusAlert
141
141
{isSettingsValid }
142
142
projectId ={parsedProjectId }
143
+ gitHubUsername ={repoOwner }
143
144
{repoName }
144
145
{branch }
145
146
on:switchTab ={handleSwitchTab }
182
183
{:else }
183
184
<Card class =" border-slate-800 bg-slate-900" >
184
185
<CardContent >
185
- <NotBoltSite {currentUrl } />
186
+ <NotBoltSite {currentUrl } noProjectLoaded ={ ! parsedProjectId } />
186
187
</CardContent >
187
188
<Footer />
188
189
</Card >
You can’t perform that action at this time.
0 commit comments