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' manifest.nodeEnv === 'development'
) { ) {
settings.latestVersion = manifest.version; settings.latestVersion = manifest.version;
settings.versionGotUpdated = true;
await saveSettings(settings); await saveSettings(settings);
await openOptionsPage(); await openOptionsPage();
} }

View File

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

View File

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

View File

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

View File

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