Add (pwa)

This commit is contained in:
2023-09-25 00:08:16 +08:00
parent 8d7ae47036
commit cb4b7e9baa
84 changed files with 304 additions and 33 deletions

View File

@@ -1,4 +1,4 @@
const Ziggy = {"url":"https:\/\/echoscoop.com","port":null,"defaults":{},"routes":{"sanctum.csrf-cookie":{"uri":"sanctum\/csrf-cookie","methods":["GET","HEAD"]},"ignition.healthCheck":{"uri":"_ignition\/health-check","methods":["GET","HEAD"]},"ignition.executeSolution":{"uri":"_ignition\/execute-solution","methods":["POST"]},"ignition.updateConfig":{"uri":"_ignition\/update-config","methods":["POST"]},"feeds.main":{"uri":"feeds\/posts-feed","methods":["GET","HEAD"]},"front.home":{"uri":"\/","methods":["GET","HEAD"]},"front.terms":{"uri":"terms","methods":["GET","HEAD"]},"front.privacy":{"uri":"privacy","methods":["GET","HEAD"]},"front.disclaimer":{"uri":"disclaimer","methods":["GET","HEAD"]},"front.all":{"uri":"news","methods":["GET","HEAD"]},"front.post":{"uri":"news\/{slug}","methods":["GET","HEAD"]},"front.category":{"uri":"{category_slug}","methods":["GET","HEAD"]}}};
const Ziggy = {"url":"https:\/\/echoscoop.com","port":null,"defaults":{},"routes":{"sanctum.csrf-cookie":{"uri":"sanctum\/csrf-cookie","methods":["GET","HEAD"]},"laravelpwa.manifest":{"uri":"manifest.json","methods":["GET","HEAD"]},"laravelpwa.":{"uri":"offline","methods":["GET","HEAD"]},"ignition.healthCheck":{"uri":"_ignition\/health-check","methods":["GET","HEAD"]},"ignition.executeSolution":{"uri":"_ignition\/execute-solution","methods":["POST"]},"ignition.updateConfig":{"uri":"_ignition\/update-config","methods":["POST"]},"feeds.main":{"uri":"feeds\/posts-feed","methods":["GET","HEAD"]},"front.home":{"uri":"\/","methods":["GET","HEAD"]},"front.terms":{"uri":"terms","methods":["GET","HEAD"]},"front.privacy":{"uri":"privacy","methods":["GET","HEAD"]},"front.disclaimer":{"uri":"disclaimer","methods":["GET","HEAD"]},"front.all":{"uri":"news","methods":["GET","HEAD"]},"front.post":{"uri":"news\/{slug}","methods":["GET","HEAD"]},"front.category":{"uri":"{category_slug}","methods":["GET","HEAD"]}}};
if (typeof window !== 'undefined' && typeof window.Ziggy !== 'undefined') {
Object.assign(Ziggy.routes, window.Ziggy.routes);

View File

@@ -12,11 +12,6 @@
@include('feed::links')
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="manifest" href="/site.webmanifest">
@vite(['resources/sass/app-front.scss', 'resources/js/app-front.js'])
{{-- @laravelPWA --}}
@laravelPWA
@include('googletagmanager::head')

View File

@@ -1,30 +1,30 @@
@extends('front.layouts.app')
@section('content')
<main class="container">
@if(!is_null($featured_post))
<div class="p-4 p-md-5 mb-4 rounded text-body-emphasis bg-body-secondary">
<div class="col-lg-12 px-0">
<h1 class="display-4 fst-italic">{{ $featured_post->title }}</h1>
<p class="lead my-3">{{ $featured_post->excerpt }}</p>
<p class="lead mb-0"><a href="{{ route('front.post', ['slug' => $featured_post->slug]) }}"
class=" fw-bold">Continue reading...</a></p>
@if (!is_null($featured_post))
<div class="p-4 p-md-5 mb-4 rounded text-body-emphasis bg-body-secondary">
<div class="col-lg-12 px-0">
<h1 class="display-4 fst-italic">{{ $featured_post->title }}</h1>
<p class="lead my-3">{{ $featured_post->excerpt }}</p>
<p class="lead mb-0"><a href="{{ route('front.post', ['slug' => $featured_post->slug]) }}"
class=" fw-bold">Continue reading...</a></p>
</div>
</div>
</div>
@endif
<div class="row g-5">
<div class="col-md-8">
@if($latest_posts->count() > 0)
@foreach ($latest_posts as $post)
@include('front.partials.post_detail', ['post' => $post])
@endforeach
@if ($latest_posts->count() > 0)
@foreach ($latest_posts as $post)
@include('front.partials.post_detail', ['post' => $post])
@endforeach
<div class="w-100 d-flex justify-content-center">
<a class="btn btn-outline-primary rounded-pill px-3 text-decoration-none"
href="{{ route('front.all') }}">View Latest News</a>
</div>
<div class="w-100 d-flex justify-content-center">
<a class="btn btn-outline-primary rounded-pill px-3 text-decoration-none"
href="{{ route('front.all') }}">View Latest News</a>
</div>
@else
<div class="py-3 text-center">
<div class="mb-2">No posts found yet.</div>

View File

@@ -0,0 +1,67 @@
<!-- Web Application Manifest -->
<link rel="manifest" href="{{ route('laravelpwa.manifest') }}">
<!-- Chrome for Android theme color -->
<meta name="theme-color" content="{{ $config['theme_color'] }}">
<!-- Add to homescreen for Chrome on Android -->
<meta name="mobile-web-app-capable" content="{{ $config['display'] == 'standalone' ? 'yes' : 'no' }}">
<meta name="application-name" content="{{ $config['short_name'] }}">
<link rel="icon" sizes="{{ data_get(end($config['icons']), 'sizes') }}"
href="{{ data_get(end($config['icons']), 'src') }}">
<!-- Add to homescreen for Safari on iOS -->
<meta name="apple-mobile-web-app-capable" content="{{ $config['display'] == 'standalone' ? 'yes' : 'no' }}">
<meta name="apple-mobile-web-app-status-bar-style" content="{{ $config['status_bar'] }}">
<meta name="apple-mobile-web-app-title" content="{{ $config['short_name'] }}">
<link rel="apple-touch-icon" href="{{ data_get(end($config['icons']), 'src') }}">
<link href="{{ $config['splash']['640x1136'] }}"
media="(device-width: 320px) and (device-height: 568px) and (-webkit-device-pixel-ratio: 2)"
rel="apple-touch-startup-image" />
<link href="{{ $config['splash']['750x1334'] }}"
media="(device-width: 375px) and (device-height: 667px) and (-webkit-device-pixel-ratio: 2)"
rel="apple-touch-startup-image" />
<link href="{{ $config['splash']['1242x2208'] }}"
media="(device-width: 621px) and (device-height: 1104px) and (-webkit-device-pixel-ratio: 3)"
rel="apple-touch-startup-image" />
<link href="{{ $config['splash']['1125x2436'] }}"
media="(device-width: 375px) and (device-height: 812px) and (-webkit-device-pixel-ratio: 3)"
rel="apple-touch-startup-image" />
<link href="{{ $config['splash']['828x1792'] }}"
media="(device-width: 414px) and (device-height: 896px) and (-webkit-device-pixel-ratio: 2)"
rel="apple-touch-startup-image" />
<link href="{{ $config['splash']['1242x2688'] }}"
media="(device-width: 414px) and (device-height: 896px) and (-webkit-device-pixel-ratio: 3)"
rel="apple-touch-startup-image" />
<link href="{{ $config['splash']['1536x2048'] }}"
media="(device-width: 768px) and (device-height: 1024px) and (-webkit-device-pixel-ratio: 2)"
rel="apple-touch-startup-image" />
<link href="{{ $config['splash']['1668x2224'] }}"
media="(device-width: 834px) and (device-height: 1112px) and (-webkit-device-pixel-ratio: 2)"
rel="apple-touch-startup-image" />
<link href="{{ $config['splash']['1668x2388'] }}"
media="(device-width: 834px) and (device-height: 1194px) and (-webkit-device-pixel-ratio: 2)"
rel="apple-touch-startup-image" />
<link href="{{ $config['splash']['2048x2732'] }}"
media="(device-width: 1024px) and (device-height: 1366px) and (-webkit-device-pixel-ratio: 2)"
rel="apple-touch-startup-image" />
<!-- Tile for Win8 -->
<meta name="msapplication-TileColor" content="{{ $config['background_color'] }}">
<meta name="msapplication-TileImage" content="{{ data_get(end($config['icons']), 'src') }}">
<script type="text/javascript">
// Initialize the service worker
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('/serviceworker.js', {
scope: '.'
}).then(function(registration) {
// Registration was successful
console.log('Laravel PWA: ServiceWorker registration successful with scope: ', registration.scope);
}, function(err) {
// registration failed :(
console.log('Laravel PWA: ServiceWorker registration failed: ', err);
});
}
</script>

View File

@@ -0,0 +1,5 @@
@extends('layouts.app')
@section('content')
<h1>You are currently not connected to any networks.</h1>
@endsection