create-smcgateway-sv 0.0.4 → 0.1.2

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
@@ -1,24 +1,23 @@
1
1
  {
2
2
  "name": "create-smcgateway-sv",
3
- "version": "0.0.4",
3
+ "version": "0.1.2",
4
4
  "description": "SMC Gateway Svelte Webapp template",
5
5
  "bin": {
6
6
  "create-my-template": "./index.js"
7
7
  },
8
8
  "repository": {
9
9
  "type": "git",
10
- "url": "git+https://github.com/petermekhaeil/create-my-template.git"
10
+ "url": "git+https://github.com/smc-gateway/create-smcgateway-sv.git"
11
11
  },
12
12
  "keywords": [
13
13
  "template"
14
14
  ],
15
- "author": "Peter Mekhaeil <4616064+petermekhaeil@users.noreply.github.com>",
15
+ "author": "Kevin Golding",
16
16
  "license": "MIT",
17
17
  "bugs": {
18
- "url": "https://github.com/petermekhaeil/create-my-template/issues"
18
+ "url": "https://github.com/smc-gateway/create-smcgateway-sv/issues"
19
19
  },
20
- "homepage": "https://github.com/petermekhaeil/create-my-template#readme",
20
+ "homepage": "https://www.npmjs.com/package/create-smcgateway-sv",
21
21
  "dependencies": {
22
- "cross-spawn": "^7.0.3"
23
22
  }
24
23
  }
@@ -1,3 +1,13 @@
1
1
  # Getting Started
2
2
 
3
- This project was bootstrapped with `create-smcgateway-sv`.
3
+ This project was bootstrapped with `npx create-smcgateway-sv`.
4
+
5
+ ## Quickstart
6
+
7
+ 1. `npn install`
8
+ 1. `npm run dev` OR `make dev`
9
+
10
+ ## Packaging for use on an SMC Gateway
11
+
12
+ 1. `git commit...`
13
+ 1. `make build` will create a zip file that can be uploaded as a web application to the SMC Gateway
@@ -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
- <div class="container mt-3">
7
- {#if auth.user}
8
- <Hello></Hello>
9
- <button class="btn btn-secondary" onclick={auth.logout}>Logout</button>
10
- {:else}
11
- <LoginForm></LoginForm>
12
- {/if}
13
- </div>
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>