Skip to content

Commit

Permalink
Run prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
Zokhoi committed Sep 11, 2023
1 parent b4dc705 commit 8d0f614
Show file tree
Hide file tree
Showing 9 changed files with 106 additions and 130 deletions.
4 changes: 2 additions & 2 deletions framerail/src/lib/server/page/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export async function pageDelete(
siteId: number,
pageId: Optional<number>,
slug: string,
revisionComments: Optional<string>,
revisionComments: Optional<string>
): object {
const response = await wellfetch("/page", {
method: "DELETE",
Expand All @@ -16,7 +16,7 @@ export async function pageDelete(
siteId,
page: pageId ?? slug,
userId: 1, // TODO: identify user session and pass the user to the API request
revisionComments,
revisionComments
})
})

Expand Down
4 changes: 2 additions & 2 deletions framerail/src/lib/server/page/edit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export async function pageEdit(
wikitext: string,
title: string,
altTitle: string,
tags: string[],
tags: string[]
): object {
let endpoint = "/page"
if (!pageId) {
Expand All @@ -30,7 +30,7 @@ export async function pageEdit(
wikitext,
title,
altTitle,
tags,
tags
})
})

Expand Down
23 changes: 14 additions & 9 deletions framerail/src/lib/sigma-esque/sigma-esque.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
</div>
</div>

<!-- Ignoring the styling as being a theme it will inevitably style other elements in the entire layout -->
<!-- prettier-ignore -->
<style global lang="scss">
body {
margin: 0;
Expand All @@ -38,7 +40,8 @@
min-height: 100vh;
background-color: #fff;
textarea, input[type="text"] {
textarea,
input[type="text"] {
border-radius: 0.5em;
padding: 0.5em 1em;
}
Expand Down Expand Up @@ -97,7 +100,8 @@
background-color: #fff;
color: #111;
textarea, input[type="text"] {
textarea,
input[type="text"] {
background-color: #fff;
color: #111;
border: 1px solid #0006;
Expand Down Expand Up @@ -127,7 +131,8 @@
background-color: #222;
color: #b6c2cf;
textarea, input[type="text"] {
textarea,
input[type="text"] {
background-color: #222;
color: #b6c2cf;
border: 1px solid #b6c2cf;
Expand All @@ -143,12 +148,12 @@
}
}
.editor-actions {
.editor-button {
background-color: #222;
color: #b6c2cf;
border: 1px solid #b6c2cf;
.editor-actions {
.editor-button {
background-color: #222;
color: #b6c2cf;
border: 1px solid #b6c2cf;
}
}
}
}
</style>
98 changes: 34 additions & 64 deletions framerail/src/routes/+error.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
function cancelEdit() {
goto(`/${$page.params.slug}`, {
noScroll: true,
noScroll: true
})
}
Expand All @@ -15,10 +15,10 @@
fdata.set("slug", $page.params.slug)
await fetch(`/${$page.params.slug}`, {
method: "POST",
body: fdata,
body: fdata
})
goto(`/${$page.params.slug}`, {
noScroll: true,
noScroll: true
})
}
</script>
Expand All @@ -35,49 +35,36 @@ as soon as we can figure out prettier support for it.
UNTRANSLATED:Page not found

{#if $page.error.options?.edit}
<form
id="editor"
class="editor"
method="POST"
on:submit|preventDefault={saveEdit} >
<form id="editor" class="editor" method="POST" on:submit|preventDefault={saveEdit}>
<input name="title" class="editor-title" placeholder="title" type="text" />
<input
type="text"
class="editor-title"
name="title"
placeholder="title"
/>
<input
type="text"
class="editor-alt-title"
name="alt-title"
class="editor-alt-title"
placeholder="alternative title"
/>
<textarea class="editor-wikitext" name="wikitext"></textarea>
<input
type="text"
class="editor-tags"
name="tags"
placeholder="tags"
/>
/>
<textarea name="wikitext" class="editor-wikitext" />
<input name="tags" class="editor-tags" placeholder="tags" type="text" />
<div class="editor-actions">
<button
type="button"
class="editor-button button-cancel clickable"
on:click|stopPropagation={cancelEdit} >
type="button"
on:click|stopPropagation={cancelEdit}
>
UT:Cancel
</button>
<button
type="submit"
class="editor-button button-save clickable"
on:click|stopPropagation >
type="submit"
on:click|stopPropagation
>
UT:Save
</button>
</div>
</form>
{:else}
{@html $page.error.compiledHtml}
{/if}

{:else if $page.error.view === "pagePermissions"}
UNTRANSLATED:Lacks permissions for page
{@html $page.error.compiledHtml}
Expand All @@ -94,42 +81,25 @@ as soon as we can figure out prettier support for it.
height: 60vh;
}
.page-content,
.page-tags-container {
padding: 0 0 2em;
}
.page-tags {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: flex-start;
align-items: center;
gap: 10px;
padding: 0;
margin: 0;
list-style: none;
}
.editor {
width: 80vw;
display: flex;
flex-direction: column;
justify-content: stretch;
align-items: stretch;
gap: 15px;
}
.editor {
width: 80vw;
display: flex;
flex-direction: column;
justify-content: stretch;
align-items: stretch;
gap: 15px;
}
.editor-wikitext {
height: 60vh;
}
.editor-wikitext {
height: 60vh;
}
.editor-actions {
width: 100%;
display: flex;
flex-direction: row;
justify-content: flex-end;
align-items: stretch;
gap: 10px;
}
.editor-actions {
width: 100%;
display: flex;
flex-direction: row;
justify-content: flex-end;
align-items: stretch;
gap: 10px;
}
</style>
24 changes: 6 additions & 18 deletions framerail/src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,9 @@
</script>

<SigmaEsque>
<svelte:fragment slot="header">
UNTRANSLATED: W i k i j u m p .
</svelte:fragment>
<svelte:fragment slot="header">UNTRANSLATED: W i k i j u m p .</svelte:fragment>

<svelte:fragment slot="top-bar">
UNTRANSLATED: Top bar
</svelte:fragment>
<svelte:fragment slot="top-bar">UNTRANSLATED: Top bar</svelte:fragment>

<svelte:fragment slot="content">
<slot />
Expand All @@ -18,24 +14,16 @@
<svelte:fragment slot="footer">
<ul class="footer-items">
<li class="footer-item">
<a href="#">
UT:Terms
</a>
<a href="#">UT:Terms</a>
</li>
<li class="footer-item">
<a href="#">
UT:Privacy
</a>
<a href="#">UT:Privacy</a>
</li>
<li class="footer-item">
<a href="#">
UT:Docs
</a>
<a href="#">UT:Docs</a>
</li>
<li class="footer-item">
<a href="#">
UT:Security
</a>
<a href="#">UT:Security</a>
</li>
</ul>
</svelte:fragment>
Expand Down
2 changes: 1 addition & 1 deletion framerail/src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
import Page from "./[slug]/[...extra]/page.svelte"
</script>

<Page data={data} />
<Page {data} />
2 changes: 1 addition & 1 deletion framerail/src/routes/[slug]/[...extra]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
import Page from "./page.svelte"
</script>

<Page data={data} />
<Page {data} />
19 changes: 14 additions & 5 deletions framerail/src/routes/[slug]/[...extra]/+server.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { pageEdit } from "$lib/server/page/edit"
import { pageDelete } from "$lib/server/page/delete"
import { pageEdit } from "$lib/server/page/edit"

export async function POST(event) {
let data = await event.request.formData()
Expand All @@ -14,11 +14,20 @@ export async function POST(event) {
let altTitle = data.get("alt-title")?.toString()
let tagsStr = data.get("tags")?.toString().trim()
let tags: string[] = []
if (tagsStr?.length) tags = tagsStr.split(" ").filter(tag=>tag.length)
if (tagsStr?.length) tags = tagsStr.split(" ").filter((tag) => tag.length)

let res = await pageEdit(siteId, pageId, slug, comments, wikitext, title, altTitle, tags)
let res = await pageEdit(
siteId,
pageId,
slug,
comments,
wikitext,
title,
altTitle,
tags
)

return new Response(JSON.stringify(res));
return new Response(JSON.stringify(res))
}

export async function DELETE(event) {
Expand All @@ -31,5 +40,5 @@ export async function DELETE(event) {
let comments = data.get("comments")?.toString() ?? ""

let res = await pageDelete(siteId, pageId, slug, comments)
return new Response(JSON.stringify(res));
return new Response(JSON.stringify(res))
}
Loading

0 comments on commit 8d0f614

Please sign in to comment.