Skip to content

Commit

Permalink
feat(Core): added version information to main menu
Browse files Browse the repository at this point in the history
  • Loading branch information
akopachov committed Jan 15, 2024
1 parent 9916ecf commit 497c8d9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions webextension/src/i18n/en.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"$schema": "https://inlang.com/schema/inlang-message-format",
"Core_Page_Title": "New Tab",
"Core_Version": "Version: {version}",
"Core_Sidebar_NewWidget": "New Widget",
"Core_Sidebar_Background": "Background",
"Core_Sidebar_Settings": "Settings",
Expand Down
6 changes: 4 additions & 2 deletions webextension/src/routes/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script lang="ts">
import { version } from '$app/environment';
import {
Accordion,
AccordionItem,
Expand Down Expand Up @@ -247,14 +248,15 @@
</svelte:fragment>
</AccordionItem>
</Accordion>
<div class="block mt-auto mb-4">
<div class="block mt-auto">
<!-- svelte-ignore a11y-label-has-associated-control -->
<label class="label flex justify-center items-center">
<label class="label flex justify-center items-center mb-3">
<span>{m.Core_Sidebar_LockWorkspace()}</span>
{#if workspace}
<SlideToggle name="stWorkspaceEditMode" class="ml-3" bind:checked={$workspaceLocked} size="sm" />
{/if}
</label>
<span class="text-[10px] p-2">{m.Core_Version({ version })}</span>
</div>
</div>
</Drawer>
Expand Down
10 changes: 10 additions & 0 deletions webextension/svelte.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import adapter from '@sveltejs/adapter-static';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
import { fastDimension } from 'svelte-fast-dimension';
import { readFileSync } from 'fs';
import { fileURLToPath } from 'url';
import * as child_process from 'node:child_process';

const file = fileURLToPath(new URL('package.json', import.meta.url));
const json = readFileSync(file, 'utf8');
const pkg = JSON.parse(json);

/** @type {import('@sveltejs/kit').Config} */
const config = {
Expand All @@ -25,6 +32,9 @@ const config = {
paths: {
relative: false,
},
version: {
name: `${pkg.version}+${child_process.execSync('git rev-parse --short HEAD').toString().trim()}`,
},
},
};

Expand Down

0 comments on commit 497c8d9

Please sign in to comment.