perf: optimize pagespeed - lazy load app, fix video CLS and compress logo

This commit is contained in:
victormanuel.caverogracia 2026-09-07 11:30:31 +02:00
parent a602a2aa96
commit ca9ecd6e67
4 changed files with 32 additions and 12 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 266 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View file

@ -1,4 +1,5 @@
import React from 'react';
import { openConsentManager } from './lib/consent';
import { Sparkles, Zap, Globe, FileVideo, Subtitles, Youtube, Instagram, Shield, Github, ArrowRight, Check, ChevronDown, Monitor, Cpu, Languages, Type, Upload, Scissors, Link2, Bot } from 'lucide-react';
import PricingSection from './components/PricingSection';
import { useAuth } from './contexts/AuthContext';
@ -233,10 +234,10 @@ export default function Landing({ onLaunchApp }) {
{/* Navigation — N9 edge-aligned minimal */}
<nav className="fixed top-0 w-full z-50 bg-paper border-b border-rule">
<div className="max-w-6xl mx-auto px-6 py-4 flex items-center justify-between">
<div className="flex items-center gap-3">
<img src="/logo-openshorts.png" alt="OpenShorts logo" className="w-7 h-7" />
<span className="font-display text-lg lowercase text-ink">OpenShorts</span>
</div>
<a href="/" className="flex items-center gap-2.5 font-display text-xl lowercase text-ink tracking-tight">
<img src="/logo-openshorts.png" alt="OpenShorts logo" className="w-7 h-7" width="28" height="28" />
<span>openshorts</span>
</a>
<div className="hidden md:flex items-center gap-7 text-sm lowercase text-muted">
<a href="#features" className="hover:text-ink transition-colors">Features</a>
<a href="#how-it-works" className="hover:text-ink transition-colors">How It Works</a>
@ -394,7 +395,7 @@ export default function Landing({ onLaunchApp }) {
Real output: AI face tracking reframes 16:9 to vertical 9:16 — no manual positioning.
</SectionHeader>
<div className="flex flex-col md:flex-row items-center gap-8 md:gap-10">
<figure className="crop-frame w-full max-w-xl min-w-0" aria-label="original 16:9 source video">
<figure className="crop-frame crop-frame-16-9 w-full max-w-xl min-w-0" aria-label="original 16:9 source video">
<video
src="/demo/clip-source.mp4"
autoPlay
@ -408,7 +409,7 @@ export default function Landing({ onLaunchApp }) {
<span className="readout whitespace-nowrap">AI Tracking → 9:16</span>
<span className="crop-leader-line" />
</div>
<figure className="crop-frame w-[180px] md:w-[210px] flex-none" aria-label="vertical 9:16 clip generated by openshorts">
<figure className="crop-frame crop-frame-9-16 w-[180px] md:w-[210px] flex-none" aria-label="vertical 9:16 clip generated by openshorts">
<video
src="/demo/clip-vertical.mp4"
autoPlay
@ -799,6 +800,8 @@ export default function Landing({ onLaunchApp }) {
<a href="/legal-notice" className="hover:text-ink transition-colors whitespace-nowrap">Legal Notice</a>
<a href="/refunds" className="hover:text-ink transition-colors whitespace-nowrap">Refunds</a>
<a href="/report-content" className="hover:text-ink transition-colors whitespace-nowrap">Report Content</a>
{/* Withdrawing consent has to be as easy as giving it (GDPR art. 7.3). */}
<button type="button" onClick={openConsentManager} className="hover:text-ink transition-colors whitespace-nowrap lowercase">Cookies</button>
</div>
</div>
</div>

View file

@ -124,10 +124,17 @@
overflow: hidden;
background: var(--color-paper-2);
}
.crop-frame-16-9 {
aspect-ratio: 16 / 9;
}
.crop-frame-9-16 {
aspect-ratio: 9 / 16;
}
.crop-frame video {
display: block;
width: 100%;
height: auto;
height: 100%;
object-fit: cover;
}
.crop-window {
position: absolute;

View file

@ -1,15 +1,18 @@
import { StrictMode, useState, useEffect } from 'react'
import { StrictMode, useState, useEffect, lazy, Suspense } from 'react'
import { createRoot } from 'react-dom/client'
import './index.css'
import App from './App.jsx'
import Landing from './Landing.jsx'
import Legal from './Legal.jsx'
import { AuthProvider, useAuth } from './contexts/AuthContext'
import { capture as captureAttribution } from './lib/attribution'
import PricingPage from './components/PricingPage'
import AccountPage from './components/AccountPage'
import LoginModal from './components/LoginModal'
import OAuthConsent from './components/OAuthConsent'
import { applyConsent } from './lib/consent'
import CookieBanner from './components/CookieBanner'
const App = lazy(() => import('./App.jsx'))
const Legal = lazy(() => import('./Legal.jsx'))
const OAuthConsent = lazy(() => import('./components/OAuthConsent'))
function PageShell({ title, children }) {
return (
@ -112,10 +115,17 @@ function Root() {
// would destroy the referrer and any UTM params we still need to read.
captureAttribution();
// Start whatever the visitor previously agreed to. Nothing at all on a first
// visit: index.html only publishes the analytics initialiser, it never runs it.
applyConsent();
createRoot(document.getElementById('root')).render(
<StrictMode>
<AuthProvider>
<Suspense fallback={<div className="min-h-screen bg-paper flex items-center justify-center text-muted text-sm lowercase">loading…</div>}>
<Root />
</Suspense>
<CookieBanner />
</AuthProvider>
</StrictMode>,
)