Skip to content

Commit 3b3a826

Browse files
committed
Extract openURL helper and trim about strip to version only
1 parent bfd0298 commit 3b3a826

4 files changed

Lines changed: 14 additions & 28 deletions

File tree

frontend/src/lib/components/layout/AboutStrip.svelte

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,12 @@
11
<script lang="ts">
2-
async function openURL(url: string) {
3-
try {
4-
const {BrowserOpenURL} = await import(
5-
'../../../../wailsjs/runtime/runtime'
6-
);
7-
BrowserOpenURL(url);
8-
} catch {}
9-
}
2+
import {openURL} from '$lib/utils/browser';
103
</script>
114

125
<div
136
class="bg-bg-secondary border-border text-fg-dimmed flex h-6 shrink-0 items-center justify-between border-t px-3 text-[10px]"
147
>
158
<div class="flex items-center gap-2">
16-
<span class="text-fg-secondary font-semibold tracking-wide">Aether</span
17-
>
18-
<span class="bg-border h-3 w-px"></span>
199
<span>v{__APP_VERSION__}</span>
20-
<span class="bg-border h-3 w-px"></span>
21-
<span>by Bjarne Øverli</span>
2210
</div>
2311
<div class="flex items-center gap-3">
2412
<button

frontend/src/lib/components/layout/HeaderBar.svelte

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
toggleSidebar,
88
type Tab,
99
} from '$lib/stores/ui.svelte';
10+
import {openURL} from '$lib/utils/browser';
1011
1112
let sidebarVisible = $derived(getSidebarVisible());
1213
let isMac = $state(false);
@@ -18,13 +19,6 @@
1819
} catch {}
1920
});
2021
21-
async function openGitHub() {
22-
const {BrowserOpenURL} = await import(
23-
'../../../../wailsjs/runtime/runtime'
24-
);
25-
BrowserOpenURL('https://github.com/bjarneo/aether');
26-
}
27-
2822
const tabs: {id: Tab; label: string; icon: string}[] = [
2923
{
3024
id: 'editor',
@@ -80,7 +74,7 @@
8074
class:pb-1.5={isMac}
8175
class:ml-2={isMac}
8276
style="letter-spacing: 0.08em; --wails-draggable:no-drag"
83-
onclick={openGitHub}
77+
onclick={() => openURL('https://github.com/bjarneo/aether')}
8478
title="Open GitHub repository">AETHER</button
8579
>
8680
<button

frontend/src/lib/components/wallhaven/WallpaperCard.svelte

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
getAdditionalImages,
66
} from '$lib/stores/theme.svelte';
77
import {setActiveTab, showToast} from '$lib/stores/ui.svelte';
8+
import {openURL} from '$lib/utils/browser';
89
910
let {wallpaper, onpreview}: {wallpaper: any; onpreview: () => void} =
1011
$props();
@@ -80,13 +81,8 @@
8081
}
8182
}
8283
83-
async function handleVisit() {
84-
try {
85-
const {BrowserOpenURL} = await import(
86-
'../../../../wailsjs/runtime/runtime'
87-
);
88-
BrowserOpenURL(`https://wallhaven.cc/w/${wallpaper.id}`);
89-
} catch {}
84+
function handleVisit() {
85+
openURL(`https://wallhaven.cc/w/${wallpaper.id}`);
9086
}
9187
9288
function formatSize(bytes: number): string {

frontend/src/lib/utils/browser.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export async function openURL(url: string): Promise<void> {
2+
try {
3+
const {BrowserOpenURL} = await import(
4+
'../../../wailsjs/runtime/runtime'
5+
);
6+
BrowserOpenURL(url);
7+
} catch {}
8+
}

0 commit comments

Comments
 (0)