Merge pull request 'more pwa' (#9) from development into main
Reviewed-on: #9
This commit is contained in:
@@ -45,18 +45,18 @@ export const Route = createRootRouteWithContext<{
|
|||||||
{ name: 'description', content: 'Amicus meus madidus' },
|
{ name: 'description', content: 'Amicus meus madidus' },
|
||||||
{ name: 'keywords', content: 'FLXN, beer pong, tournament, sports, statistics, pong' },
|
{ name: 'keywords', content: 'FLXN, beer pong, tournament, sports, statistics, pong' },
|
||||||
{ name: 'theme-color', content: '#1e293b' },
|
{ name: 'theme-color', content: '#1e293b' },
|
||||||
{ property: 'og:title', content: 'FLXN IX' },
|
{ property: 'og:title', content: 'FLXN' },
|
||||||
{ property: 'og:description', content: 'Register for FLXN IX and view FLXN stats' },
|
{ property: 'og:description', content: 'Amicus meus madidus' },
|
||||||
{ property: 'og:url', content: 'https://flexxon.app' },
|
{ property: 'og:url', content: 'https://flexxon.app' },
|
||||||
{ property: 'og:type', content: 'website' },
|
{ property: 'og:type', content: 'website' },
|
||||||
{ property: 'og:site_name', content: 'FLXN IX' },
|
{ property: 'og:site_name', content: 'FLXN' },
|
||||||
{ property: 'og:image', content: 'https://flexxon.app/favicon.png' },
|
{ property: 'og:image', content: 'https://flexxon.app/favicon.png' },
|
||||||
{ property: 'og:image:width', content: '512' },
|
{ property: 'og:image:width', content: '512' },
|
||||||
{ property: 'og:image:height', content: '512' },
|
{ property: 'og:image:height', content: '512' },
|
||||||
{ property: 'og:image:alt', content: 'FLXN logo' },
|
{ property: 'og:image:alt', content: 'FLXN logo' },
|
||||||
{ property: 'og:locale', content: 'en_US' },
|
{ property: 'og:locale', content: 'en_US' },
|
||||||
{ name: 'twitter:card', content: 'summary' },
|
{ name: 'twitter:card', content: 'summary' },
|
||||||
{ name: 'twitter:title', content: 'FLXN IX' },
|
{ name: 'twitter:title', content: 'FLXN' },
|
||||||
{ name: 'twitter:description', content: 'Amicus meus madidus' },
|
{ name: 'twitter:description', content: 'Amicus meus madidus' },
|
||||||
{ name: 'twitter:image', content: 'https://flexxon.app/favicon.png' },
|
{ name: 'twitter:image', content: 'https://flexxon.app/favicon.png' },
|
||||||
{ name: 'mobile-web-app-capable', content: 'yes' },
|
{ name: 'mobile-web-app-capable', content: 'yes' },
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
import { AppShell, ScrollArea, Stack, Group, Paper, useMantineColorScheme } from "@mantine/core";
|
import { AppShell, ScrollArea, Stack, Group, Paper, useMantineColorScheme } from "@mantine/core";
|
||||||
import { Link } from "@tanstack/react-router";
|
|
||||||
import { NavLink } from "./nav-link";
|
import { NavLink } from "./nav-link";
|
||||||
import { useIsMobile } from "@/hooks/use-is-mobile";
|
import { useIsMobile } from "@/hooks/use-is-mobile";
|
||||||
import { useAuth } from "@/contexts/auth-context";
|
import { useAuth } from "@/contexts/auth-context";
|
||||||
import { useLinks } from "../hooks/use-links";
|
import { useLinks } from "../hooks/use-links";
|
||||||
import { memo } from "react";
|
import { memo } from "react";
|
||||||
|
import { useIsPWA } from "@/hooks/use-is-pwa";
|
||||||
|
|
||||||
const Navbar = () => {
|
const Navbar = () => {
|
||||||
const { user, roles } = useAuth()
|
const { user, roles } = useAuth()
|
||||||
const isMobile = useIsMobile();
|
const isMobile = useIsMobile();
|
||||||
const { colorScheme } = useMantineColorScheme();
|
const { colorScheme } = useMantineColorScheme();
|
||||||
|
const isPWA = useIsPWA();
|
||||||
|
|
||||||
const links = useLinks(user?.id, roles);
|
const links = useLinks(user?.id, roles);
|
||||||
|
|
||||||
@@ -19,7 +20,7 @@ const Navbar = () => {
|
|||||||
// boxShadow: `5px 5px ${boxShadowColor}`, borderColor
|
// boxShadow: `5px 5px ${boxShadowColor}`, borderColor
|
||||||
|
|
||||||
if (isMobile) return (
|
if (isMobile) return (
|
||||||
<Paper component='nav' role='navigation' withBorder shadow="sm" radius='lg' h='4rem' w='calc(100% - 1rem)' pos='fixed' m='0.5rem' bottom='0' style={{ zIndex: 10 }}>
|
<Paper component='nav' role='navigation' withBorder shadow="sm" radius='lg' h='4rem' w='calc(100% - 1rem)' pos='fixed' m='0.5rem' bottom={isPWA ? '1rem' : '0'} style={{ zIndex: 10 }}>
|
||||||
<Group gap='xs' justify='space-around' h='100%' w='100%' px={{ base: 12, sm: 0 }}>
|
<Group gap='xs' justify='space-around' h='100%' w='100%' px={{ base: 12, sm: 0 }}>
|
||||||
{links.map((link) => (
|
{links.map((link) => (
|
||||||
<NavLink key={link.href} {...link} />
|
<NavLink key={link.href} {...link} />
|
||||||
|
|||||||
@@ -1,15 +1,14 @@
|
|||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react';
|
||||||
|
|
||||||
export function useIsPWA(): boolean {
|
export function useIsPWA(): boolean {
|
||||||
const [isPWA, setIsPWA] = useState(false)
|
const [isPWA, setIsPWA] = useState(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const isStandalone = window.matchMedia('(display-mode: standalone)').matches
|
const isStandalone = window.matchMedia('(display-mode: standalone)').matches;
|
||||||
|
const isIOSStandalone = 'standalone' in window.navigator && (window.navigator as any).standalone;
|
||||||
|
|
||||||
const isIOSStandalone = 'standalone' in window.navigator && (window.navigator as any).standalone
|
setIsPWA(isStandalone || isIOSStandalone);
|
||||||
|
}, []);
|
||||||
|
|
||||||
setIsPWA(isStandalone || isIOSStandalone)
|
return isPWA;
|
||||||
}, [])
|
|
||||||
|
|
||||||
return isPWA
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user