import React, { useState } from 'react'; import { Button } from '@dailyjs/shared/components/Button'; import Field from '@dailyjs/shared/components/Field'; import { TextInput, BooleanInput } from '@dailyjs/shared/components/Input'; import MessageCard from '@dailyjs/shared/components/MessageCard'; import Image from 'next/image'; import PropTypes from 'prop-types'; import { ReactComponent as DailyLogo } from '../public/images/daily-logo.svg'; import SplashImage from '../public/images/splash.jpg'; export default function Index({ isConfigured, domain }) { const [fetching, setFetching] = useState(false); const [joinedAsOwner, setJoinAsOwner] = useState(false); const [roomName, setRoomName] = useState(); if (!isConfigured) { return (

Please ensure you have set both the DAILY_API_KEY and{' '} DAILY_DOMAIN environmental variables. An example can be found in the provided env.example file.

If you do not yet have a Daily developer account, please{' '} create one now . You can find your Daily API key on the{' '} developer page {' '} of the dashboard.

); } return (
); } Index.propTypes = { isConfigured: PropTypes.bool.isRequired, domain: PropTypes.string, }; export async function getStaticProps() { // Check that both domain and key env vars are set const isConfigured = !!process.env.DAILY_DOMAIN && !!process.env.DAILY_API_KEY; // Pass through domain as prop return { props: { domain: process.env.DAILY_DOMAIN || null, isConfigured }, }; }