Skip to content

Commit

Permalink
feat: ui version in footer
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksasiriski committed Jun 20, 2024
1 parent ae403a6 commit 4e38269
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
PUBLIC_UI_VERSION=dev
PUBLIC_URI=http://localhost:5173
# use local frontend with local backend
API_URI=http://localhost:3030 # server reachable
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/dockercicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ jobs:
# install dependencies and build
- run: make install
- run: make compile
env:
PUBLIC_UI_VERSION: ${{ github.ref }}

# run tests
- run: make check
Expand Down
9 changes: 4 additions & 5 deletions src/lib/components/footer/main.svelte
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
<script>
/**
* @typedef {object} Props
* @property {string} uiVersion
* @property {string} apiVersion
*/
/** @type {Props} */
let { apiVersion } = $props();
const apiVersionWOSemicolon = $derived(apiVersion.replace(/\;$/, ''));
let { uiVersion, apiVersion } = $props();
</script>

<footer class="h-[10lvh] w-full border-t-2 border-neutral-100 dark:border-neutral-700">
Expand All @@ -18,8 +17,8 @@
>
Source code
</a>
<p class="text-neutral-600 dark:text-neutral-300 font-light">
Agent version: {apiVersionWOSemicolon}
<p class="text-sm text-neutral-600 dark:text-neutral-300 font-light">
UI ver: {uiVersion.replace(/\;$/, '')} | Agent ver: {apiVersion.replace(/\;$/, '')}
</p>
</div>
</footer>
2 changes: 2 additions & 0 deletions src/routes/+layout.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { PUBLIC_UI_VERSION } from '$env/static/public';
import { fetchVersion } from '$lib/functions/api/fetchversion';

/** @type {import('./$types').LayoutLoad} */
export async function load({ fetch }) {
const apiVersion = await fetchVersion(fetch);
return {
uiVersion: PUBLIC_UI_VERSION ?? 'dev',
apiVersion: apiVersion
};
}
3 changes: 2 additions & 1 deletion src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import Footer from '$lib/components/footer/main.svelte';
let { data } = $props();
const uiVersion = $derived(data.uiVersion);
const apiVersion = $derived(data.apiVersion);
</script>

Expand All @@ -18,4 +19,4 @@
<slot />
</main>

<Footer {apiVersion} />
<Footer {uiVersion} {apiVersion} />

0 comments on commit 4e38269

Please sign in to comment.