Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit b5eab4b

Browse files
Merge pull request #7 from DolbyIO/rc-0.5.7
RC 0.5.7
2 parents 3d213f2 + 45a61d3 commit b5eab4b

File tree

15 files changed

+503
-541
lines changed

15 files changed

+503
-541
lines changed

README.md

Lines changed: 287 additions & 443 deletions
Large diffs are not rendered by default.

documentation/components/Conference.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,15 @@ The Conference component is responsible for creating and joining conferences on
55
## Props
66

77
| Name | Type | Default | Description |
8-
| ---------- | --------------- | ------- | --------------------------------------------------------------------------- |
9-
| `alias` | string | - | The name of the conference. |
10-
| `audio` | boolean | - | A boolean that indicates whether audio should be enabled in the conference. |
11-
| `video` | boolean | - | A boolean that indicates whether video should be enabled in the conference. |
12-
| `children` | React.ReactNode | - | A children element. |
8+
9+
| Name | Type | Default | Description |
10+
| --------------- | --------------- | ------- | --------------------------------------------------------------------------- |
11+
| `id` | string | - | Identifier of the conference to join. |
12+
| `alias` | string | - | The alias of the conference. |
13+
| `liveRecording` | boolean | - | Turns the live recording on or off. |
14+
| `audio` | boolean | - | A boolean that indicates whether audio should be enabled in the conference. |
15+
| `video` | boolean | - | A boolean that indicates whether video should be enabled in the conference. |
16+
| `children` | React.ReactNode | - | A children element. |
1317

1418
## Examples
1519

documentation/components/Pill.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ The Pill component is responsible for displaying labels that contain additional
99
| `text` ? | string | - | The text to display. |
1010
| `active` ? | bool | false | The activity state. |
1111
| `size` ? | 's' , 'm' | 'm' | The size of the component. |
12-
| `textColor.default` ? | ColorKey | - | The default color of the text. |
13-
| `textColor.active` ? | ColorKey | - | The color of the text when the label is active. |
14-
| `backgroundColor.default` ? | ColorKey | - | The default background color of the label. |
15-
| `backgroundColor.active`? | ColorKey | - | The background color of the active label. |
1612
| `testID` ? | string | - | The unique E2E test handler. |
1713
| `...HTMLDivElement`? | Partial(HTMLDivElement) | - | Props that will be passed to the root of the div element. |
1814

documentation/hooks/useConference.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ The useConference hook gathers functions responsible for managing conferences.
44

55
## Members
66

7-
| Name | Type | Description |
8-
| ------------------ | --------------------------- | ------------------------------------- |
9-
| `conference` | Conference | The object of the current conference. |
10-
| `createConference` | (ConferenceOptions) => Promise<Conference> | Creates a conference. |
11-
| `joinConference` | (Conference, JoinOptions) => Promise<Conference> | Joins a conference. |
12-
| `leaveConference` | () => Promise<void> | Leaves a conference.
7+
| Name | Type | Description |
8+
|--------------------|---------------------------------------------------|---------------------------------------|
9+
| `conference` | Conference | The object of the current conference. |
10+
| `createConference` | (ConferenceOptions) => Promise<Conference> | Creates a conference. |
11+
| `fetchConference` | (id) => Promise<Conference> | Fetches a conference. |
12+
| `joinConference` | (Conference, JoinOptions) => Promise<Conference> | Joins a conference. |
13+
| `leaveConference` | () => Promise<void> | Leaves a conference.
1314

1415
## Examples
1516

examples/example_App.js

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
import {
2+
CommsProvider,
3+
Session,
4+
Conference,
5+
ParticipantsList,
6+
ParticipantsGrid,
7+
LocalToggleAudioButton,
8+
LocalToggleVideoButton,
9+
LeaveConferenceButton,
10+
CameraSelect,
11+
MicrophoneSelect,
12+
SpeakersSelect,
13+
} from '@dolbyio/comms-uikit-react';
14+
import './App.css';
15+
16+
// Define the `CommsProvider` configuration: we need two props, a `token` and an async function that refreshes it.
17+
const token = 'YOUR_CLIENT_ACCESS_TOKEN_HERE';
18+
const refreshToken = async () => token;
19+
20+
// Define the `Session` configuration: you should provide a name using a `participantInfo` object, eg. the name of the participant who established the session.
21+
const participantInfo = { name: 'John Doe' };
22+
23+
// Define the `Conference` configuration: you can specify whether to join the conference with audio and/or video enabled, in addition to an alias which can be made visible to all participants.
24+
const audio = true;
25+
const video = true;
26+
const alias = 'My Meeting';
27+
28+
// Define the `ParticipantsList` configuration: you can customise the text shown for each participant and their status.
29+
const localText = 'you'; // The local participant's name.
30+
const muteText = 'mute'; // Displayed in a tooltip when a participant is not muted.
31+
const unmuteText = 'unmute'; // Displayed in a tooltip when a participant is muted.
32+
const soundOnText = 'sound on'; // Displayed in a tooltip when a participant is speaking.
33+
const soundOffText = 'sound off'; // Displayed in a tooltip when a participant is not speaking.
34+
35+
// Define the `ParticipantsGrid` configuration: you can customise the text shown for the current participant and their status.
36+
37+
// const localText = 'you';
38+
39+
/*
40+
We are re-using the previously declared `localText` in this example for `ParticipantsGrid` but you can use any value you prefer
41+
*/
42+
43+
// Define the `CameraSelect`, `MicrophoneSelect`, and `SpeakersSelect` configurations: each component takes a `label` prop (shown above the component) and a `placeholder` prop (shown when no option is selected).
44+
const cameraLabel = 'Camera';
45+
const cameraPlaceholder = 'Choose a camera';
46+
47+
const microphoneLabel = 'Microphone';
48+
const microphonePlaceholder = 'Choose a microphone';
49+
50+
const speakersLabel = 'Speaker';
51+
const speakersPlaceholder = 'Choose a speaker';
52+
53+
// Define the `LeaveConferenceButton` configuration: you can customise the text shown in a tooltip when hovering over the button.
54+
const tooltipText = 'Leave';
55+
56+
function App() {
57+
return (
58+
<CommsProvider token={token} refreshToken={refreshToken}>
59+
<div className="App">
60+
<Session participantInfo={participantInfo}>
61+
{/* IMPORTANT: Rendering a <Conference /> component will establish a call using Dolby.io - if you're using your free minutes for this demo, remember to leave the conference or close the browser tab when you're done! */}
62+
<Conference audio={audio} video={video} alias={alias}>
63+
<ParticipantsList
64+
localText={localText}
65+
muteText={muteText}
66+
unmuteText={unmuteText}
67+
soundOnText={soundOnText}
68+
soundOffText={soundOffText}
69+
/>
70+
<ParticipantsGrid localText={localText} />
71+
<LocalToggleAudioButton />
72+
<LocalToggleVideoButton />
73+
<CameraSelect label={cameraLabel} placeholder={cameraPlaceholder} />
74+
<MicrophoneSelect label={microphoneLabel} placeholder={microphonePlaceholder} />
75+
<SpeakersSelect label={speakersLabel} placeholder={speakersPlaceholder} />
76+
<LeaveConferenceButton tooltipText={tooltipText} />
77+
</Conference>
78+
</Session>
79+
</div>
80+
</CommsProvider>
81+
);
82+
}
83+
84+
export default App;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@dolbyio/comms-uikit-react",
3-
"version": "0.5.4",
3+
"version": "0.5.7",
44
"description": "Dolby.io Communications UIKit for React",
55
"license": "MIT",
66
"main": "dist/index.es.js",

src/components/conference/Conference/Conference.test.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ describe('Conference component', () => {
2929
await waitFor(() => {
3030
expect(createConference).toBeCalledWith({
3131
alias,
32+
params: {
33+
liveRecording: false,
34+
},
3235
});
3336
expect(joinConference).toBeCalledWith(undefined, {
3437
constraints: {

src/components/conference/Conference/Conference.tsx

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,33 @@ import { useConference } from '../../../index';
44

55
type ConferenceProps = {
66
children: React.ReactNode;
7-
alias: string;
8-
audio: boolean;
9-
video: boolean;
7+
id?: string;
8+
alias?: string;
9+
audio?: boolean;
10+
video?: boolean;
11+
liveRecording?: boolean;
1012
};
1113

12-
const Conference = ({ alias, audio, video, children }: ConferenceProps) => {
13-
const { createConference, joinConference } = useConference();
14+
const Conference = ({ alias, id, audio = false, video = false, liveRecording = false, children }: ConferenceProps) => {
15+
const { createConference, fetchConference, joinConference } = useConference();
1416
const [isReady, setIsReady] = useState<boolean>(false);
1517

1618
useEffect(() => {
1719
(async () => {
18-
const conferenceOptions = {
19-
alias,
20-
};
21-
const conf = await createConference(conferenceOptions);
20+
let conference;
21+
if (id) {
22+
conference = await fetchConference(id);
23+
} else if (alias) {
24+
const createOptions = {
25+
alias,
26+
params: {
27+
liveRecording,
28+
},
29+
};
30+
conference = await createConference(createOptions);
31+
} else {
32+
return;
33+
}
2234

2335
const joinOptions = {
2436
constraints: {
@@ -32,7 +44,7 @@ const Conference = ({ alias, audio, video, children }: ConferenceProps) => {
3244
},
3345
};
3446

35-
await joinConference(conf, joinOptions);
47+
await joinConference(conference, joinOptions);
3648
setIsReady(true);
3749
})();
3850
}, []);

src/components/ui/Toast/Toast.module.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.toast {
22
box-sizing: border-box;
33
min-width: 100px;
4-
height: 32px;
4+
min-height: 32px;
55
border-radius: 6px;
66
backdrop-filter: blur(8px);
77
display: flex;

src/components/ui/Toast/Toast.tsx

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,40 @@
11
/* eslint-disable react/jsx-props-no-spreading */
22
/* eslint-disable import/no-extraneous-dependencies */
33
import type { ColorKey } from '../../../common';
4+
import type { SpaceValues } from '../../../common/theme/types';
45
import cx from 'classnames';
56

67
import useTheme from '../../../hooks/useTheme';
78
import Space from '../Space/Space';
89

910
import styles from './Toast.module.scss';
1011

11-
type ToastProps = React.HTMLAttributes<HTMLDivElement> & {
12+
export type ToastProps = React.HTMLAttributes<HTMLDivElement> & {
1213
backgroundColor?: ColorKey;
1314
isVisible?: boolean;
1415
testID?: string;
16+
pv?: SpaceValues; // Padding Vertical (padding-top & padding-bottom)
17+
ph?: SpaceValues; // Padding Horizontal (padding-left & padding-right)
18+
mb?: SpaceValues; // margin-bottom
1519
};
1620

17-
const Toast = ({ children, backgroundColor = 'greyAlpha.800', isVisible, testID, ...props }: ToastProps) => {
21+
const Toast = ({
22+
children,
23+
backgroundColor = 'greyAlpha.800',
24+
isVisible,
25+
testID,
26+
pv,
27+
ph,
28+
mb,
29+
...props
30+
}: ToastProps) => {
1831
const { getColor } = useTheme();
1932

2033
return (
2134
<Space
22-
pv="xxs"
23-
ph="s"
24-
mb="xxxs"
35+
pv={pv || 'xxs'}
36+
ph={ph || 's'}
37+
mb={mb || 'xxxs'}
2538
testID={testID}
2639
className={cx(styles.toast, !isVisible && styles.invisible)}
2740
style={{ backgroundColor: getColor(backgroundColor) }}

0 commit comments

Comments
 (0)