Skip to content

Commit

Permalink
[MERGE] Merge branch 'master' into production
Browse files Browse the repository at this point in the history
  • Loading branch information
Matteo Bilotta committed Oct 4, 2021
2 parents e036cf4 + 17f3e4e commit 554ea83
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 18 deletions.
5 changes: 5 additions & 0 deletions core/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,8 @@ export interface RootState extends IndexState
{
config: ConfigState;
}

export interface WorkboxEvent extends Event
{
isUpdate: boolean;
}
1 change: 1 addition & 0 deletions nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export default {
"@/plugins/globals/mdc.client.ts",
"@/plugins/globals/time.client.ts",

"@/plugins/refresh-dialog.client.ts",
"@/plugins/vue-scroll-animator.client.ts"
],

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@byloth/website",
"version": "5.0.9",
"version": "5.0.10",
"description": "My personal website as a Nuxt.js application, written in TypeScript and based on Material Design.",
"keywords": [
"Vue.js",
Expand Down
15 changes: 15 additions & 0 deletions plugins/globals.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { MDCTextField } from "@material/textfield";

import Time from "@/core/time";

declare global
{
interface Window
{
$workbox: Promise<ServiceWorker>;

mdc: { textfield: { MDCTextField: typeof MDCTextField } };

Time: Time;
}
}
8 changes: 0 additions & 8 deletions plugins/globals/mdc.client.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
import { MDCTextField as _MDCTextField } from "@material/textfield";

declare global
{
interface Window
{
mdc: { textfield: { MDCTextField: typeof _MDCTextField } };
}
}

window.mdc = { textfield: { MDCTextField: _MDCTextField } };
8 changes: 0 additions & 8 deletions plugins/globals/time.client.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
import Time from "@/core/time";

declare global
{
interface Window
{
Time: Time;
}
}

window.Time = Time;
28 changes: 28 additions & 0 deletions plugins/refresh-dialog.client.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { Context } from "@nuxt/types";

import { WorkboxEvent } from "@/core/types";

export default async ({ store }: Context): Promise<void> =>
{
const workbox = await window.$workbox;

if (workbox)
{
workbox.addEventListener("installed", (event) =>
{
const workboxEvent = event as WorkboxEvent;

if (workboxEvent.isUpdate)
{
store.dispatch("dialog", {
type: "snackbar",
message: { text: "Sono disponibili dei nuovi contenuti!" },
actions: [{
text: "Ricarica",
callback: () => window.location.reload()
}]
});
}
});
}
};
2 changes: 1 addition & 1 deletion store/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const state = (): ConfigState => ({
title: "Chi sono"
}
],
version: "5.0.9"
version: "5.0.10"
});

export { state };

0 comments on commit 554ea83

Please sign in to comment.