Files
RuneStone/src/lib/browser/Bookmarks.svelte
T
Knotty Wyvern c06d48f250 Show the engine setup until the browser engine is installed
A browser tab shows the download size, Download the engine, Install from
file, and Open in default browser until the engine can start. It shows
progress, Cancel, the cause of a failure, and Retry, and then opens the
page. Settings -> Browser shows the engine state and Remove engine. Web
links open in the system browser until the engine is installed. Open
link in app browser always opens a browser tab.
2026-10-29 01:18:21 -07:00

31 lines
1.9 KiB
Svelte

<script lang="ts">
import { t } from "$lib/i18n";
import Icon from '$lib/ui/Icon.svelte';
import IconButton from '$lib/ui/IconButton.svelte';
import { state as browserState, request } from './client';
import { engine, engineReady } from './engine';
let { open }: { open: (profileId: string, url: string) => Promise<void> } = $props();
let error = $state('');
// The bookmarks live in the engine. A missing engine is not started here.
const installed = $derived(engineReady($engine));
let loaded = false;
$effect(() => {
if (!installed) { loaded = false; return; }
if (loaded) return;
loaded = true;
void request('state').catch(reason => error = String(reason));
});
</script>
<div class="bookmarks">
{#if !installed}<p class="note">{$t("Install the browser engine to see the browser bookmarks.")}</p>{/if}
{#if error}<p class="error" role="alert">{error}</p>{/if}
{#each installed ? $browserState?.bookmarks || [] : [] as item (item.id)}
<div class="row"><button class="link" title={item.url} onclick={() => void open(item.profileId, item.url)}><Icon icon="globe" /><span>{item.title}</span></button><IconButton icon="close" label={`Remove ${item.title}`} onclick={() => void request('removeBookmark', { id: item.id })} /></div>
{/each}
</div>
<style>
.bookmarks{color:var(--rs-text);font-family:var(--rs-font-ui)}.row{display:flex;align-items:center;padding:0 5px;border-radius:var(--rs-control-radius)}.row:hover{background:var(--rs-bg-active)}
.link{display:flex;align-items:center;gap:8px;flex:1;min-width:0;padding:7px 5px;border:0;border-radius:var(--rs-control-radius);color:inherit;background:transparent;text-align:left;cursor:pointer}
span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.link:focus-visible{outline:2px solid var(--rs-focus)}p{padding:8px;font-size:12px}.error{color:var(--rs-error)}.note{margin:0;color:var(--rs-text-dim)}
</style>