From 31c579ccddc5b8beb40e768ea6950c2ae67be12f Mon Sep 17 00:00:00 2001 From: J Taylor Date: Mon, 21 Jun 2021 10:57:42 +0100 Subject: [PATCH] initial commit --- dailyjs/basic-call/pages/_app.js | 7 ++--- dailyjs/live-fitness/.babelrc | 4 +++ dailyjs/live-fitness/env.example | 8 +++++ dailyjs/live-fitness/next.config.js | 4 +++ dailyjs/live-fitness/package.json | 22 ++++++++++++++ dailyjs/live-fitness/pages/_app.js | 30 +++++++++++++++++++ dailyjs/live-fitness/pages/index.js | 22 ++++++++++++++ .../components/GlobalHead/GlobalHead.js | 14 +++++++++ dailyjs/shared/components/GlobalHead/index.js | 2 ++ 9 files changed, 108 insertions(+), 5 deletions(-) create mode 100644 dailyjs/live-fitness/.babelrc create mode 100644 dailyjs/live-fitness/env.example create mode 100644 dailyjs/live-fitness/next.config.js create mode 100644 dailyjs/live-fitness/package.json create mode 100644 dailyjs/live-fitness/pages/_app.js create mode 100644 dailyjs/live-fitness/pages/index.js create mode 100644 dailyjs/shared/components/GlobalHead/GlobalHead.js create mode 100644 dailyjs/shared/components/GlobalHead/index.js diff --git a/dailyjs/basic-call/pages/_app.js b/dailyjs/basic-call/pages/_app.js index 3237e3a..aeaf3dd 100644 --- a/dailyjs/basic-call/pages/_app.js +++ b/dailyjs/basic-call/pages/_app.js @@ -1,4 +1,5 @@ import React from 'react'; +import GlobalHead from '@dailyjs/shared/components/GlobalHead'; import GlobalStyle from '@dailyjs/shared/components/GlobalStyle'; import Head from 'next/head'; import PropTypes from 'prop-types'; @@ -8,12 +9,8 @@ function App({ Component, pageProps }) { <> Daily - Basic Call Example - - + diff --git a/dailyjs/live-fitness/.babelrc b/dailyjs/live-fitness/.babelrc new file mode 100644 index 0000000..a6f4434 --- /dev/null +++ b/dailyjs/live-fitness/.babelrc @@ -0,0 +1,4 @@ +{ + "presets": ["next/babel"], + "plugins": ["inline-react-svg"] +} diff --git a/dailyjs/live-fitness/env.example b/dailyjs/live-fitness/env.example new file mode 100644 index 0000000..5ab7e03 --- /dev/null +++ b/dailyjs/live-fitness/env.example @@ -0,0 +1,8 @@ +# 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/next.config.js b/dailyjs/live-fitness/next.config.js new file mode 100644 index 0000000..c223d3f --- /dev/null +++ b/dailyjs/live-fitness/next.config.js @@ -0,0 +1,4 @@ +const withPlugins = require('next-compose-plugins'); +const withTM = require('next-transpile-modules')(['@dailyjs/shared']); + +module.exports = withPlugins([withTM]); diff --git a/dailyjs/live-fitness/package.json b/dailyjs/live-fitness/package.json new file mode 100644 index 0000000..55be2dc --- /dev/null +++ b/dailyjs/live-fitness/package.json @@ -0,0 +1,22 @@ +{ + "name": "@dailyjs/live-fitness", + "version": "0.1.0", + "private": true, + "scripts": { + "dev": "next dev", + "build": "next build", + "start": "next start" + }, + "dependencies": { + "@dailyjs/shared": "*", + "next": "^10.2.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": "^6.4.0" + } +} diff --git a/dailyjs/live-fitness/pages/_app.js b/dailyjs/live-fitness/pages/_app.js new file mode 100644 index 0000000..d97e390 --- /dev/null +++ b/dailyjs/live-fitness/pages/_app.js @@ -0,0 +1,30 @@ +import React from 'react'; +import GlobalHead from '@dailyjs/shared/components/GlobalHead'; +import GlobalStyle from '@dailyjs/shared/components/GlobalStyle'; +import Head from 'next/head'; +import PropTypes from 'prop-types'; + +function App({ Component, pageProps }) { + return ( + <> + + Daily - Live Fitness Demo + + + + + + ); +} + +App.defaultProps = { + Component: null, + pageProps: {}, +}; + +App.propTypes = { + Component: PropTypes.elementType, + pageProps: PropTypes.object, +}; + +export default App; diff --git a/dailyjs/live-fitness/pages/index.js b/dailyjs/live-fitness/pages/index.js new file mode 100644 index 0000000..113cbe2 --- /dev/null +++ b/dailyjs/live-fitness/pages/index.js @@ -0,0 +1,22 @@ +import React from 'react'; +import PropTypes from 'prop-types'; + +export default function Index({ domain, isConfigured }) { + return
Hello
; +} + +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 }, + }; +} diff --git a/dailyjs/shared/components/GlobalHead/GlobalHead.js b/dailyjs/shared/components/GlobalHead/GlobalHead.js new file mode 100644 index 0000000..ac9b7a1 --- /dev/null +++ b/dailyjs/shared/components/GlobalHead/GlobalHead.js @@ -0,0 +1,14 @@ +import React from 'react'; +import Head from 'next/head'; + +export const GlobalHead = () => ( + + + + +); + +export default GlobalHead; diff --git a/dailyjs/shared/components/GlobalHead/index.js b/dailyjs/shared/components/GlobalHead/index.js new file mode 100644 index 0000000..2d9ccec --- /dev/null +++ b/dailyjs/shared/components/GlobalHead/index.js @@ -0,0 +1,2 @@ +export { GlobalHead as default } from './GlobalHead'; +export { GlobalHead } from './GlobalHead';