From 42c46f1f1cbe9fd042b3d57df13a7b9347f24b00 Mon Sep 17 00:00:00 2001 From: J Taylor Date: Mon, 21 Jun 2021 15:19:43 +0100 Subject: [PATCH] initial commit --- dailyjs/basic-call/components/Intro/Intro.js | 12 ++++++++-- dailyjs/basic-call/index.js | 1 + dailyjs/basic-call/next.config.js | 8 ++++++- dailyjs/basic-call/package.json | 1 + dailyjs/basic-call/pages/_app.js | 9 +++---- dailyjs/basic-call/pages/index.js | 6 ++++- .../components/GlobalHead/GlobalHead.js | 14 +++++++++++ dailyjs/shared/components/GlobalHead/index.js | 2 ++ dailyjs/text-chat/.babelrc | 4 ++++ dailyjs/text-chat/next.config.js | 13 ++++++++++ dailyjs/text-chat/package.json | 24 +++++++++++++++++++ dailyjs/text-chat/pages/_app.js | 3 +++ dailyjs/text-chat/pages/index.js | 17 +++++++++++++ 13 files changed, 104 insertions(+), 10 deletions(-) create mode 100644 dailyjs/basic-call/index.js create mode 100644 dailyjs/shared/components/GlobalHead/GlobalHead.js create mode 100644 dailyjs/shared/components/GlobalHead/index.js create mode 100644 dailyjs/text-chat/.babelrc create mode 100644 dailyjs/text-chat/next.config.js create mode 100644 dailyjs/text-chat/package.json create mode 100644 dailyjs/text-chat/pages/_app.js create mode 100644 dailyjs/text-chat/pages/index.js diff --git a/dailyjs/basic-call/components/Intro/Intro.js b/dailyjs/basic-call/components/Intro/Intro.js index be04274..301509e 100644 --- a/dailyjs/basic-call/components/Intro/Intro.js +++ b/dailyjs/basic-call/components/Intro/Intro.js @@ -16,7 +16,14 @@ import PropTypes from 'prop-types'; * --- * Specify which room we would like to join */ -export const Intro = ({ room, error, domain, onJoin, fetching = false }) => { +export const Intro = ({ + room, + error, + domain, + onJoin, + title, + fetching = false, +}) => { const [roomName, setRoomName] = useState(); const [owner, setOwner] = useState(false); const [fetchToken, setFetchToken] = useState(false); @@ -27,7 +34,7 @@ export const Intro = ({ room, error, domain, onJoin, fetching = false }) => { return ( - Daily Basic Call Example + {title} {error && ( @@ -67,6 +74,7 @@ export const Intro = ({ room, error, domain, onJoin, fetching = false }) => { Intro.propTypes = { room: PropTypes.string, + title: PropTypes.string, error: PropTypes.string, domain: PropTypes.string.isRequired, onJoin: PropTypes.func.isRequired, diff --git a/dailyjs/basic-call/index.js b/dailyjs/basic-call/index.js new file mode 100644 index 0000000..9044efc --- /dev/null +++ b/dailyjs/basic-call/index.js @@ -0,0 +1 @@ +// Note: I am here because next-transpile-modules requires a mainfile diff --git a/dailyjs/basic-call/next.config.js b/dailyjs/basic-call/next.config.js index c223d3f..d054cbd 100644 --- a/dailyjs/basic-call/next.config.js +++ b/dailyjs/basic-call/next.config.js @@ -1,4 +1,10 @@ const withPlugins = require('next-compose-plugins'); const withTM = require('next-transpile-modules')(['@dailyjs/shared']); -module.exports = withPlugins([withTM]); +const packageJson = require('./package.json'); + +module.exports = withPlugins([withTM], { + env: { + PROJECT_TITLE: packageJson.description, + }, +}); diff --git a/dailyjs/basic-call/package.json b/dailyjs/basic-call/package.json index 7b5f48a..4865d38 100644 --- a/dailyjs/basic-call/package.json +++ b/dailyjs/basic-call/package.json @@ -1,5 +1,6 @@ { "name": "@dailyjs/basic-call", + "description": "Basic Call Example", "version": "0.1.0", "private": true, "scripts": { diff --git a/dailyjs/basic-call/pages/_app.js b/dailyjs/basic-call/pages/_app.js index 3237e3a..0ee1a00 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'; @@ -7,13 +8,9 @@ function App({ Component, pageProps }) { return ( <> - Daily - Basic Call Example - - + Daily - {process.env.PROJECT_TITLE} + diff --git a/dailyjs/basic-call/pages/index.js b/dailyjs/basic-call/pages/index.js index b55c5ce..43fd83e 100644 --- a/dailyjs/basic-call/pages/index.js +++ b/dailyjs/basic-call/pages/index.js @@ -66,6 +66,7 @@ export default function Index({ domain, isConfigured = false }) { ) : ( ( + + + + +); + +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'; diff --git a/dailyjs/text-chat/.babelrc b/dailyjs/text-chat/.babelrc new file mode 100644 index 0000000..a6f4434 --- /dev/null +++ b/dailyjs/text-chat/.babelrc @@ -0,0 +1,4 @@ +{ + "presets": ["next/babel"], + "plugins": ["inline-react-svg"] +} diff --git a/dailyjs/text-chat/next.config.js b/dailyjs/text-chat/next.config.js new file mode 100644 index 0000000..9a0a6ee --- /dev/null +++ b/dailyjs/text-chat/next.config.js @@ -0,0 +1,13 @@ +const withPlugins = require('next-compose-plugins'); +const withTM = require('next-transpile-modules')([ + '@dailyjs/shared', + '@dailyjs/basic-call', +]); + +const packageJson = require('./package.json'); + +module.exports = withPlugins([withTM], { + env: { + PROJECT_TITLE: packageJson.description, + }, +}); diff --git a/dailyjs/text-chat/package.json b/dailyjs/text-chat/package.json new file mode 100644 index 0000000..23b7363 --- /dev/null +++ b/dailyjs/text-chat/package.json @@ -0,0 +1,24 @@ +{ + "name": "@dailyjs/text-chat", + "description": "Basic Call + Chat Example", + "version": "0.1.0", + "private": true, + "scripts": { + "dev": "next dev", + "build": "next build", + "start": "next start" + }, + "dependencies": { + "@dailyjs/shared": "*", + "@dailyjs/basic-call": "*", + "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/text-chat/pages/_app.js b/dailyjs/text-chat/pages/_app.js new file mode 100644 index 0000000..c9a5152 --- /dev/null +++ b/dailyjs/text-chat/pages/_app.js @@ -0,0 +1,3 @@ +import App from '@dailyjs/basic-call/pages/_app'; + +export default App; diff --git a/dailyjs/text-chat/pages/index.js b/dailyjs/text-chat/pages/index.js new file mode 100644 index 0000000..5f31f95 --- /dev/null +++ b/dailyjs/text-chat/pages/index.js @@ -0,0 +1,17 @@ +import Index from '@dailyjs/basic-call/pages'; + +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, + }, + }; +} + +export default Index;