ui: update button for mobile

pull/532/head
Anthony Fu 2022-12-23 19:26:28 +01:00
rodzic 589cf463bd
commit cd268c9bc7
6 zmienionych plików z 28 dodań i 13 usunięć

Wyświetl plik

@ -22,6 +22,7 @@ defineProps<{
</div>
<div flex items-center flex-shrink-0 gap-x-2>
<slot name="actions" />
<PwaBadge lg:hidden />
<NavUser v-if="isHydrated.value" />
</div>
</div>

Wyświetl plik

@ -0,0 +1,17 @@
<script setup>
import { pwa } from '~/composables/pwa'
</script>
<template>
<button
v-if="pwa.needRefresh"
bg="fade" relative rounded
flex="~ gap-1 center" px3 py1 text-primary
@click="pwa.updateServiceWorker()"
>
<div i-ri-download-cloud-2-line />
<h2 flex="~ gap-2" items-center>
{{ $t('pwa.update_available_short') }}
</h2>
</button>
</template>

Wyświetl plik

@ -1,28 +1,22 @@
<script setup>
import { usePWA } from '~/composables/pwa'
const { close, needRefresh, updateServiceWorker } = usePWA()
import { pwa } from '~/composables/pwa'
</script>
<!-- TODO: remove shadow on mobile and position it above the bottom nav -->
<template>
<div
v-if="needRefresh"
role="alertdialog"
aria-labelledby="pwa-toast-title"
aria-describedby="pwa-toast-description"
v-if="pwa.needRefresh"
m-2 p5 bg="fade" relative
rounded-lg of-hidden
flex="~ col gap-3"
>
<h2 id="pwa-toast-title" flex="~ gap-2" items-center>
<h2 flex="~ gap-2" items-center>
{{ $t('pwa.title') }}
</h2>
<div flex="~ gap-1">
<button type="button" btn-solid px-4 py-1 text-center text-sm @click="updateServiceWorker()">
<button type="button" btn-solid px-4 py-1 text-center text-sm @click="pwa.updateServiceWorker()">
{{ $t('pwa.update') }}
</button>
<button type="button" btn-text filter-saturate-0 px-4 py-1 text-center text-sm @click="close()">
<button type="button" btn-text filter-saturate-0 px-4 py-1 text-center text-sm @click="pwa.close()">
{{ $t('pwa.dismiss') }}
</button>
</div>

Wyświetl plik

@ -44,3 +44,5 @@ export const usePWA = () => {
close,
}
}
export const pwa = reactive(usePWA())

Wyświetl plik

@ -53,7 +53,7 @@
<slot name="right">
<SearchWidget />
<div flex-auto />
<PWAPrompt />
<PwaPrompt />
<NavFooter />
</slot>
</div>

Wyświetl plik

@ -210,7 +210,8 @@
"message": "@:pwa.title{','} click on the @:pwa.reload button to update.",
"reload": "Reload",
"title": "New Elk update available!",
"update": "Update"
"update": "Update",
"update_available_short": "Update Elk"
},
"search": {
"search_desc": "Search for people & hashtags"