Initial RuneStone project
This commit is contained in:
@@ -0,0 +1,90 @@
|
||||
<script lang="ts">
|
||||
import { loadMarks } from "$lib/workspace/marks";
|
||||
import type { TreeEntry } from "$lib/workspace/types";
|
||||
|
||||
type Props = {
|
||||
refreshToken: number;
|
||||
onOpen: (entry: TreeEntry) => void;
|
||||
};
|
||||
|
||||
let { refreshToken, onOpen }: Props = $props();
|
||||
let bookmarks = $state<string[]>([]);
|
||||
|
||||
$effect(() => {
|
||||
void refreshToken;
|
||||
void loadMarks().then((marks) => {
|
||||
bookmarks = marks.bookmarks;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="pane">
|
||||
<div class="pane-label">Bookmarks</div>
|
||||
{#if bookmarks.length === 0}
|
||||
<p class="placeholder">Right-click a file and choose Bookmark.</p>
|
||||
{:else}
|
||||
<ul>
|
||||
{#each bookmarks as rel (rel)}
|
||||
<li>
|
||||
<button
|
||||
type="button"
|
||||
onclick={() =>
|
||||
onOpen({
|
||||
name: rel.split("/").pop() ?? rel,
|
||||
rel_path: rel,
|
||||
kind: "file",
|
||||
})}
|
||||
>
|
||||
{rel}
|
||||
</button>
|
||||
</li>
|
||||
{/each}
|
||||
</ul>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.pane {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.pane-label {
|
||||
padding: 6px 10px;
|
||||
font-size: 11px;
|
||||
letter-spacing: 0.06em;
|
||||
text-transform: uppercase;
|
||||
color: var(--rs-text-dim);
|
||||
border-bottom: 1px solid var(--rs-border);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.placeholder {
|
||||
margin: 12px;
|
||||
color: var(--rs-text-dim);
|
||||
}
|
||||
|
||||
ul {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 6px 0;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
button {
|
||||
width: 100%;
|
||||
border-radius: var(--rs-control-radius);
|
||||
border: 0;
|
||||
background: transparent;
|
||||
color: var(--rs-text);
|
||||
text-align: left;
|
||||
padding: 6px 10px;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
background: var(--rs-bg-active);
|
||||
color: var(--rs-text-strong);
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user