Skip to content

Commit e1378ec

Browse files
fix: initial flash of view overlap (#249)
1 parent d353e31 commit e1378ec

File tree

5 files changed

+34
-23
lines changed

5 files changed

+34
-23
lines changed

app/(app)/layout.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ export default async function AppLayout({ children }: AppLayoutProps) {
1818
href="https://livekit.io"
1919
className="scale-100 transition-transform duration-300 hover:scale-110"
2020
>
21+
{/* eslint-disable-next-line @next/next/no-img-element */}
2122
<img src={logo} alt={`${companyName} Logo`} className="block size-6 dark:hidden" />
23+
{/* eslint-disable-next-line @next/next/no-img-element */}
2224
<img
2325
src={logoDark ?? logo}
2426
alt={`${companyName} Logo`}

app/(app)/opengraph-image.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ export default async function Image() {
165165
gap: 10,
166166
}}
167167
>
168+
{/* eslint-disable-next-line @next/next/no-img-element, jsx-a11y/alt-text */}
168169
<img src={wordmarkSrcBase64} width={wordmarkSize.width} height={wordmarkSize.height} />
169170
</div>
170171
{/* logo */}
@@ -178,6 +179,7 @@ export default async function Image() {
178179
gap: 10,
179180
}}
180181
>
182+
{/* eslint-disable-next-line @next/next/no-img-element, jsx-a11y/alt-text */}
181183
<img src={logoSrcBase64} width={logoSize.width} height={logoSize.height} />
182184
</div>
183185
{/* title */}

components/app.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,13 @@ export function App({ appConfig }: AppProps) {
7777
const { startButtonText } = appConfig;
7878

7979
return (
80-
<>
80+
<main>
8181
<MotionWelcome
8282
key="welcome"
8383
startButtonText={startButtonText}
8484
onStartCall={() => setSessionStarted(true)}
8585
disabled={sessionStarted}
86-
initial={{ opacity: 0 }}
86+
initial={{ opacity: 1 }}
8787
animate={{ opacity: sessionStarted ? 0 : 1 }}
8888
transition={{ duration: 0.5, ease: 'linear', delay: sessionStarted ? 0 : 0.5 }}
8989
/>
@@ -108,6 +108,6 @@ export function App({ appConfig }: AppProps) {
108108
</RoomContext.Provider>
109109

110110
<Toaster />
111-
</>
111+
</main>
112112
);
113113
}

components/session-view.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,15 @@ export const SessionView = ({
8989
};
9090

9191
return (
92-
<main
92+
<section
9393
ref={ref}
9494
inert={disabled}
95-
className={
95+
className={cn(
96+
'opacity-0',
9697
// prevent page scrollbar
9798
// when !chatOpen due to 'translate-y-20'
98-
cn(!chatOpen && 'max-h-svh overflow-hidden')
99-
}
99+
!chatOpen && 'max-h-svh overflow-hidden'
100+
)}
100101
>
101102
<ChatMessageView
102103
className={cn(
@@ -172,6 +173,6 @@ export const SessionView = ({
172173
<div className="from-background border-background absolute top-0 left-0 h-12 w-full -translate-y-full bg-gradient-to-t to-transparent" />
173174
</motion.div>
174175
</div>
175-
</main>
176+
</section>
176177
);
177178
};

components/welcome.tsx

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Button } from '@/components/ui/button';
2+
import { cn } from '@/lib/utils';
23

34
interface WelcomeProps {
45
disabled: boolean;
@@ -13,10 +14,13 @@ export const Welcome = ({
1314
ref,
1415
}: React.ComponentProps<'div'> & WelcomeProps) => {
1516
return (
16-
<div
17+
<section
1718
ref={ref}
1819
inert={disabled}
19-
className="fixed inset-0 z-10 mx-auto flex h-svh flex-col items-center justify-center text-center"
20+
className={cn(
21+
'bg-background fixed inset-0 mx-auto flex h-svh flex-col items-center justify-center text-center',
22+
disabled ? 'z-10' : 'z-20'
23+
)}
2024
>
2125
<svg
2226
width="64"
@@ -38,18 +42,20 @@ export const Welcome = ({
3842
<Button variant="primary" size="lg" onClick={onStartCall} className="mt-6 w-64 font-mono">
3943
{startButtonText}
4044
</Button>
41-
<p className="text-fg1 m fixed bottom-5 left-1/2 w-full max-w-prose -translate-x-1/2 pt-1 text-xs leading-5 font-normal text-pretty md:text-sm">
42-
Need help getting set up? Check out the{' '}
43-
<a
44-
target="_blank"
45-
rel="noopener noreferrer"
46-
href="https://docs.livekit.io/agents/start/voice-ai/"
47-
className="underline"
48-
>
49-
Voice AI quickstart
50-
</a>
51-
.
52-
</p>
53-
</div>
45+
<footer className="fixed bottom-5 left-0 z-20 flex w-full items-center justify-center">
46+
<p className="text-fg1 max-w-prose pt-1 text-xs leading-5 font-normal text-pretty md:text-sm">
47+
Need help getting set up? Check out the{' '}
48+
<a
49+
target="_blank"
50+
rel="noopener noreferrer"
51+
href="https://docs.livekit.io/agents/start/voice-ai/"
52+
className="underline"
53+
>
54+
Voice AI quickstart
55+
</a>
56+
.
57+
</p>
58+
</footer>
59+
</section>
5460
);
5561
};

0 commit comments

Comments
 (0)