feat: add dev badge in navigation for local builds

This commit is contained in:
Sam 2023-03-30 01:20:46 +02:00
parent a49dd09013
commit 65fa7f6d46
No known key found for this signature in database
GPG key ID: B4EF20DDE721CAA1
2 changed files with 9 additions and 2 deletions

View file

@ -26,7 +26,7 @@
<div class="d-flex flex-column min-vh-100"> <div class="d-flex flex-column min-vh-100">
<div class="flex-grow-1"> <div class="flex-grow-1">
<Navigation /> <Navigation commit={data.git_commit} />
<div class="container"> <div class="container">
<slot /> <slot />
<div class="position-absolute top-0 start-50 translate-middle-x"> <div class="position-absolute top-0 start-50 translate-middle-x">

View file

@ -27,6 +27,8 @@
import { apiFetch, apiFetchClient } from "$lib/api/fetch"; import { apiFetch, apiFetchClient } from "$lib/api/fetch";
import { addToast } from "$lib/toast"; import { addToast } from "$lib/toast";
export let commit: string;
let theme: string; let theme: string;
let currentUser: MeUser | null; let currentUser: MeUser | null;
let showMenu: boolean = false; let showMenu: boolean = false;
@ -113,7 +115,12 @@
expand="lg" expand="lg"
class="mb-4" class="mb-4"
> >
<NavbarBrand href="/" aria-label="pronouns.cc landing page"><Logo /></NavbarBrand> <NavbarBrand href="/" aria-label="pronouns.cc landing page">
<Logo />
{#if commit === "[unknown]"}
<Badge color="danger">DEV</Badge>
{/if}
</NavbarBrand>
<NavbarToggler on:click={toggleMenu} aria-label="Toggle menu" /> <NavbarToggler on:click={toggleMenu} aria-label="Toggle menu" />
<Collapse isOpen={showMenu} navbar expand="lg"> <Collapse isOpen={showMenu} navbar expand="lg">
<Nav class="ms-auto" navbar> <Nav class="ms-auto" navbar>