Welcome screen with recent repositories and a folder picker when gites starts outside a repository

This commit is contained in:
2026-10-15 13:55:08 +02:00
parent 394d92e756
commit 2b433fb650
4 changed files with 126 additions and 16 deletions
+15 -1
View File
@@ -19,6 +19,7 @@ import LabelStack from "./components/LabelStack.vue";
import PreviewPanel from "./components/PreviewPanel.vue";
import RepoMenu from "./components/RepoMenu.vue";
import Sidebar from "./components/Sidebar.vue";
import Welcome from "./components/Welcome.vue";
const ROW_H = 28;
const MESSAGE_FONT = '13px "Inter", "Noto Sans", system-ui, sans-serif';
@@ -106,17 +107,22 @@ function startDrag(e: PointerEvent, axis: "x" | "y") {
let filtersLoadedFor: string | null = null;
let loading = false;
/** False until the first load answers, so the welcome screen does not flash up at start. */
const started = ref(false);
async function load() {
// The window gets focus often; one reload at a time is enough.
if (loading) return;
loading = true;
try {
await applyRepo(await invoke<RepoData>("load_repo"));
// null: gites was started outside a repository and none is open yet.
const data = await invoke<RepoData | null>("load_repo");
if (data) await applyRepo(data);
} catch (e) {
error.value = String(e);
} finally {
loading = false;
started.value = true;
}
}
@@ -536,6 +542,14 @@ onUnmounted(() => {
<button @click="menuOpen = true">Open a repository…</button>
</div>
<Welcome
v-else-if="!repo && started"
:recents="settings.recents"
@pick="openRepo"
@browse="browse"
@remove="(p) => (settings.recents = settings.recents.filter((x) => x !== p))"
/>
<div v-else class="center">
<DiffView