-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new words to cSpell dictionary, update button transitions, fix ty… (
#161)
- Loading branch information
Showing
15 changed files
with
1,012 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"cSpell.words": ["LFIB", "MPLS", "visibilitychanged"], | ||
"cSpell.words": ["LFIB", "MPLS", "visibilitychanged", "offroad"], | ||
"eslint.validate": ["svelte"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
<script lang="ts"> | ||
import loadNetwork from "$lib/classes/Loader/NetworkLoader"; | ||
import ToolboxButton from "$lib/components/ToolboxButton.svelte"; | ||
import Dialog from "$lib/components/Dialog.svelte"; | ||
import SmallNetworkJson from "$lib/data/SmallNetwork.json"; | ||
import LargeNetworkJson from "$lib/data/LargeNetwork.json"; | ||
import { onMount } from "svelte"; | ||
let dialog: HTMLDialogElement; | ||
$: startupButtons = [ | ||
{ | ||
text: "Blank", | ||
callback: () => { | ||
dialog.close(); | ||
}, | ||
}, | ||
{ | ||
text: "Small", | ||
callback: () => { | ||
loadNetwork(SmallNetworkJson); | ||
dialog.close(); | ||
}, | ||
}, | ||
{ | ||
text: "Large", | ||
callback: () => { | ||
loadNetwork(LargeNetworkJson); | ||
dialog.close(); | ||
}, | ||
}, | ||
{ | ||
text: "Import", | ||
callback: () => { | ||
const hiddenInput = document.createElement("input"); | ||
hiddenInput.type = "file"; | ||
hiddenInput.accept = ".json"; | ||
hiddenInput.onchange = (event: InputEvent) => { | ||
if (!(event.target instanceof HTMLInputElement)) return; | ||
if (event.target.files.length === 0) return; | ||
const file = event.target.files[0]; | ||
const reader = new FileReader(); | ||
reader.addEventListener("load", (event) => { | ||
if (!event.target || typeof event.target.result !== "string") return; | ||
const success = loadNetwork(JSON.parse(event.target.result)); | ||
if (success) dialog.close(); | ||
}); | ||
reader.readAsText(file); | ||
}; | ||
hiddenInput.click(); | ||
}, | ||
}, | ||
]; | ||
onMount(() => { | ||
dialog.inert = true; | ||
dialog.showModal(); | ||
dialog.inert = false; | ||
}); | ||
</script> | ||
|
||
<Dialog bind:dialog> | ||
<h1>Welcome</h1> | ||
<p>This tool is designed to mimic the basics of MPLS</p> | ||
<p>Choose a network:</p> | ||
<div class="buttons"> | ||
{#each startupButtons as button} | ||
<ToolboxButton {...button} /> | ||
{/each} | ||
</div> | ||
</Dialog> | ||
|
||
<style> | ||
h1, | ||
p { | ||
text-align: center; | ||
} | ||
p:first-of-type { | ||
margin-bottom: 10px; | ||
} | ||
div { | ||
display: flex; | ||
gap: 10px; | ||
justify-content: center; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.