mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-08-24 07:18:57 +00:00
fix(assets): fix sw-update-notification display and PWA guard conditions
- Change sw-toast default from `display: flex` to `display: none` with proper CSS discrete transition - Add `display: flex` in `.visible` state and `allow-discrete` transition for display property - Restore production-only guard for SW notification and webmanifest templates - Fix PWA config enable to always be true when template is rendered - Fix extra space in head/index.html conditional
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
position: fixed;
|
||||
inset-inline-end: 1.5rem;
|
||||
bottom: 1.5rem;
|
||||
display: flex;
|
||||
display: none;
|
||||
align-items: center;
|
||||
gap: 0.75rem 1rem;
|
||||
padding: 0.625rem 1rem;
|
||||
@@ -18,11 +18,13 @@
|
||||
translate: 0 1rem;
|
||||
opacity: 0;
|
||||
transition:
|
||||
display 0.3s allow-discrete,
|
||||
translate 0.3s,
|
||||
opacity 0.3s;
|
||||
@include z-index(fixed);
|
||||
|
||||
&.visible {
|
||||
display: flex;
|
||||
translate: 0 0;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
@@ -300,7 +300,7 @@
|
||||
{{- $swBuildCtx := dict "mainCSSURL" $mainCSS.RelPermalink "mainJSURL" $mainJS.RelPermalink "offlineURL" $offlineURL "relURL" (relURL "") "version" (hugo.Store.Get "version") "Page" . -}}
|
||||
{{- $serviceWorker := resources.Get "js/service-worker.template.js" | resources.ExecuteAsTemplate "js/service-worker.template.js" $swBuildCtx -}}
|
||||
{{- $serviceWorker = dict "Resource" $serviceWorker "Build" (dict "targetPath" "sw.js") "Fingerprint" $fingerprint | partial "function/js-build.html" -}}
|
||||
{{- $config = dict "PWA" (dict "enable" .Site.Params.app.pwa "serviceWorkerURL" $serviceWorker.RelPermalink) | merge $config -}}
|
||||
{{- $config = dict "PWA" (dict "enable" true "serviceWorkerURL" $serviceWorker.RelPermalink) | merge $config -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Auto Bookmark */ -}}
|
||||
|
||||
@@ -98,7 +98,7 @@
|
||||
|
||||
{{- /* Alternative output formats (Atom, RSS, manifest etc.) */ -}}
|
||||
{{- range .AlternativeOutputFormats -}}
|
||||
{{- if (eq .Name "manifest") | and (not $.Site.Params.app.pwa) -}}
|
||||
{{- if (eq .Name "manifest") | and (not $.Site.Params.app.pwa) -}}
|
||||
{{- continue -}}
|
||||
{{- end -}}
|
||||
<link rel="{{ .Rel }}" type="{{ .MediaType.Type }}" href="{{ .Permalink | safeURL }}">
|
||||
|
||||
@@ -129,7 +129,7 @@
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Service Worker Update Notification */ -}}
|
||||
{{- if .Site.Params.app.pwa -}}
|
||||
{{- if not hugo.IsServer | and hugo.IsProduction | and .Site.Params.app.pwa -}}
|
||||
<div class="sw-update-notification">
|
||||
<div class="sw-update-content">
|
||||
<p class="sw-update-title">{{ T "serviceWorker.updateTitle" }}</p>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{{- hugo.Store.Set "version" "v1.0.0-mriu2jcf" -}}
|
||||
{{- hugo.Store.Set "version" "v1.0.0-mrizf1fk" -}}
|
||||
{{- .Store.Set "this" dict -}}
|
||||
|
||||
{{- partial "init/detection-env.html" . -}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{{- if .Site.Params.app.pwa -}}
|
||||
{{- if not hugo.IsServer | and hugo.IsProduction | and .Site.Params.app.pwa -}}
|
||||
{{- $name := .Site.Params.app.name | default .Site.Title -}}
|
||||
{{- $shortName := .Site.Params.app.short_name | default $name -}}
|
||||
{{- $startURL := relURL "/" -}}
|
||||
|
||||
Reference in New Issue
Block a user