Skip to content

Commit

Permalink
Added PWA support
Browse files Browse the repository at this point in the history
  • Loading branch information
daniluk4000 committed Nov 10, 2024
1 parent ce2b730 commit dd128a2
Show file tree
Hide file tree
Showing 10 changed files with 2,284 additions and 167 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- Fixed rare case when airport would not show on map
- You can no longer view airport arrival rate when overlay is collapsed
- Added Share window to Filters & Traffic with ability to share current URL with friends - including overlay
- Added PWA integration with ability to install VATSIM Radar on your PC or Phone (Chromium only)

## QA Changes

Expand Down
38 changes: 34 additions & 4 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ export default defineNuxtConfig({
sizes: '16x16',
href: '/favicon-16x16.png',
},
{
rel: 'manifest',
href: '/site.webmanifest',
},
{
rel: 'mask-icon',
href: '/safari-pinned-tab.svg',
Expand Down Expand Up @@ -62,6 +58,7 @@ export default defineNuxtConfig({
server: true,
},
experimental: {
appManifest: true,
asyncContext: true,
clientFallback: false,
defaults: {
Expand Down Expand Up @@ -127,6 +124,7 @@ export default defineNuxtConfig({
'@pinia/nuxt',
'@nuxt/eslint',
'@nuxtjs/stylelint-module',
'@vite-pwa/nuxt',
],
eslint: {
checker: {
Expand Down Expand Up @@ -167,6 +165,38 @@ export default defineNuxtConfig({
typescript: {
typeCheck: true,
},
pwa: {
client: {
periodicSyncForUpdates: 1000 * 60 * 5,
},
manifest: {
name: 'VATSIM Radar',
short_name: 'VR',
description: 'VATSIM Traffic Monitoring Service',
theme_color: '#3B6CEC',
orientation: 'portrait',
// @ts-expect-error tabbed not supported here
display_override: ['window-controls-overlay', 'tabbed', 'standalone'],
dir: 'ltr',
lang: 'en',
handle_links: 'not-preferred',
icons: [
{
src: 'android-chrome-192x192.png',
sizes: '192x192',
type: 'image/png',
},
{
src: 'android-chrome-512x512.png',
sizes: '512x512',
type: 'image/png',
},
],
},
devOptions: {
enabled: true,
},
},
vite: {
build: {
cssMinify: 'esbuild',
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"@pinia/nuxt": "^0.7.0",
"@prisma/client": "^5.22.0",
"@turf/great-circle": "^7.1.0",
"@vite-pwa/nuxt": "^0.10.6",
"adm-zip": "^0.5.16",
"aws-sdk": "^2.1692.0",
"chardet": "^2.0.0",
Expand All @@ -45,6 +46,7 @@
"sqlite3": "^5.1.7",
"svgo": "^3.3.2",
"ua-parser-js": "2.0.0-rc.2",
"vite-plugin-pwa": "^0.20.5",
"vite-svg-loader": "^5.1.0",
"vue": "^3.5.12",
"vue-router": "^4.4.5",
Expand Down
4 changes: 0 additions & 4 deletions src/components/map/filters/MapFiltersTraffic.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,3 @@ watch(customUrl, val => {
}
});
</script>

<style scoped lang="scss">
</style>
5 changes: 5 additions & 0 deletions src/components/views/ViewHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
:to="button.path"
:type="(button.path === route.path || button.children?.some(x => x.path === route.path)) ? 'primary' : 'secondary'"
:width="button.width"
@click="button.action?.()"
>
<template
v-if="button.icon"
Expand All @@ -56,6 +57,7 @@
:disabled="childrenButton.disabled"
:to="childrenButton.path"
:type="childrenButton.path === route.path ? 'primary' : 'secondary'"
@click="childrenButton.action?.()"
>
<template
v-if="childrenButton.icon"
Expand Down Expand Up @@ -400,9 +402,12 @@ const notamCookie = useCookie<boolean>('notam-closed', {
maxAge: 60 * 60 * 24,
});
const app = useNuxtApp();

Check failure on line 405 in src/components/views/ViewHeader.vue

View workflow job for this annotation

GitHub Actions / check

'app' is assigned a value but never used
interface HeaderItem {
text: string;
action?: () => any;
path?: string;
disabled?: boolean;
width?: string;
Expand Down
7 changes: 0 additions & 7 deletions src/components/views/ViewMapFooter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,6 @@
</div>
</div>
</div>
<nuxt-link
class="map-footer_left_section map-footer__text"
no-prefetch
to="/privacy-policy"
>
Privacy Policy
</nuxt-link>
<div
v-if="store.version"
class="map-footer_left_section map-footer__text"
Expand Down
15 changes: 7 additions & 8 deletions src/layouts/default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
v-if="!hadRestrictedAuth"
class="app"
>
<nuxt-pwa-manifest/>
<view-header v-if="!store.config.hideHeader"/>
<div class="app_content">
<client-only>
Expand All @@ -12,7 +13,7 @@
<slot/>
</div>
<common-popup
v-if="store.updateRequired"
v-if="store.updateRequired || $pwa?.needRefresh"
v-model="updateRequired"
disabled
>
Expand All @@ -35,12 +36,6 @@
v-else
class="app_footer_info"
>
<nuxt-link
no-prefetch
to="/privacy-policy"
>
Privacy Policy
</nuxt-link>
<div v-if="store.version">
v{{ store.version }}
</div>
Expand Down Expand Up @@ -70,8 +65,12 @@ defineSlots<{ default: () => any }>();
const store = useStore();
const route = useRoute();
const updateRequired = ref(true);
const { $pwa } = useNuxtApp();
const reload = () => location.reload();
const reload = () => {
if ($pwa?.needRefresh) $pwa.updateServiceWorker();
else location.reload();
};
const theme = useCookie<ThemesList>('theme', {
path: '/',
Expand Down
2 changes: 1 addition & 1 deletion src/pages/roadmap.vue
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ const roadmap = reactive<Roadmap[]>([
'Hoppie integration',
{
title: 'PWA',
description: 'Basically PC version of VATSIM Radar',
status: 'completed',
},
'Bookmarks',
],
Expand Down
19 changes: 0 additions & 19 deletions src/public/site.webmanifest

This file was deleted.

Loading

0 comments on commit dd128a2

Please sign in to comment.