diff --git a/dailyjs/live-fitness/.babelrc b/dailyjs/live-fitness/.babelrc deleted file mode 100644 index a6f4434..0000000 --- a/dailyjs/live-fitness/.babelrc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "presets": ["next/babel"], - "plugins": ["inline-react-svg"] -} diff --git a/dailyjs/live-fitness/README.md b/dailyjs/live-fitness/README.md deleted file mode 100644 index ed0d0e2..0000000 --- a/dailyjs/live-fitness/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# Live Fitness - -Brings together - -- Live streaming -- Recording -- Flying emojis -- Pagination / track management -- Text chat diff --git a/dailyjs/live-fitness/components/App/App.js b/dailyjs/live-fitness/components/App/App.js deleted file mode 100644 index c7fecb6..0000000 --- a/dailyjs/live-fitness/components/App/App.js +++ /dev/null @@ -1,32 +0,0 @@ -import React from 'react'; - -import App from '@dailyjs/basic-call/components/App'; -import FlyingEmojiOverlay from '@dailyjs/flying-emojis/components/FlyingEmojis'; -import { LiveStreamingProvider } from '@dailyjs/live-streaming/contexts/LiveStreamingProvider'; -import { RecordingProvider } from '@dailyjs/recording/contexts/RecordingProvider'; -import { ChatProvider } from '@dailyjs/text-chat/contexts/ChatProvider'; -import { ClassStateProvider } from '../../context/ClassStateProvider'; -import Room from '../Room'; - -/** - * We'll pass through our own custom Room for this example - * as the layout logic changes considerably for the basic demo - */ -export const LiveFitnessApp = () => ( - - - - - - , - }} - /> - - - - -); - -export default LiveFitnessApp; diff --git a/dailyjs/live-fitness/components/App/index.js b/dailyjs/live-fitness/components/App/index.js deleted file mode 100644 index 63c0538..0000000 --- a/dailyjs/live-fitness/components/App/index.js +++ /dev/null @@ -1 +0,0 @@ -export { LiveFitnessApp as default } from './App'; diff --git a/dailyjs/live-fitness/components/Room/Header.js b/dailyjs/live-fitness/components/Room/Header.js deleted file mode 100644 index 1d14da8..0000000 --- a/dailyjs/live-fitness/components/Room/Header.js +++ /dev/null @@ -1,44 +0,0 @@ -import React, { useMemo } from 'react'; -import Button from '@dailyjs/shared/components/Button'; -import HeaderCapsule from '@dailyjs/shared/components/HeaderCapsule'; -import { useParticipants } from '@dailyjs/shared/contexts/ParticipantsProvider'; - -export const Header = () => { - const { participantCount } = useParticipants(); - - return useMemo( - () => ( -
- Daily - - - {`${participantCount} ${ - participantCount === 1 ? 'participant' : 'participants' - }`} - - - - -
- ), - [participantCount] - ); -}; - -export default Header; diff --git a/dailyjs/live-fitness/components/Room/Room.js b/dailyjs/live-fitness/components/Room/Room.js deleted file mode 100644 index f6aa109..0000000 --- a/dailyjs/live-fitness/components/Room/Room.js +++ /dev/null @@ -1,14 +0,0 @@ -import React from 'react'; - -import { RoomContainer } from '@dailyjs/basic-call/components/Room/RoomContainer'; -import { VideoContainer } from '@dailyjs/shared/components/VideoContainer'; -import { Header } from './Header'; - -export const Room = () => ( - -
- Hello - -); - -export default RoomContainer; diff --git a/dailyjs/live-fitness/components/Room/index.js b/dailyjs/live-fitness/components/Room/index.js deleted file mode 100644 index ebab667..0000000 --- a/dailyjs/live-fitness/components/Room/index.js +++ /dev/null @@ -1 +0,0 @@ -export { Room as default } from './Room'; diff --git a/dailyjs/live-fitness/components/Splash/Splash.js b/dailyjs/live-fitness/components/Splash/Splash.js deleted file mode 100644 index 93068e8..0000000 --- a/dailyjs/live-fitness/components/Splash/Splash.js +++ /dev/null @@ -1,221 +0,0 @@ -import React, { useState } from 'react'; - -import Button from '@dailyjs/shared/components/Button'; -import Loader from '@dailyjs/shared/components/Loader'; -import { Well } from '@dailyjs/shared/components/Well'; -import PropTypes from 'prop-types'; - -/** - * Splash - * --- - * - Checks our app is configured properly - * - Creates a new Daily room for this session - * - Calls the onJoin method with the room name and instructor (owner) status - */ -export const Splash = ({ onJoin, isConfigured }) => { - const [fetching, setFetching] = useState(false); - const [error, setError] = useState(false); - - async function createRoom(asInstructor) { - // Create a new room for this class - setError(false); - setFetching(true); - - console.log(`🚪 Creating new demo room...`); - - // Create a room server side (using Next JS serverless) - const res = await fetch('/api/createRoom', { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - body: JSON.stringify({ - privacy: 'private', - expiryMinutes: 10, - }), - }); - - const resJson = await res.json(); - - if (resJson.name) { - onJoin(resJson.name, asInstructor); - return; - } - - setError(resJson.error || 'An unknown error occured'); - setFetching(false); - } - - return ( -
- - -
- Daily - -
- {(() => { - // Application is not yet configured (there are missing globals, such as domain and dev key) - if (!isConfigured) - return ( - <> -

Not configured

-

- 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. -

- - ); - - // There was an error creating the room - if (error) - return ( -
- {error} - An error occured when trying to create a demo room. Please - check that your environmental variables are correct and try - again. -
- ); - - // Loader whilst we create the room - if (fetching) - return ( - <> -

Creating room, please wait...

- - ); - - // Introductory splash screen - return ( - <> -

Live fitness example

-

- This example demonstrates how to use Daily JS to create a live - class experience. Please be sure to reference the project - readme first. -

-

- Note: all rooms created with this demo will have a 5 minute - expiry time. If you would like to create a longer running - room, please set the DAILY_ROOM environmental - variable to use your own custom room. -

-
-
- - -
- - ); - })()} -
-
- -
- ); -}; - -Splash.propTypes = { - onJoin: PropTypes.func, - isConfigured: PropTypes.bool, -}; - -export default Splash; diff --git a/dailyjs/live-fitness/components/Splash/index.js b/dailyjs/live-fitness/components/Splash/index.js deleted file mode 100644 index 13f6bd9..0000000 --- a/dailyjs/live-fitness/components/Splash/index.js +++ /dev/null @@ -1 +0,0 @@ -export { Splash as default } from './Splash'; diff --git a/dailyjs/live-fitness/components/Tray/Tray.js b/dailyjs/live-fitness/components/Tray/Tray.js deleted file mode 100644 index 565eb14..0000000 --- a/dailyjs/live-fitness/components/Tray/Tray.js +++ /dev/null @@ -1,30 +0,0 @@ -import React from 'react'; -import FlyingEmojiTrayButton from '@dailyjs/flying-emojis/components/Tray'; -import LiveStreamingButton from '@dailyjs/live-streaming/components/Tray'; -import RecordingButton from '@dailyjs/recording/components/Tray'; -import { useParticipants } from '@dailyjs/shared/contexts/ParticipantsProvider'; -import ChatTrayButton from '@dailyjs/text-chat/components/Tray'; - -export const Tray = () => { - const { isOwner } = useParticipants(); - - if (isOwner) { - return ( - <> - - - - - - ); - } - - return ( - <> - - - - ); -}; - -export default Tray; diff --git a/dailyjs/live-fitness/components/Tray/index.js b/dailyjs/live-fitness/components/Tray/index.js deleted file mode 100644 index 100bcc8..0000000 --- a/dailyjs/live-fitness/components/Tray/index.js +++ /dev/null @@ -1 +0,0 @@ -export { Tray as default } from './Tray'; diff --git a/dailyjs/live-fitness/context/ClassStateProvider.js b/dailyjs/live-fitness/context/ClassStateProvider.js deleted file mode 100644 index e0a0ad9..0000000 --- a/dailyjs/live-fitness/context/ClassStateProvider.js +++ /dev/null @@ -1,37 +0,0 @@ -import React, { createContext, useContext, useEffect, useState } from 'react'; - -import { useParticipants } from '@dailyjs/shared/contexts/ParticipantsProvider'; -import PropTypes from 'prop-types'; - -export const CLASS_STATE_PRE_LOBBY = 'pre-lobby'; -export const CLASS_STATE_IN_SESSION = 'in_session'; -export const CLASS_STATE_POST_LOBBY = 'post-lobby'; - -const ClassStateContext = createContext(); - -export const ClassStateProvider = ({ children }) => { - const [classState, setClassState] = useState(CLASS_STATE_PRE_LOBBY); - - const { isOwner } = useParticipants(); - - useEffect(() => { - console.log('🧘 Class provider initialised'); - }, []); - - return ( - - {children} - - ); -}; - -ClassStateProvider.propTypes = { - children: PropTypes.node, -}; - -export const useClassState = () => useContext(ClassStateContext); diff --git a/dailyjs/live-fitness/env.example b/dailyjs/live-fitness/env.example deleted file mode 100644 index 5ab7e03..0000000 --- a/dailyjs/live-fitness/env.example +++ /dev/null @@ -1,8 +0,0 @@ -# Domain excluding 'https://' and 'daily.co' e.g. 'somedomain' -DAILY_DOMAIN= - -# Obtained from https://dashboard.daily.co/developers -DAILY_API_KEY= - -# Daily REST API endpoint -DAILY_REST_DOMAIN=https://api.daily.co/v1 diff --git a/dailyjs/live-fitness/image.png b/dailyjs/live-fitness/image.png deleted file mode 100644 index b4af7c6..0000000 Binary files a/dailyjs/live-fitness/image.png and /dev/null differ diff --git a/dailyjs/live-fitness/next.config.js b/dailyjs/live-fitness/next.config.js deleted file mode 100644 index ad6010a..0000000 --- a/dailyjs/live-fitness/next.config.js +++ /dev/null @@ -1,17 +0,0 @@ -const withPlugins = require('next-compose-plugins'); -const withTM = require('next-transpile-modules')([ - '@dailyjs/shared', - '@dailyjs/basic-call', - '@dailyjs/flying-emojis', - '@dailyjs/text-chat', - '@dailyjs/live-streaming', - '@dailyjs/recording', -]); - -const packageJson = require('./package.json'); - -module.exports = withPlugins([withTM], { - env: { - PROJECT_TITLE: packageJson.description, - }, -}); diff --git a/dailyjs/live-fitness/package.json b/dailyjs/live-fitness/package.json deleted file mode 100644 index df8999e..0000000 --- a/dailyjs/live-fitness/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "@dailyjs/live-fitness", - "description": "Live Fitness Example", - "version": "0.1.0", - "private": true, - "scripts": { - "dev": "next dev", - "build": "next build", - "start": "next start", - "lint": "next lint" - }, - "dependencies": { - "@dailyjs/shared": "*", - "@dailyjs/basic-call": "*", - "@dailyjs/flying-emojis": "*", - "@dailyjs/text-chat": "*", - "@dailyjs/live-streaming": "*", - "@dailyjs/recording": "*", - "next": "^11.0.0", - "pluralize": "^8.0.0", - "react": "^17.0.2", - "react-dom": "^17.0.2" - }, - "devDependencies": { - "babel-plugin-module-resolver": "^4.1.0", - "next-compose-plugins": "^2.2.1", - "next-transpile-modules": "^8.0.0" - } -} diff --git a/dailyjs/live-fitness/pages/[room].js b/dailyjs/live-fitness/pages/[room].js deleted file mode 100644 index 22cea5b..0000000 --- a/dailyjs/live-fitness/pages/[room].js +++ /dev/null @@ -1,118 +0,0 @@ -import React, { useState, useEffect } from 'react'; -import { CallProvider } from '@dailyjs/shared/contexts/CallProvider'; -import { MediaDeviceProvider } from '@dailyjs/shared/contexts/MediaDeviceProvider'; -import { ParticipantsProvider } from '@dailyjs/shared/contexts/ParticipantsProvider'; -import { TracksProvider } from '@dailyjs/shared/contexts/TracksProvider'; -import { UIStateProvider } from '@dailyjs/shared/contexts/UIStateProvider'; -import { WaitingRoomProvider } from '@dailyjs/shared/contexts/WaitingRoomProvider'; -import getDemoProps from '@dailyjs/shared/lib/demoProps'; -import { useRouter } from 'next/router'; -import PropTypes from 'prop-types'; -import App from '../components/App'; - -/** - * Room page - * --- - */ -export default function Room({ - room, - instructor, - domain, - customTrayComponent, - asides, - modals, -}) { - const [token, setToken] = useState(); - const [tokenError, setTokenError] = useState(); - - const router = useRouter(); - - // Redirect to a 404 if we do not have a room - useEffect( - () => (!room || !domain) && router.replace('/not-found'), - [room, domain, router] - ); - - // Fetch a meeting token - useEffect(() => { - if (token || !room) { - return; - } - - // We're using a simple Next serverless function to generate meeting tokens - // which could be replaced with your own serverside method that authenticates - // users / sets room owner status, user ID, user names etc - async function getToken() { - console.log(`🪙 Fetching meeting token for room '${room}'`); - - const res = await fetch('/api/token', { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - body: JSON.stringify({ roomName: room, isOwner: !!instructor }), - }); - - const resJson = await res.json(); - - if (!resJson?.token) { - setTokenError(resJson?.error || true); - } - - console.log(`🪙 Meeting token received`); - - setToken(resJson.token); - } - - getToken(); - }, [token, room, instructor]); - - if (!token) { - return
Fetching token...
; - } - - if (tokenError) { - return
Token error
; - } - - /** - * Main call UI - */ - return ( - - - - - - - - - - - - - - ); -} - -Room.propTypes = { - room: PropTypes.string.isRequired, - domain: PropTypes.string.isRequired, - instructor: PropTypes.bool, - customTrayComponent: PropTypes.node, - asides: PropTypes.arrayOf(PropTypes.func), - modals: PropTypes.arrayOf(PropTypes.func), -}; - -export async function getServerSideProps(context) { - const { room, instructor } = context.query; - const defaultProps = getDemoProps(); - - return { - props: { room, instructor: !!instructor, ...defaultProps }, - }; -} diff --git a/dailyjs/live-fitness/pages/_app.js b/dailyjs/live-fitness/pages/_app.js deleted file mode 100644 index b9ba6b0..0000000 --- a/dailyjs/live-fitness/pages/_app.js +++ /dev/null @@ -1,12 +0,0 @@ -import React from 'react'; -import App from '@dailyjs/basic-call/pages/_app'; -import LiveStreamingModal from '@dailyjs/live-streaming/components/LiveStreamingModal'; -import RecordingModal from '@dailyjs/recording/components/RecordingModal'; -import ChatAside from '@dailyjs/text-chat/components/ChatAside'; -import Tray from '../components/Tray'; - -App.customTrayComponent = ; -App.asides = [ChatAside]; -App.modals = [LiveStreamingModal, RecordingModal]; - -export default App; diff --git a/dailyjs/live-fitness/pages/api b/dailyjs/live-fitness/pages/api deleted file mode 120000 index 999f604..0000000 --- a/dailyjs/live-fitness/pages/api +++ /dev/null @@ -1 +0,0 @@ -../../basic-call/pages/api \ No newline at end of file diff --git a/dailyjs/live-fitness/pages/index.js b/dailyjs/live-fitness/pages/index.js deleted file mode 100644 index 9974303..0000000 --- a/dailyjs/live-fitness/pages/index.js +++ /dev/null @@ -1,35 +0,0 @@ -import React from 'react'; -import getDemoProps from '@dailyjs/shared/lib/demoProps'; -import { useRouter } from 'next/router'; -import PropTypes from 'prop-types'; -import Splash from '../components/Splash'; - -/** - * Index page - * --- - */ -export default function Index({ isConfigured = false }) { - const router = useRouter(); - - function joinRoom(room, joinAsInstructor) { - // Redirect to room page - router.replace({ - pathname: `/${room}`, - query: { instructor: !!joinAsInstructor }, - }); - } - - return ; -} - -Index.propTypes = { - isConfigured: PropTypes.bool.isRequired, -}; - -export async function getStaticProps() { - const defaultProps = getDemoProps(); - - return { - props: defaultProps, - }; -} diff --git a/dailyjs/live-fitness/pages/not-found.js b/dailyjs/live-fitness/pages/not-found.js deleted file mode 100644 index 6a7b1f6..0000000 --- a/dailyjs/live-fitness/pages/not-found.js +++ /dev/null @@ -1,21 +0,0 @@ -import React from 'react'; -import MessageCard from '@dailyjs/shared/components/MessageCard'; - -export default function RoomNotFound() { - return ( -
- - The room you are trying to join does not exist. Have you created the - room using the Daily REST API or the dashboard? - - -
- ); -} diff --git a/dailyjs/live-fitness/public/assets b/dailyjs/live-fitness/public/assets deleted file mode 120000 index 951b6e8..0000000 --- a/dailyjs/live-fitness/public/assets +++ /dev/null @@ -1 +0,0 @@ -../../shared/assets \ No newline at end of file diff --git a/dailyjs/live-fitness/public/images/daily-logo.svg b/dailyjs/live-fitness/public/images/daily-logo.svg deleted file mode 100644 index ba11f78..0000000 --- a/dailyjs/live-fitness/public/images/daily-logo.svg +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/dailyjs/live-fitness/public/images/fitness-bg.jpg b/dailyjs/live-fitness/public/images/fitness-bg.jpg deleted file mode 100644 index 19143d8..0000000 Binary files a/dailyjs/live-fitness/public/images/fitness-bg.jpg and /dev/null differ diff --git a/dailyjs/live-fitness/public/images/splash.jpg b/dailyjs/live-fitness/public/images/splash.jpg deleted file mode 100644 index cc86932..0000000 Binary files a/dailyjs/live-fitness/public/images/splash.jpg and /dev/null differ