Spaces:
Build error
Build error
| /** | |
| * @license | |
| * SPDX-License-Identifier: Apache-2.0 | |
| */ | |
| /** | |
| * Copyright 2024 Google LLC | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software | |
| * distributed under the License is distributed on an "AS IS" BASIS, | |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| * See the License for the specific language governing permissions and | |
| * limitations under the License. | |
| */ | |
| import ControlTray from './components/console/control-tray/ControlTray'; | |
| import ErrorScreen from './components/demo/ErrorSreen'; | |
| import KeynoteCompanion from './components/demo/keynote-companion/KeynoteCompanion'; | |
| import Header from './components/Header'; | |
| import UserSettings from './components/UserSettings'; | |
| import AuthWrapper from './components/AuthWrapper'; | |
| import { LiveAPIProvider } from './contexts/LiveAPIContext'; | |
| import { AuthProvider } from './contexts/AuthContext'; | |
| import { DatabaseProvider } from './contexts/DatabaseContext'; | |
| import { useUI } from './lib/state'; | |
| const API_KEY = process.env.GEMINI_API_KEY as string; | |
| if (!API_KEY) { | |
| const errorElement = document.getElementById('root'); | |
| if(errorElement) { | |
| errorElement.innerHTML = `<div style="font-family: sans-serif; padding: 2rem; text-align: center;"><h1>Configuration Error</h1><p>Missing required environment variable: GEMINI_API_KEY</p><p>Please ask the application administrator to configure this.</p></div>`; | |
| } | |
| throw new Error( | |
| 'Missing required environment variable: GEMINI_API_KEY' | |
| ); | |
| } | |
| /** | |
| * Main application component that provides a streaming interface for Live API. | |
| * Manages video streaming state and provides controls for webcam/screen capture. | |
| */ | |
| function AppContent() { | |
| const { showUserConfig } = useUI(); | |
| return ( | |
| <div className="App"> | |
| <LiveAPIProvider apiKey={API_KEY}> | |
| <ErrorScreen /> | |
| <Header /> | |
| {showUserConfig && <UserSettings />} | |
| <div className="streaming-console"> | |
| <main> | |
| <div className="main-app-area"> | |
| <KeynoteCompanion /> | |
| </div> | |
| <ControlTray></ControlTray> | |
| </main> | |
| </div> | |
| </LiveAPIProvider> | |
| </div> | |
| ); | |
| } | |
| function App() { | |
| return ( | |
| <DatabaseProvider> | |
| <AuthProvider> | |
| <AuthWrapper> | |
| <AppContent /> | |
| </AuthWrapper> | |
| </AuthProvider> | |
| </DatabaseProvider> | |
| ); | |
| } | |
| export default App; |