Add some text to the version number when Queue is updated.

This commit is contained in:
Bauke 2020-11-14 18:24:20 +01:00
parent a651cd1138
commit 93a665dc63
Signed by: Bauke
GPG Key ID: C1C0F29952BCF558
5 changed files with 25 additions and 7 deletions

View File

@ -65,6 +65,7 @@ browser.runtime.onInstalled.addListener(async () => {
manifest.nodeEnv === 'development'
) {
settings.latestVersion = manifest.version;
settings.versionGotUpdated = true;
await saveSettings(settings);
await openOptionsPage();
}

View File

@ -3,7 +3,7 @@
"manifest_version": 2,
"name": "Queue",
"description": "A WebExtension for queueing links.",
"version": "0.1.3",
"version": "0.1.4",
"permissions": [
"contextMenus",
"storage",

View File

@ -5,7 +5,8 @@ import {
getSettings,
PageFooter,
PageHeader,
PageMain
PageMain,
saveSettings
} from '.';
(async () => {
@ -14,11 +15,20 @@ import {
const manifest = getManifest();
const settings = await getSettings();
const showVersionUpdated = settings.versionGotUpdated;
if (showVersionUpdated) {
settings.versionGotUpdated = false;
await saveSettings(settings);
}
render(
html`
<${PageHeader} />
<${PageMain} settings=${settings} />
<${PageFooter} manifest=${manifest} />
<${PageFooter}
manifest=${manifest}
showVersionUpdated=${showVersionUpdated}
/>
`,
document.body
);

View File

@ -1,8 +1,9 @@
import {html} from 'htm/preact';
import {Link, QComponent, QManifest} from '../..';
import {Link, QComponent, QManifest, Settings} from '../..';
type FooterProps = {
manifest: QManifest;
showVersionUpdated: boolean;
};
export function PageFooter(props: FooterProps): QComponent {
@ -12,10 +13,13 @@ export function PageFooter(props: FooterProps): QComponent {
url="https://github.com/Holllo/queue/releases/tag/${version}"
/>`;
const versionUpdated = props.showVersionUpdated ? 'Updated to' : '';
return html`
<footer class="page-footer">
<p>
${versionLink} 🄯 Holllo Free and open-source, forever.
${versionUpdated} ${versionLink} 🄯 Holllo Free and open-source,
forever.
</p>
</footer>
`;

View File

@ -11,11 +11,13 @@ export type QItem = {
export type Settings = {
latestVersion: string;
queue: QItem[];
versionGotUpdated: boolean;
};
const defaultSettings: Settings = {
latestVersion: '0.0.0',
queue: []
queue: [],
versionGotUpdated: false
};
/**
@ -33,7 +35,8 @@ export async function getSettings(): Promise<Settings> {
const settings: Settings = {
latestVersion: syncSettings.latestVersion,
queue
queue,
versionGotUpdated: syncSettings.versionGotUpdated
};
return settings;