Skip to content

Commit 3848211

Browse files
--wip-- [skip ci]
1 parent 8c48f59 commit 3848211

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1045
-950
lines changed

app-config.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,4 @@ export const APP_CONFIG_DEFAULTS: AppConfig = {
1515
logoDark: '/lk-logo-dark.svg',
1616
accentDark: '#1fd5f9',
1717
startButtonText: 'Start call',
18-
19-
agentName: undefined,
2018
};

app/(app)/layout.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { headers } from 'next/headers';
22
import { getAppConfig } from '@/lib/utils';
33

4-
interface AppLayoutProps {
4+
interface LayoutProps {
55
children: React.ReactNode;
66
}
77

8-
export default async function AppLayout({ children }: AppLayoutProps) {
8+
export default async function Layout({ children }: LayoutProps) {
99
const hdrs = await headers();
1010
const { companyName, logo, logoDark } = await getAppConfig(hdrs);
1111

@@ -39,6 +39,7 @@ export default async function AppLayout({ children }: AppLayoutProps) {
3939
</a>
4040
</span>
4141
</header>
42+
4243
{children}
4344
</>
4445
);

app/api/connection-details/route.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { NextResponse } from 'next/server';
22
import { AccessToken, type AccessTokenOptions, type VideoGrant } from 'livekit-server-sdk';
33
import { RoomConfiguration } from '@livekit/protocol';
4+
import type { ConnectionDetails } from '@/lib/types';
45

56
// NOTE: you are expected to define the following environment variables in `.env.local`:
67
const API_KEY = process.env.LIVEKIT_API_KEY;
@@ -10,13 +11,6 @@ const LIVEKIT_URL = process.env.LIVEKIT_URL;
1011
// don't cache the results
1112
export const revalidate = 0;
1213

13-
export type ConnectionDetails = {
14-
serverUrl: string;
15-
roomName: string;
16-
participantName: string;
17-
participantToken: string;
18-
};
19-
2014
export async function POST(req: Request) {
2115
try {
2216
if (LIVEKIT_URL === undefined) {

app/components/Tabs.tsx

Lines changed: 0 additions & 33 deletions
This file was deleted.

app/layout.tsx

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
11
import { Public_Sans } from 'next/font/google';
22
import localFont from 'next/font/local';
33
import { headers } from 'next/headers';
4-
import { APP_CONFIG_DEFAULTS } from '@/app-config';
5-
import { ApplyThemeScript, ThemeToggle } from '@/components/theme-toggle';
6-
import { getAppConfig } from '@/lib/utils';
7-
import './globals.css';
4+
import { ApplyThemeScript, ThemeToggle } from '@/components/livekit/theme-toggle';
5+
import { cn, getAppConfig, getStyles } from '@/lib/utils';
6+
import '@/styles/globals.css';
87

98
const publicSans = Public_Sans({
109
variable: '--font-public-sans',
1110
subsets: ['latin'],
1211
});
1312

1413
const commitMono = localFont({
14+
display: 'swap',
15+
variable: '--font-commit-mono',
1516
src: [
1617
{
17-
path: './fonts/CommitMono-400-Regular.otf',
18+
path: '../fonts/CommitMono-400-Regular.otf',
1819
weight: '400',
1920
style: 'normal',
2021
},
2122
{
22-
path: './fonts/CommitMono-700-Regular.otf',
23+
path: '../fonts/CommitMono-700-Regular.otf',
2324
weight: '700',
2425
style: 'normal',
2526
},
2627
{
27-
path: './fonts/CommitMono-400-Italic.otf',
28+
path: '../fonts/CommitMono-400-Italic.otf',
2829
weight: '400',
2930
style: 'italic',
3031
},
3132
{
32-
path: './fonts/CommitMono-700-Italic.otf',
33+
path: '../fonts/CommitMono-700-Italic.otf',
3334
weight: '700',
3435
style: 'italic',
3536
},
3637
],
37-
variable: '--font-commit-mono',
3838
});
3939

4040
interface RootLayoutProps {
@@ -43,32 +43,27 @@ interface RootLayoutProps {
4343

4444
export default async function RootLayout({ children }: RootLayoutProps) {
4545
const hdrs = await headers();
46-
const { accent, accentDark, pageTitle, pageDescription } = await getAppConfig(hdrs);
47-
48-
// check provided accent colors against defaults, and apply styles if they differ (or in development mode)
49-
// generate a hover color for the accent color by mixing it with 20% black
50-
const styles = [
51-
process.env.NODE_ENV === 'development' || accent !== APP_CONFIG_DEFAULTS.accent
52-
? `:root { --primary: ${accent}; --primary-hover: color-mix(in srgb, ${accent} 80%, #000); }`
53-
: '',
54-
process.env.NODE_ENV === 'development' || accentDark !== APP_CONFIG_DEFAULTS.accentDark
55-
? `.dark { --primary: ${accentDark}; --primary-hover: color-mix(in srgb, ${accentDark} 80%, #000); }`
56-
: '',
57-
]
58-
.filter(Boolean)
59-
.join('\n');
46+
const appConfig = await getAppConfig(hdrs);
47+
const { pageTitle, pageDescription } = appConfig;
48+
const styles = getStyles(appConfig);
6049

6150
return (
62-
<html lang="en" suppressHydrationWarning className="scroll-smooth">
51+
<html
52+
lang="en"
53+
suppressHydrationWarning
54+
className={cn(
55+
publicSans.variable,
56+
commitMono.variable,
57+
'scroll-smooth font-sans antialiased'
58+
)}
59+
>
6360
<head>
6461
{styles && <style>{styles}</style>}
6562
<title>{pageTitle}</title>
6663
<meta name="description" content={pageDescription} />
6764
<ApplyThemeScript />
6865
</head>
69-
<body
70-
className={`${publicSans.variable} ${commitMono.variable} overflow-x-hidden antialiased`}
71-
>
66+
<body className="overflow-x-hidden">
7267
{children}
7368
<div className="group fixed bottom-0 left-1/2 z-50 mb-2 -translate-x-1/2">
7469
<ThemeToggle className="translate-y-20 transition-transform delay-150 duration-300 group-hover:translate-y-0" />
Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,18 @@ import {
99
SelectValue,
1010
} from '@/components/ui/select';
1111
import { Toggle } from '@/components/ui/toggle';
12-
import { Container } from '../Container';
12+
import { Container } from '../container';
1313

14-
const buttonVariants = ['default', 'secondary', 'outline', 'ghost', 'link', 'destructive'] as const;
15-
const toggleVariants = ['default', 'outline'] as const;
14+
const buttonVariants = [
15+
'default',
16+
'primary',
17+
'secondary',
18+
'outline',
19+
'ghost',
20+
'link',
21+
'destructive',
22+
] as const;
23+
const toggleVariants = ['default', 'primary', 'secondary', 'outline'] as const;
1624
const alertVariants = ['default', 'destructive'] as const;
1725

1826
export default function Base() {
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import * as React from 'react';
22
import { headers } from 'next/headers';
3-
import { Tabs } from '@/app/components/Tabs';
4-
import { Provider } from '@/components/provider';
5-
import { cn, getAppConfig } from '@/lib/utils';
3+
import { getAppConfig } from '@/lib/utils';
4+
import { RoomProvider } from './room-provider';
5+
import { Tabs } from './tabs';
66

77
export default async function ComponentsLayout({ children }: { children: React.ReactNode }) {
88
const hdrs = await headers();
@@ -16,9 +16,9 @@ export default async function ComponentsLayout({ children }: { children: React.R
1616
</p>
1717
</header>
1818
<Tabs />
19-
<Provider appConfig={appConfig}>
19+
<RoomProvider appConfig={appConfig}>
2020
<main className="flex w-full flex-1 flex-col items-stretch gap-8">{children}</main>
21-
</Provider>
21+
</RoomProvider>
2222
</div>
2323
);
2424
}
Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { Track } from 'livekit-client';
22
import { AgentControlBar } from '@/components/livekit/agent-control-bar/agent-control-bar';
3-
import { DeviceSelect } from '@/components/livekit/device-select';
3+
import { TrackDeviceSelect } from '@/components/livekit/track-device-select';
44
import { TrackToggle } from '@/components/livekit/track-toggle';
5-
import { Container } from '../Container';
5+
import { AppConfig } from '@/lib/types';
6+
import { Container } from '../container';
67

78
export default function LiveKit() {
89
return (
@@ -15,11 +16,11 @@ export default function LiveKit() {
1516
<div className="grid grid-cols-2 gap-4">
1617
<div>
1718
<h4 className="text-muted-foreground mb-2 font-mono text-xs uppercase">Size default</h4>
18-
<DeviceSelect kind="audioinput" />
19+
<TrackDeviceSelect kind="audioinput" />
1920
</div>
2021
<div>
2122
<h4 className="text-muted-foreground mb-2 font-mono text-xs uppercase">Size sm</h4>
22-
<DeviceSelect size="sm" kind="audioinput" />
23+
<TrackDeviceSelect size="sm" kind="audioinput" />
2324
</div>
2425
</div>
2526
</Container>
@@ -53,10 +54,12 @@ export default function LiveKit() {
5354
<div className="relative flex items-center justify-center">
5455
<AgentControlBar
5556
className="w-full"
56-
capabilities={{
57-
supportsChatInput: true,
58-
supportsVideoInput: true,
59-
supportsScreenShare: true,
57+
controls={{
58+
leave: true,
59+
chat: true,
60+
camera: true,
61+
microphone: true,
62+
screenShare: true,
6063
}}
6164
/>
6265
</div>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { redirect } from 'next/navigation';
22

33
export default function Components() {
4-
return redirect('/components/base');
4+
return redirect('/ui/base');
55
}

0 commit comments

Comments
 (0)