Mobile only (<=639px / coarse pointers); desktop keeps its behaviour. Foundation - lib/motion.ts owns the spring presets (snappy/gentle/sheet), durations, easings and variants (screens, tabs, wizard steps, list stagger). - Native-feel CSS: press feedback scales every button, card, chip, tab, row and summary to 0.96 with a spring-like cubic-bezier on transform (scoped to phones/coarse pointers), tap-highlight off, touch-action manipulation, chrome text non-selectable, reduced motion drops it. - App shell fades in once on launch; the study feed fades in on phones. Applied - Tab bar: sliding active pill (shared layoutId) + icon bounce. - Study Decks/Homework, language toggle, difficulty and size pickers: the same gliding highlight, gated so desktop keeps the old styling. - Route content enters direction-aware (deeper = from the right, back = from the left, same-depth = crossfade) via RouteTransition on the library/create/homework content columns; library tab switches crossfade; wizard steps slide forward/backward (reduced motion safe). - Library: cards fade up in a capped stagger on first load, glide with layout animations and shrink away on delete (AnimatePresence). - Study feed: correct feedback pulses, wrong shakes, the progress bar settles with a spring curve, score and XP count up on the results. - Settings sheet uses the sheet spring; the drawer now follows the finger and closes on release velocity, like the sheet. - Generation progress: the stage message fades/slides between stages; the icon keeps its gentle wobble; the feed fades in on hand-off. Skipped, on purpose: LazyMotion (the sliding highlights need layout animations = domMax, same features the current import already has); route exit animations (the App Router unmounts the outgoing page — exits are handled by in-page AnimatePresence); replacing the study feed's native scroll-snap with finger-follow drag (would fight the platform scroller); finger-follow height animation for native <details> expanders. Verified: animation suite 8/8 (reduced motion + 4x-CPU-throttled trace: no long tasks, CLS 0.0000), regression 74/74, mobile 52/52, declutter 116/116, i18n 25/25. Lint + build clean. SW freezmo-v21.
89 lines
3.8 KiB
TypeScript
89 lines
3.8 KiB
TypeScript
import type { Metadata, Viewport } from "next";
|
|
|
|
import { IceBackdrop } from "@/components/IceBackdrop";
|
|
import { InstallSheet } from "@/components/InstallSheet";
|
|
import { ServiceWorkerRegistrar } from "@/components/ServiceWorkerRegistrar";
|
|
import "./globals.css";
|
|
|
|
export const metadata: Metadata = {
|
|
title: {
|
|
default: "Freezmo — turn your notes into a study feed",
|
|
template: "%s · Freezmo",
|
|
},
|
|
description:
|
|
"Freezmo turns photos and documents of your notes into a swipeable feed of short interactive study activities, powered by your own Ollama models.",
|
|
applicationName: "Freezmo",
|
|
manifest: "/manifest.webmanifest",
|
|
appleWebApp: {
|
|
capable: true,
|
|
title: "Freezmo",
|
|
statusBarStyle: "default",
|
|
},
|
|
icons: {
|
|
icon: [
|
|
// ?v=2 busts browser favicon caches after the icon redesign.
|
|
{ url: "/icons/favicon-32.png?v=2", sizes: "32x32", type: "image/png" },
|
|
{ url: "/icons/icon-192.png?v=2", sizes: "192x192", type: "image/png" },
|
|
{ url: "/icons/icon-512.png?v=2", sizes: "512x512", type: "image/png" },
|
|
],
|
|
apple: [
|
|
{ url: "/icons/apple-touch-icon.png?v=2", sizes: "180x180" },
|
|
{ url: "/icons/apple-touch-icon-167.png?v=2", sizes: "167x167" },
|
|
{ url: "/icons/apple-touch-icon-152.png?v=2", sizes: "152x152" },
|
|
],
|
|
},
|
|
other: {
|
|
// iOS standalone niceties
|
|
"apple-mobile-web-app-capable": "yes",
|
|
"mobile-web-app-capable": "yes",
|
|
"format-detection": "telephone=no",
|
|
},
|
|
};
|
|
|
|
export const viewport: Viewport = {
|
|
width: "device-width",
|
|
initialScale: 1,
|
|
// Phones: no pinch/double-tap zoom (the app-like feel). The input font-size
|
|
// rule in globals.css is what actually stops iOS Safari's focus auto-zoom,
|
|
// which ignores user-scalable=no.
|
|
maximumScale: 1,
|
|
userScalable: false,
|
|
viewportFit: "cover",
|
|
themeColor: [
|
|
{ media: "(prefers-color-scheme: light)", color: "#f4f7fd" },
|
|
{ media: "(prefers-color-scheme: dark)", color: "#0e1424" },
|
|
],
|
|
};
|
|
|
|
/**
|
|
* Applies the saved theme before paint to avoid a flash, and keeps the
|
|
* `theme-color` meta in step with the *app* theme (the SSR metas follow the
|
|
* OS preference, which is wrong once the user has picked a theme here).
|
|
*/
|
|
const themeScript = `(function(){try{var s=localStorage.getItem('freezmo.theme');var d=s?s==='dark':window.matchMedia('(prefers-color-scheme: dark)').matches;if(d)document.documentElement.classList.add('dark');var l=localStorage.getItem('freezmo.locale.v1');if(l==='cs'||l==='en')document.documentElement.lang=l;var m=document.querySelector('meta[name="theme-color"][data-app]');if(!m){m=document.createElement('meta');m.setAttribute('name','theme-color');m.setAttribute('data-app','1');document.head.insertBefore(m,document.head.firstChild);}m.setAttribute('content',d?'#0e1424':'#f4f7fd');}catch(e){}})();`;
|
|
|
|
/**
|
|
* Captures Chrome's `beforeinstallprompt` (it can fire before React hydrates)
|
|
* and records an install so the prompt never comes back. Static, no user data.
|
|
*/
|
|
const installScript = `(function(){try{
|
|
window.addEventListener('beforeinstallprompt',function(e){e.preventDefault();window.__freezmoInstallPrompt=e;window.dispatchEvent(new Event('freezmo:installprompt'));});
|
|
window.addEventListener('appinstalled',function(){try{localStorage.setItem('freezmo.install.installed','1')}catch(e){}window.dispatchEvent(new Event('freezmo:installed'));});
|
|
}catch(e){}})();`;
|
|
|
|
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
|
return (
|
|
<html lang="en" suppressHydrationWarning>
|
|
<head>
|
|
<script dangerouslySetInnerHTML={{ __html: themeScript }} />
|
|
<script dangerouslySetInnerHTML={{ __html: installScript }} />
|
|
</head>
|
|
<body className="min-h-full antialiased app-shell-in">
|
|
<IceBackdrop />
|
|
{children}
|
|
<InstallSheet />
|
|
<ServiceWorkerRegistrar />
|
|
</body>
|
|
</html>
|
|
);
|
|
}
|