diff --git a/client/src/components/NavBar.vue b/client/src/components/NavBar.vue index e11af91..64a6d6e 100644 --- a/client/src/components/NavBar.vue +++ b/client/src/components/NavBar.vue @@ -1,5 +1,14 @@ @@ -9,20 +18,27 @@ import { RouterLink } from 'vue-router'; - - - - Go Back - - + + + Go Back + + - - - Add Track - - - + + + Add Track + + + + + + Log Out + + + + + - \ No newline at end of file + diff --git a/client/src/state.ts b/client/src/state.ts index 67c0955..9e08abb 100644 --- a/client/src/state.ts +++ b/client/src/state.ts @@ -2,6 +2,7 @@ import { reactive } from "vue" import { Track } from "./track" import { Tick } from './ticks' import { error } from "./error" +import { getCookie } from "./util"; enum State { Unfetched, @@ -31,6 +32,8 @@ class AppState { constructor() { this.tracks = new Array this.state = State.Unfetched + const name = getCookie("name") + if (name) this.user = { name } } streamUpdatesFromServer() { const source = new EventSource("/api/v1/updates") diff --git a/client/src/util.ts b/client/src/util.ts new file mode 100644 index 0000000..ebbda1c --- /dev/null +++ b/client/src/util.ts @@ -0,0 +1,8 @@ +export function getCookie(key: string): string | null { + const start = document.cookie.indexOf(key + '=') + if(start === -1) return null + let end: number | undefined = document.cookie.indexOf(';', start) + if(end === -1) + end = undefined + return document.cookie.substring(start + key.length + 1, end) +} \ No newline at end of file diff --git a/client/src/views/Login.vue b/client/src/views/Login.vue index 9f21ab0..a50bf9d 100644 --- a/client/src/views/Login.vue +++ b/client/src/views/Login.vue @@ -1,13 +1,18 @@ @@ -44,7 +52,7 @@ async function login() { - Name + Name @@ -58,8 +66,8 @@ async function login() { diff --git a/shell.nix b/shell.nix index be0c83f..f7556e2 100644 --- a/shell.nix +++ b/shell.nix @@ -2,13 +2,16 @@ { pkgs ? import {} }: pkgs.mkShell { - nativeBuildInputs = with pkgs.buildPackages; [ - clang - yarn nodejs - openssl - python3 - python3Packages.requests - python3Packages.ipython + name = "kalkutago"; + nativeBuildInputs = with pkgs.buildPackages; [ + clang + yarn nodejs + openssl + python3 + python3Packages.requests + python3Packages.ipython + rustup + docker + gnumake ]; } -