Skip to content

Commit 191e48c

Browse files
remove types file
1 parent fa07ce3 commit 191e48c

File tree

10 files changed

+43
-52
lines changed

10 files changed

+43
-52
lines changed

app-config.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,22 @@
1-
import type { AppConfig } from './lib/types';
1+
export interface AppConfig {
2+
pageTitle: string;
3+
pageDescription: string;
4+
companyName: string;
5+
6+
supportsChatInput: boolean;
7+
supportsVideoInput: boolean;
8+
supportsScreenShare: boolean;
9+
isPreConnectBufferEnabled: boolean;
10+
11+
logo: string;
12+
startButtonText: string;
13+
accent?: string;
14+
logoDark?: string;
15+
accentDark?: string;
16+
17+
sandboxId?: string;
18+
agentName?: string;
19+
}
220

321
export const APP_CONFIG_DEFAULTS: AppConfig = {
422
companyName: 'LiveKit',

app/api/connection-details/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +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';
4+
import type { ConnectionDetails } from '@/hooks/useConnectionDetails';
55

66
// NOTE: you are expected to define the following environment variables in `.env.local`:
77
const API_KEY = process.env.LIVEKIT_API_KEY;

app/ui/_room-provider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
import React from 'react';
44
import { Room } from 'livekit-client';
55
import { RoomContext } from '@livekit/components-react';
6+
import { AppConfig } from '@/app-config';
67
import { toastAlert } from '@/components/livekit/alert-toast';
78
import useConnectionDetails from '@/hooks/useConnectionDetails';
8-
import { AppConfig } from '@/lib/types';
99

1010
export function RoomProvider({
1111
appConfig,

components/app/app.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
import { AnimatePresence, motion } from 'motion/react';
44
import { RoomAudioRenderer, RoomContext, StartAudio } from '@livekit/components-react';
5+
import type { AppConfig } from '@/app-config';
56
import { SessionView } from '@/components/app/session-view';
67
import { Welcome } from '@/components/app/welcome';
78
import { Toaster } from '@/components/livekit/toaster';
89
import { useRoom } from '@/hooks/useRoom';
9-
import type { AppConfig } from '@/lib/types';
1010

1111
const MotionWelcome = motion.create(Welcome);
1212
const MotionSessionView = motion.create(SessionView);

components/app/session-view.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import React, { useState } from 'react';
44
import { motion } from 'motion/react';
5+
import type { AppConfig } from '@/app-config';
56
import { ChatTranscript } from '@/components/app/chat-transcript';
67
import { PreConnectMessage } from '@/components/app/preconnect-message';
78
import { TileLayout } from '@/components/app/tile-layout';
@@ -13,7 +14,6 @@ import { Skrim } from '@/components/livekit/skrim';
1314
import { useChatTranscriptions } from '@/hooks/useChatAndTranscription';
1415
import { useConnectionTimeout } from '@/hooks/useConnectionTimout';
1516
import { useDebugMode } from '@/hooks/useDebug';
16-
import type { AppConfig } from '@/lib/types';
1717
import { cn } from '@/lib/utils';
1818
import { ScrollArea } from '../livekit/scroll-area';
1919

components/app/theme-toggle.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import { useEffect, useState } from 'react';
44
import { MonitorIcon, MoonIcon, SunIcon } from '@phosphor-icons/react';
5-
import type { ThemeMode } from '@/lib/types';
65
import { THEME_MEDIA_QUERY, THEME_STORAGE_KEY, cn } from '@/lib/utils';
76

87
const THEME_SCRIPT = `
@@ -23,6 +22,8 @@ const THEME_SCRIPT = `
2322
.replace(/\n/g, '')
2423
.replace(/\s+/g, ' ');
2524

25+
export type ThemeMode = 'dark' | 'light' | 'system';
26+
2627
function applyTheme(theme: ThemeMode) {
2728
const doc = document.documentElement;
2829

hooks/useConnectionDetails.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
import { useCallback, useEffect, useState } from 'react';
22
import { decodeJwt } from 'jose';
3-
import type { AppConfig, ConnectionDetails } from '@/lib/types';
3+
import type { AppConfig } from '@/app-config';
44

55
const ONE_MINUTE_IN_MILLISECONDS = 60 * 1000;
66

7+
export type ConnectionDetails = {
8+
serverUrl: string;
9+
roomName: string;
10+
participantName: string;
11+
participantToken: string;
12+
};
13+
714
export default function useConnectionDetails(appConfig: AppConfig) {
815
// Generate room connection details, including:
916
// - A random Room name

hooks/useRoom.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { useEffect, useMemo, useState } from 'react';
22
import { Room, RoomEvent } from 'livekit-client';
3+
import { AppConfig } from '@/app-config';
34
import { toastAlert } from '@/components/livekit/alert-toast';
45
import useConnectionDetails from '@/hooks/useConnectionDetails';
5-
import { AppConfig } from '@/lib/types';
66

77
export function useRoom(appConfig: AppConfig) {
88
const room = useMemo(() => new Room(), []);

lib/types.ts

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

lib/utils.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,22 @@ import { cache } from 'react';
22
import { type ClassValue, clsx } from 'clsx';
33
import { twMerge } from 'tailwind-merge';
44
import { APP_CONFIG_DEFAULTS } from '@/app-config';
5-
import type { AppConfig, SandboxConfig } from './types';
5+
import type { AppConfig } from '@/app-config';
66

77
export const CONFIG_ENDPOINT = process.env.NEXT_PUBLIC_APP_CONFIG_ENDPOINT;
88
export const SANDBOX_ID = process.env.SANDBOX_ID;
99

1010
export const THEME_STORAGE_KEY = 'theme-mode';
1111
export const THEME_MEDIA_QUERY = '(prefers-color-scheme: dark)';
1212

13+
export interface SandboxConfig {
14+
[key: string]:
15+
| { type: 'string'; value: string }
16+
| { type: 'number'; value: number }
17+
| { type: 'boolean'; value: boolean }
18+
| null;
19+
}
20+
1321
export function cn(...inputs: ClassValue[]) {
1422
return twMerge(clsx(inputs));
1523
}

0 commit comments

Comments
 (0)