Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions resources/js/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,6 @@ import { initPwa } from './lib/usePwa';

const appName = import.meta.env.VITE_APP_NAME || 'Laravel';

// Apply dark mode before paint to prevent flash
const stored = localStorage.getItem('theme');

if (
stored === 'dark' ||
(stored !== 'light' &&
window.matchMedia('(prefers-color-scheme: dark)').matches)
) {
document.documentElement.classList.add('dark');
}

registerSW({ immediate: true });
initPwa();

Expand Down
1 change: 1 addition & 0 deletions resources/js/components/BaseModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ onBeforeUnmount(() => {
v-if="isOpen"
role="dialog"
aria-modal="true"
:aria-label="title || 'Modal dialog'"
class="fixed inset-0 z-50 flex justify-center"
:class="[
position === 'responsive'
Expand Down
6 changes: 6 additions & 0 deletions resources/js/components/NoticeDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ const close = () => {
<div
class="relative w-full max-w-md overflow-hidden rounded-3xl bg-white shadow-xl ring-1 ring-slate-900/5 dark:bg-gray-900 dark:ring-gray-700/50"
role="alertdialog"
aria-modal="true"
:aria-labelledby="
notice.title ? 'notice-dialog-title' : undefined
"
:aria-label="notice.title ? undefined : 'Notice'"
>
<button
@click="close"
Expand All @@ -94,6 +99,7 @@ const close = () => {
<div class="p-6">
<h2
v-if="notice.title"
id="notice-dialog-title"
class="text-lg font-semibold text-slate-900 dark:text-gray-100"
>
{{ notice.title }}
Expand Down
2 changes: 2 additions & 0 deletions resources/js/components/PwaInstallPrompt.vue
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ const handleDismiss = () => {
class="fixed inset-0 z-50 flex items-end justify-center p-4 sm:items-center sm:p-6"
role="dialog"
aria-modal="true"
aria-labelledby="pwa-install-dialog-title"
>
<!-- Backdrop -->
<div
Expand Down Expand Up @@ -130,6 +131,7 @@ const handleDismiss = () => {
</div>
<div class="min-w-0 flex-1 pr-3">
<h3
id="pwa-install-dialog-title"
class="text-base font-bold text-slate-900 sm:text-lg dark:text-gray-100"
>
{{ title }}
Expand Down
2 changes: 0 additions & 2 deletions resources/js/pages/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ const filteredSubjects = computed(() => {

<NoticeDialog v-if="notice" :notice="notice" />

<PwaInstallPrompt v-if="!notice" variant="modal" />

<HomeHeader />

<main class="mx-auto max-w-7xl px-4 pb-20 sm:px-6">
Expand Down
16 changes: 16 additions & 0 deletions resources/views/app.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}" @class(['dark' => ($appearance ?? 'system') == 'dark'])>
<head>
<meta charset="utf-8">
<script>
(function () {
try {
var stored = localStorage.getItem('theme');
var isDark =
stored === 'dark' ||
(stored !== 'light' &&
window.matchMedia('(prefers-color-scheme: dark)').matches);
if (isDark) {
document.documentElement.classList.add('dark');
} else {
document.documentElement.classList.remove('dark');
}
} catch (_) {}
})();
</script>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{ csrf_token() }}">
<link rel="manifest" href="/build/manifest.webmanifest">
Expand Down