Updates and more
This commit is contained in:
@@ -24,6 +24,7 @@ $: console.log(availableBranches)
|
||||
async function createBranch() {
|
||||
const name = prompt("Branch name:")
|
||||
if (name) {
|
||||
selected = null
|
||||
await $pageRepo.createBranch(name)
|
||||
let inter = setInterval(() => {
|
||||
branches.reload()
|
||||
@@ -36,9 +37,9 @@ async function createBranch() {
|
||||
}
|
||||
}
|
||||
|
||||
async function deleteBranch() {
|
||||
async function deleteBranch(con: boolean = false) {
|
||||
if (selectedBranch !== "master") {
|
||||
let conf = confirm("Are you sure you want to delete this branch?")
|
||||
let conf = con || confirm("Are you sure you want to delete this branch?")
|
||||
if(conf) {
|
||||
await $pageRepo.deleteBranch(selectedBranch)
|
||||
let inter = setInterval(() => {
|
||||
@@ -59,12 +60,21 @@ 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
|
||||
reload()
|
||||
}
|
||||
}
|
||||
|
||||
function reload() {
|
||||
const w = selectedBranch
|
||||
selectedBranch = "###!"
|
||||
selectedBranch = w
|
||||
}
|
||||
|
||||
async function mergeBranch() {
|
||||
await $pageRepo.merge(selectedBranch, `Go live of ${selectedBranch}`)
|
||||
await deleteBranch(true)
|
||||
}
|
||||
|
||||
</script>
|
||||
<div class="flex flex-col h-screen overflow-scroll">
|
||||
<Navbar let:hidden let:toggle>
|
||||
@@ -84,9 +94,15 @@ async function createFile() {
|
||||
<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={createBranch}>Create Branch</Button>
|
||||
{#if selectedBranch !== "master"}
|
||||
<Button on:click={mergeBranch}>Merge Branch</Button>
|
||||
{:else}
|
||||
<Button on:click={createBranch}>Create Branch</Button>
|
||||
{/if}
|
||||
<Button on:click={createFile} color="alternative">Create File</Button>
|
||||
<Button on:click={deleteBranch} color="ghost">Delete Branch</Button>
|
||||
{#if selectedBranch !== "master"}
|
||||
<Button on:click={deleteBranch} color="ghost">Delete Branch</Button>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{@const pagesMap = mapToMap(pages)}
|
||||
@@ -111,7 +127,7 @@ async function createFile() {
|
||||
</Card>
|
||||
<Card class="!max-w-full" style="grid-column: 2/4">
|
||||
{#if selected}
|
||||
<Editor pageId={selected} branch={selectedBranch} />
|
||||
<Editor pageId={selected} branch={selectedBranch} on:reload={reload} />
|
||||
{/if}
|
||||
</Card>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user