create-smcgateway-sv 0.0.4 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/template/src/App.svelte
CHANGED
|
@@ -1,13 +1,34 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import Router from "svelte-spa-router";
|
|
3
|
+
import NavBar from "./lib/Navbar.svelte";
|
|
2
4
|
import { LoginForm, auth } from "smcgateway-sv";
|
|
3
|
-
import Hello from "lib/Hello.svelte"
|
|
5
|
+
import Hello from "./lib/Hello.svelte";
|
|
6
|
+
|
|
7
|
+
const routes = {
|
|
8
|
+
"/hello": Hello,
|
|
9
|
+
// Catch all, must be at end
|
|
10
|
+
"*": Hello,
|
|
11
|
+
};
|
|
4
12
|
</script>
|
|
5
13
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
<
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
{#if auth.user}
|
|
15
|
+
<NavBar></NavBar>
|
|
16
|
+
<div class="container-fluid" style="margin-top: 60px;">
|
|
17
|
+
<Router {routes} />
|
|
18
|
+
</div>
|
|
19
|
+
{:else}
|
|
20
|
+
<div class="form-signin">
|
|
21
|
+
<LoginForm>
|
|
22
|
+
<h3>Login</h3>
|
|
23
|
+
</LoginForm>
|
|
24
|
+
</div>
|
|
25
|
+
{/if}
|
|
26
|
+
|
|
27
|
+
<style>
|
|
28
|
+
.form-signin {
|
|
29
|
+
width: 100%;
|
|
30
|
+
max-width: 330px;
|
|
31
|
+
padding-top: 50px;
|
|
32
|
+
margin: auto;
|
|
33
|
+
}
|
|
34
|
+
</style>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import active from "svelte-spa-router/active";
|
|
3
|
+
import { auth } from "smcgateway-sv";
|
|
4
|
+
</script>
|
|
5
|
+
|
|
6
|
+
<nav class="navbar fixed-top navbar-expand-lg navbar-light bg-light">
|
|
7
|
+
<div class="container-fluid">
|
|
8
|
+
<a class="navbar-brand" href="#/">Admin</a>
|
|
9
|
+
<button
|
|
10
|
+
class="navbar-toggler"
|
|
11
|
+
type="button"
|
|
12
|
+
data-bs-toggle="collapse"
|
|
13
|
+
data-bs-target="#navbarNav"
|
|
14
|
+
aria-controls="navbarNav"
|
|
15
|
+
aria-expanded="false"
|
|
16
|
+
aria-label="Toggle navigation"
|
|
17
|
+
>
|
|
18
|
+
<span class="navbar-toggler-icon"></span>
|
|
19
|
+
</button>
|
|
20
|
+
<div class="collapse navbar-collapse" id="navbarNav">
|
|
21
|
+
<ul class="navbar-nav">
|
|
22
|
+
<li class="nav-item">
|
|
23
|
+
<a
|
|
24
|
+
class="nav-link"
|
|
25
|
+
use:active
|
|
26
|
+
aria-current="page"
|
|
27
|
+
href="#/hello">Hello</a
|
|
28
|
+
>
|
|
29
|
+
</li>
|
|
30
|
+
{#if auth.isAdmin}
|
|
31
|
+
<li class="nav-item">
|
|
32
|
+
<a
|
|
33
|
+
class="nav-link"
|
|
34
|
+
use:active
|
|
35
|
+
aria-current="page"
|
|
36
|
+
href="#/">Admin only</a
|
|
37
|
+
>
|
|
38
|
+
</li>
|
|
39
|
+
{/if}
|
|
40
|
+
</ul>
|
|
41
|
+
<a class="nav-link" use:active href="#/" onclick={auth.logout}
|
|
42
|
+
>Logout</a
|
|
43
|
+
>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
</nav>
|