Changes
This commit is contained in:
@@ -3,11 +3,12 @@ import {ArrowLeftSolid} from "flowbite-svelte-icons";
|
||||
import {Button, Card, Input, Label, Navbar, NavBrand, NavHamburger, NavUl, Spinner} from "flowbite-svelte";
|
||||
import {pageRepo} from "../repo/repo.js";
|
||||
import {mapToMap, nameRegex} from "../util.ts";
|
||||
import Editor from "./edit/Editor.svelte";
|
||||
import TypeAheadSearch from "../components/TypeAheadSearch.svelte";
|
||||
import {branches} from "../stores/stores.ts";
|
||||
import Editor from "./edit/Editor.svelte";
|
||||
|
||||
$: pagesFuture = $pageRepo.listPages(selectedBranch);
|
||||
|
||||
let pagesFuture = $pageRepo.listPages();
|
||||
let selected: number | null = null;
|
||||
|
||||
let selectedBranch: string = "master";
|
||||
@@ -54,6 +55,16 @@ async function deleteBranch() {
|
||||
}
|
||||
}
|
||||
|
||||
async function createFile() {
|
||||
let name = prompt("File name:", "pages/en/[Name]")
|
||||
if (name) {
|
||||
await $pageRepo.createFile(`${name}.md`, selectedBranch)
|
||||
const w = selectedBranch
|
||||
selectedBranch = "###!"
|
||||
selectedBranch = w
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
<div class="flex flex-col h-screen overflow-scroll">
|
||||
<Navbar let:hidden let:toggle>
|
||||
@@ -73,8 +84,9 @@ async function deleteBranch() {
|
||||
<div class="border-b border-b-gray-600 pb-2 flex justify-between">
|
||||
<TypeAheadSearch items={availableBranches} bind:selected={selectedBranch} bind:searchValue />
|
||||
<div>
|
||||
<Button on:click={deleteBranch} color="ghost">Delete Branch</Button>
|
||||
<Button on:click={createBranch}>Create Branch</Button>
|
||||
<Button on:click={createFile} color="alternative">Create File</Button>
|
||||
<Button on:click={deleteBranch} color="ghost">Delete Branch</Button>
|
||||
</div>
|
||||
</div>
|
||||
{@const pagesMap = mapToMap(pages)}
|
||||
|
||||
Reference in New Issue
Block a user