mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
Mobile/PWA spacing fixes (#11403)
* spacing on mobile landscape * better icon placement when running as pwa * better icon placement when running as pwa * portrait padding only
This commit is contained in:
parent
76f822630d
commit
ba03d3b3e4
@ -9,6 +9,7 @@ import Bottombar from "./components/navigation/Bottombar";
|
|||||||
import { Suspense, lazy } from "react";
|
import { Suspense, lazy } from "react";
|
||||||
import { Redirect } from "./components/navigation/Redirect";
|
import { Redirect } from "./components/navigation/Redirect";
|
||||||
import { cn } from "./lib/utils";
|
import { cn } from "./lib/utils";
|
||||||
|
import { isPWA } from "./utils/isPWA";
|
||||||
|
|
||||||
const Live = lazy(() => import("@/pages/Live"));
|
const Live = lazy(() => import("@/pages/Live"));
|
||||||
const Events = lazy(() => import("@/pages/Events"));
|
const Events = lazy(() => import("@/pages/Events"));
|
||||||
@ -35,7 +36,7 @@ function App() {
|
|||||||
className={cn(
|
className={cn(
|
||||||
"absolute right-0 top-0 overflow-hidden",
|
"absolute right-0 top-0 overflow-hidden",
|
||||||
isMobile
|
isMobile
|
||||||
? "bottom-12 left-0 md:bottom-16 landscape:bottom-14 landscape:md:bottom-16"
|
? `bottom-${isPWA ? 16 : 12} left-0 md:bottom-16 landscape:bottom-14 landscape:md:bottom-16`
|
||||||
: "bottom-8 left-[52px]",
|
: "bottom-8 left-[52px]",
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
|
@ -16,6 +16,7 @@ import {
|
|||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
import { isMobile } from "react-device-detect";
|
import { isMobile } from "react-device-detect";
|
||||||
|
import { isPWA } from "@/utils/isPWA";
|
||||||
|
|
||||||
function Bottombar() {
|
function Bottombar() {
|
||||||
const navItems = useNavigation("secondary");
|
const navItems = useNavigation("secondary");
|
||||||
@ -23,8 +24,11 @@ function Bottombar() {
|
|||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={cn(
|
className={cn(
|
||||||
"absolute inset-x-4 bottom-0 flex flex-row items-center justify-between",
|
"absolute inset-x-4 bottom-0 flex h-16 flex-row justify-between",
|
||||||
isMobile ? "h-12 landscape:md:h-16" : "h-16",
|
isPWA
|
||||||
|
? "portrait:items-start portrait:pt-1 landscape:items-center"
|
||||||
|
: "items-center",
|
||||||
|
isMobile && !isPWA && "h-12 landscape:md:h-16",
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{navItems.map((item) => (
|
{navItems.map((item) => (
|
||||||
|
3
web/src/utils/isPWA.ts
Normal file
3
web/src/utils/isPWA.ts
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
export const isPWA =
|
||||||
|
("standalone" in window.navigator && window.navigator.standalone) ||
|
||||||
|
window.matchMedia("(display-mode: standalone)").matches;
|
@ -254,7 +254,7 @@ export default function EventView({
|
|||||||
return (
|
return (
|
||||||
<div className="flex size-full flex-col pt-2 md:py-2">
|
<div className="flex size-full flex-col pt-2 md:py-2">
|
||||||
<Toaster closeButton={true} />
|
<Toaster closeButton={true} />
|
||||||
<div className="relative mb-2 flex h-11 items-center justify-between pl-3 pr-2">
|
<div className="relative mb-2 flex h-11 items-center justify-between pl-2 pr-2 md:pl-3">
|
||||||
{isMobile && (
|
{isMobile && (
|
||||||
<Logo className="absolute inset-x-1/2 h-8 -translate-x-1/2" />
|
<Logo className="absolute inset-x-1/2 h-8 -translate-x-1/2" />
|
||||||
)}
|
)}
|
||||||
@ -602,7 +602,7 @@ function DetectionReview({
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
<div
|
<div
|
||||||
className="mx-2 grid w-full gap-2 px-1 sm:grid-cols-2 md:grid-cols-3 md:gap-4 3xl:grid-cols-4"
|
className="grid w-full gap-2 px-1 sm:grid-cols-2 md:mx-2 md:grid-cols-3 md:gap-4 3xl:grid-cols-4"
|
||||||
ref={contentRef}
|
ref={contentRef}
|
||||||
>
|
>
|
||||||
{!loading && currentItems
|
{!loading && currentItems
|
||||||
@ -922,7 +922,7 @@ function MotionReview({
|
|||||||
<div className="no-scrollbar flex flex-1 flex-wrap content-start gap-2 overflow-y-auto md:gap-4">
|
<div className="no-scrollbar flex flex-1 flex-wrap content-start gap-2 overflow-y-auto md:gap-4">
|
||||||
<div
|
<div
|
||||||
ref={contentRef}
|
ref={contentRef}
|
||||||
className="no-scrollbar mx-2 grid w-full gap-2 overflow-auto px-1 sm:grid-cols-2 md:gap-4 xl:grid-cols-3 3xl:grid-cols-4"
|
className="no-scrollbar grid w-full gap-2 overflow-auto px-1 sm:grid-cols-2 md:mx-2 md:gap-4 xl:grid-cols-3 3xl:grid-cols-4"
|
||||||
>
|
>
|
||||||
{reviewCameras.map((camera) => {
|
{reviewCameras.map((camera) => {
|
||||||
let grow;
|
let grow;
|
||||||
|
@ -227,7 +227,12 @@ export default function LiveDashboardView({
|
|||||||
|
|
||||||
{!cameraGroup || cameraGroup == "default" || isMobileOnly ? (
|
{!cameraGroup || cameraGroup == "default" || isMobileOnly ? (
|
||||||
<div
|
<div
|
||||||
className={`mt-2 grid px-2 ${mobileLayout == "grid" ? "grid-cols-2 xl:grid-cols-3 3xl:grid-cols-4" : ""} gap-2 md:gap-4`}
|
className={cn(
|
||||||
|
"mt-2 grid gap-2 px-2 md:gap-4",
|
||||||
|
mobileLayout == "grid" &&
|
||||||
|
"grid-cols-2 xl:grid-cols-3 3xl:grid-cols-4",
|
||||||
|
isMobile && "px-0",
|
||||||
|
)}
|
||||||
>
|
>
|
||||||
{includeBirdseye && birdseyeConfig?.enabled && (
|
{includeBirdseye && birdseyeConfig?.enabled && (
|
||||||
<BirdseyeLivePlayer
|
<BirdseyeLivePlayer
|
||||||
|
Loading…
Reference in New Issue
Block a user