Skip to content

Commit

Permalink
Add plugins page
Browse files Browse the repository at this point in the history
  • Loading branch information
Wrench56 committed Jul 8, 2024
1 parent 7ac92cf commit 7ee7dd9
Show file tree
Hide file tree
Showing 5 changed files with 127 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/frontend/src/lib/components/plugins/Box.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<script lang="ts">
</script>

<div class="box">
<slot></slot>
</div>

<style>
.box {
height: fit-content;
padding: 10px;
margin: 15px 10px 15px 10;
border: 1px solid whitesmoke;
}
</style>
22 changes: 22 additions & 0 deletions src/frontend/src/lib/components/plugins/Header.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<div class="container">
<pre>
____ __ _
/ __ \/ /_ ______ _(_)___ _____
/ /_/ / / / / / __ `/ / __ \/ ___/
/ ____/ / /_/ / /_/ / / / / (__ )
/_/ /_/\__,_/\__, /_/_/ /_/____/
/____/
</pre>
</div>

<style>
pre {
margin: -10px 0px 0px 0px;
font-family: monaco, Consolas, "Lucida Console", monospace;
color: whitesmoke;
}
.container {
overflow: hidden;
}
</style>
65 changes: 65 additions & 0 deletions src/frontend/src/lib/components/plugins/UrlField.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<script lang="ts">
import { onMount } from "svelte";
let pluginUrl: string;
let pluginUrlInput: HTMLInputElement;
onMount(() => {
pluginUrlInput.focus();
});
function handleKeydown(event: KeyboardEvent) {
if (event.key === "Enter") {
fetch("/plugins", {
method: "POST",
headers: {
"Content-Type": "application/json; charset=utf-8",
},
body: JSON.stringify({
url: pluginUrl,
}),
});
}
}
</script>

<svelte:window on:keydown={handleKeydown} />

<div class="grid">
<label for="plugin-url">Plugin.toml URL></label>
<input
type="text"
id="plugin-url"
bind:this={pluginUrlInput}
bind:value={pluginUrl}
/>
</div>

<style>
.grid {
display: flex;
}
label {
font-family: monaco, Consolas, "Lucida Console", monospace;
color: whitesmoke;
font-size: 16px;
flex: 0 0 150px;
}
input {
border: none;
background: none;
font-family: monaco, Consolas, "Lucida Console", monospace;
color: whitesmoke;
outline: none;
caret: whitesmoke block;
margin: 0px;
font-size: 16px;
flex-grow: 1;
}
input:focus {
outline: none;
}
</style>
2 changes: 2 additions & 0 deletions src/frontend/src/routes/plugins/+layout.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export const prerender = true;
export const ssr = true;
23 changes: 23 additions & 0 deletions src/frontend/src/routes/plugins/+page.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<script lang="ts">
import Box from "$lib/components/plugins/Box.svelte";
import Header from "$lib/components/plugins/Header.svelte";
import UrlField from "$lib/components/plugins/UrlField.svelte";
import Separator from "$lib/components/shared/Separator.svelte";
import Statusbar from "$lib/components/shared/statusbar/Statusbar.svelte";
import DNotificationContainer from "$lib/notifications/DNotificationContainer.svelte";
</script>

<Box>
<Header />
<Separator />
<UrlField />
</Box>

<DNotificationContainer />
<Statusbar />

<style>
:root {
background-color: black;
}
</style>

0 comments on commit 7ee7dd9

Please sign in to comment.