Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/updated styling dev410 #6

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
Binary file modified public/favicon.ico
Binary file not shown.
2 changes: 1 addition & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>Daily React Demo</title>
<title>Daily call object React demo</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
Expand Down
14 changes: 6 additions & 8 deletions src/api.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const newRoomEndpoint =
`${window.location.origin}/api/rooms`;
const newRoomEndpoint = `${window.location.origin}/api/rooms`;

/**
* Create a short-lived room for demo purposes.
Expand All @@ -9,21 +8,20 @@ const newRoomEndpoint =
* in README.md
*
* See https://docs.daily.co/reference#create-room for more information on how
* to use the Daily REST API to create rooms and what options are available.
* to use the Daily REST API to create rooms and what options are available.
*/
async function createRoom() {

const exp = Math.round(Date.now() / 1000) + 60 * 30;
const options = {
properties: {
exp: exp,
},
};
let response = await fetch(newRoomEndpoint, {
method: "POST",
body: JSON.stringify(options),
mode: 'cors',
}),
method: 'POST',
body: JSON.stringify(options),
mode: 'cors',
}),
room = await response.json();
return room;

Expand Down
83 changes: 82 additions & 1 deletion src/components/App/App.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,87 @@
:root {
--fontFamily: GraphikRegular, 'Helvetica Neue', Sans-Serif;
--white: #ffffff;
--grey: #c8d1dc;
--darkblue: #121a24;
--lightgreen: #72cc18;
}

.app {
background-color: #4a4a4a;
font-family: var(--fontFamily);
color: var(--white);
background-color: var(--darkblue);
position: absolute;
height: 100%;
width: 100%;
display: flex;
flex-direction: column;
justify-content: center;
margin: 0 auto;
}

.wrapper {
display: flex;
flex-direction: column;
}

.header {
display: flex;
position: relative;
bottom: 80%;
justify-content: space-between;
align-items: center;
margin: 1rem;
}

.introInstructions {
position: relative;
bottom: 100px;
}

.dailyLogo {
width: 70px;
}

.title {
margin-bottom: 0;
text-align: center;
}

.instructions {
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
margin-bottom: 8px;
width: 100%;
}

.roomURL {
width: 300px;
line-height: 18px;
padding-top: 7px;
padding-bottom: 7px;
padding-left: 7px;
border-radius: 8px;
}

.startButton,
.startButtonReady,
.createRoomButton {
padding: 8px 16px;
margin-top: 8px;
margin-bottom: 8px;
font-weight: 700;
text-align: center;
border-radius: 8px;
background-color: var(--white);
border-width: 1px;
border-color: var(--grey);
color: var(--darkblue);
cursor: pointer;
width: 250px;
}

.startButtonReady {
background-color: var(--lightgreen);
}
64 changes: 54 additions & 10 deletions src/components/App/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,39 @@ import CallObjectContext from '../../CallObjectContext';
import { roomUrlFromPageUrl, pageUrlFromRoomUrl } from '../../urlUtils';
import DailyIframe from '@daily-co/daily-js';
import { logDailyEvent } from '../../logUtils';
import dailyLogo from '../../images/[email protected]';
import gitHubLogo from '../../images/[email protected]';

const STATE_IDLE = 'STATE_IDLE';
const STATE_CREATING = 'STATE_CREATING';
const STATE_JOINING = 'STATE_JOINING';
const STATE_ROOM_READY = 'STATE_ROOM_CREATED';
const STATE_JOINED = 'STATE_JOINED';
const STATE_LEAVING = 'STATE_LEAVING';
const STATE_ERROR = 'STATE_ERROR';

export default function App() {
const [appState, setAppState] = useState(STATE_IDLE);
const [roomUrl, setRoomUrl] = useState(null);
const [roomUrl, setRoomUrl] = useState('');
const [roomUrlFieldValue, setRoomUrlFieldValue] = useState('');
const [callObject, setCallObject] = useState(null);

/**
* Creates a new call room.
*/
const createCall = useCallback(() => {
const createRoom = useCallback(() => {
setAppState(STATE_CREATING);
return api
.createRoom()
.then((room) => room.url)
.then((room) => {
setRoomUrl(room.url);
setRoomUrlFieldValue(room.url);
setAppState(STATE_ROOM_READY);
})
.catch((error) => {
console.log('Error creating room', error);
setRoomUrl(null);
setRoomUrlFieldValue(undefined);
setAppState(STATE_IDLE);
});
}, []);
Expand Down Expand Up @@ -203,7 +212,7 @@ export default function App() {
* Disabling the start button until then avoids that scenario.
* !!!
*/
const enableStartButton = appState === STATE_IDLE;
const enableStartButton = appState === STATE_ROOM_READY;

return (
<div className="app">
Expand All @@ -220,12 +229,47 @@ export default function App() {
/>
</CallObjectContext.Provider>
) : (
<StartButton
disabled={!enableStartButton}
onClick={() => {
createCall().then((url) => startJoiningCall(url));
}}
/>
<div className="wrapper">
<div className="header">
<img src={dailyLogo} className="dailyLogo"></img>
<img src={gitHubLogo}></img>
</div>
<div className="introInstructions">
<h1 className="title">Daily call object React demo</h1>
<div className="instructions">
<p className="instructionsText">
To get started, enter an existing room URL or create a temporary
demo room
</p>
<label htmlFor="roomURL"></label>
<input
type="text"
className="roomURL"
id="roomURL"
placeholder="Room URL"
pattern="^(https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.(daily\.co\/)([a-z0-9]+)+$"
value={roomUrlFieldValue}
onChange={(event) => {
setRoomUrl(event.target.value);
setRoomUrlFieldValue(event.target.value);
setAppState(STATE_ROOM_READY);
}}
/>
<button
className="createRoomButton"
onClick={() => {
createRoom();
}}
>
Create demo room
</button>
<StartButton
disabled={!enableStartButton}
onClick={() => startJoiningCall(roomUrl)}
/>
</div>
</div>
</div>
)}
</div>
);
Expand Down
15 changes: 15 additions & 0 deletions src/components/Call/Call.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,18 @@
display: flex;
align-items: center;
}

.banner {
width: auto;
padding: 20px 30px;
top: 5%;
left: 50%;
position: absolute;
transform: translate(-50%, -50%);
text-align: center;
border: 1px solid #2b3f56;
}

/* .docsLink {
text-decoration: none;
} */
3 changes: 3 additions & 0 deletions src/components/Call/Call.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,9 @@ export default function Call() {
const message = getMessage(callState);
return (
<div className="call">
<div className="banner">
Explore more ways to customize this call in the Daily docs.
</div>
<div className="large-tiles">
{
!message
Expand Down
4 changes: 2 additions & 2 deletions src/components/CallMessage/CallMessage.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
left: 50%;
position: absolute;
transform: translate(-50%, -50%);
color: #ffffff;
color: var(--white);
text-align: center;
font-size: 14px;
line-height: 17px;
}

.call-message.error {
color: #d81a1a;
background-color: #ffffff;
background-color: var(--white);
}

.call-message-header {
Expand Down
5 changes: 3 additions & 2 deletions src/components/Chat/Chat.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
.chat {
position: absolute;
right: 10px;
bottom: 75px;
left: 150px;
bottom: 0px;
top: 350px;
width: 250px;
height: calc(100% - 150px);
background-color: #f2f2f2;
Expand Down
32 changes: 16 additions & 16 deletions src/components/StartButton/StartButton.css
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
.start-button {
padding: 20px 30px;
position: absolute;
background: #ffffff;
font-family: Helvetica Neue;
font-style: normal;
font-weight: normal;
font-size: 14px;
line-height: 17px;
text-align: center;
color: #4a4a4a;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background-color: #ffffff;
}
/* .start-button {
padding: 20px 30px;
position: absolute;
background: #ffffff;
font-family: Helvetica Neue;
font-style: normal;
font-weight: normal;
font-size: 14px;
line-height: 17px;
text-align: center;
color: #4a4a4a;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background-color: #ffffff;
} */
6 changes: 3 additions & 3 deletions src/components/StartButton/StartButton.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import './StartButton.css';
// import './StartButton.css';

/**
* Props:
Expand All @@ -9,11 +9,11 @@ import './StartButton.css';
export default function StartButton(props) {
return (
<button
className="start-button"
className={props.disabled ? 'startButton' : 'startButtonReady'}
disabled={props.disabled}
onClick={props.onClick}
>
Click to start a call
Start call
</button>
);
}
14 changes: 13 additions & 1 deletion src/components/Tray/Tray.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
.tray {
flex: none;
/* flex: none;
height: 60px;
background-color: #f2f2f2;
padding: 0 10px;
display: flex;
width: 100%;
align-items: center; */

flex: none;
height: 55%;
top: 105px;
width: 40px;
background-color: #f2f2f2;
padding: 0 10px;
display: flex;
position: absolute;
flex-direction: column;
align-items: center;
}
Binary file added src/images/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/images/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 4 additions & 3 deletions src/index.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
:root {
--fontFamily: GraphikRegular, 'Helvetica Neue', Sans-Serif;
}

body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
Expand Down