From c0d562717089a590ae737860a5b6eada14a4ba1e Mon Sep 17 00:00:00 2001 From: Mamerto Fabian Jr Date: Mon, 25 Nov 2024 17:58:22 +0800 Subject: [PATCH] Improve upload status loading and correct bolt site and project info. Add open github repo button in Home --- src/content/upload-status.ts | 9 ++++--- src/lib/components/NotBoltSite.svelte | 36 ++++++++++++++++----------- src/lib/components/StatusAlert.svelte | 13 +++++++++- src/popup/App.svelte | 5 ++-- 4 files changed, 43 insertions(+), 20 deletions(-) diff --git a/src/content/upload-status.ts b/src/content/upload-status.ts index 369df75..3d8053b 100644 --- a/src/content/upload-status.ts +++ b/src/content/upload-status.ts @@ -27,9 +27,6 @@ function initializeUI() { }); } -// Initialize UI -initializeUI(); - // Cleanup on navigation window.addEventListener('unload', () => { if (app) { @@ -42,3 +39,9 @@ window.addEventListener('unload', () => { chrome.runtime.onConnect.addListener(() => { initializeUI(); }); + +// Export initialization function for the loader +export const onExecute = ({ perf }: { perf: { injectTime: number; loadTime: number } }) => { + console.log('🚀 Upload status initializing...', perf); + initializeUI(); +}; diff --git a/src/lib/components/NotBoltSite.svelte b/src/lib/components/NotBoltSite.svelte index c109193..361d6a4 100644 --- a/src/lib/components/NotBoltSite.svelte +++ b/src/lib/components/NotBoltSite.svelte @@ -3,33 +3,41 @@ import { Button } from "$lib/components/ui/button"; export let currentUrl: string = ''; + export let noProjectLoaded: boolean = false; function openBolt() { chrome.tabs.create({ url: 'https://bolt.new' }); } - + + $: isBoltSite = currentUrl.includes('bolt.new'); + -
+
-

Not a Bolt Website

+

Not a Bolt Project

- This extension only works with bolt.new websites. - {#if currentUrl} + This extension only works with bolt.new projects. + {#if currentUrl && !noProjectLoaded}
Current site: {currentUrl} {/if}

- -
- \ No newline at end of file + {#if isBoltSite && noProjectLoaded} +

+ Load a Bolt project to continue +

+ {:else if !isBoltSite} + + {/if} +
diff --git a/src/lib/components/StatusAlert.svelte b/src/lib/components/StatusAlert.svelte index 4e959c7..f0da6bb 100644 --- a/src/lib/components/StatusAlert.svelte +++ b/src/lib/components/StatusAlert.svelte @@ -9,6 +9,7 @@ export let isSettingsValid: boolean; export let projectId: string | null; + export let gitHubUsername: string; export let repoName: string; export let branch: string; @@ -23,6 +24,11 @@ } } + function openGitHub(event: MouseEvent | KeyboardEvent) { + event.stopPropagation(); + chrome.tabs.create({ url: `https://github.com/${gitHubUsername}/${repoName}` }); + } + $: console.log(`📄 StatusAlert: ${projectId}`); @@ -64,8 +70,13 @@ {repoName} Branch: {branch} - Click to edit settings + {/if} diff --git a/src/popup/App.svelte b/src/popup/App.svelte index ba26e1e..9060e65 100644 --- a/src/popup/App.svelte +++ b/src/popup/App.svelte @@ -121,7 +121,7 @@
- {#if isBoltSite} + {#if isBoltSite && parsedProjectId}
@@ -140,6 +140,7 @@ - +