Skip to content

Commit c0919e9

Browse files
carocao-msftedwardlee-msft
authored andcommitted
Storybook changes for captions (#4471)
* story * Change files * Update packages/storybook/stories/INTERNAL/ClosedCaptions/ClosedCaptions.stories.tsx Co-authored-by: edwardlee-msft <edwardlee@microsoft.com> Signed-off-by: carocao-msft <96077406+carocao-msft@users.noreply.github.com> * update * feedback --------- Signed-off-by: carocao-msft <96077406+carocao-msft@users.noreply.github.com> Co-authored-by: edwardlee-msft <edwardlee@microsoft.com>
1 parent 90f8a11 commit c0919e9

5 files changed

Lines changed: 40 additions & 80 deletions

File tree

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"type": "prerelease",
3+
"area": "feature",
4+
"workstream": "Closed captions",
5+
"comment": "Improved closed captions storybook based on feedback",
6+
"packageName": "@azure/communication-react",
7+
"email": "96077406+carocao-msft@users.noreply.github.com",
8+
"dependentChangeType": "patch"
9+
}
-116 KB
Loading
38.9 KB
Loading

packages/storybook/stories/INTERNAL/ClosedCaptions/ClosedCaptions.stories.tsx

Lines changed: 30 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,12 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT License.
33

4-
import { CallComposite } from '@azure/communication-react';
5-
import { Stack } from '@fluentui/react';
4+
import { PrimaryButton, Stack } from '@fluentui/react';
65
import { Description, Heading, Source, Subheading, Title } from '@storybook/addon-docs';
76
import { Meta } from '@storybook/react/types-6-0';
8-
import React, { useMemo } from 'react';
9-
import { v1 as createGUID } from 'uuid';
7+
import React from 'react';
108
import { SingleLineBetaBanner } from '../../BetaBanners/SingleLineBetaBanner';
11-
import { ContosoCallContainer } from '../../CallComposite/snippets/Container.snippet';
12-
import { ConfigHintBanner } from '../../CallWithChatComposite/Utils';
13-
import {
14-
COMPONENT_FOLDER_PREFIX,
15-
compositeExperienceContainerStyle,
16-
overviewPageImagesStackStyle
17-
} from '../../constants';
18-
import { ArgsFrom, controlsToAdd, defaultCallCompositeHiddenControls } from '../../controlsUtils';
19-
import { compositeLocale } from '../../localizationUtils';
9+
import { COMPONENT_FOLDER_PREFIX, overviewPageImagesStackStyle } from '../../constants';
2010
import { exampleDisableCaptions } from './ClosedCaptions';
2111

2212
const getDocs: () => JSX.Element = () => {
@@ -31,32 +21,33 @@ const getDocs: () => JSX.Element = () => {
3121
or hard of hearing to follow along.
3222
</Description>
3323
<Description>
34-
Closed Captions is enabled by default and are automatically included within the CallComposite and
24+
Closed Captions is supported by default and are automatically included within the CallComposite and
3525
CallWithChatComposite experiences.
3626
</Description>
3727

38-
<Heading>ACS Based Captions</Heading>
28+
<Heading>Azure Communication Service Based Captions</Heading>
3929
<SingleLineBetaBanner topOfPage={true} />
4030
<Description>
41-
ACS Closed Captions are enabled by default and are automatically included within the CallComposite and
42-
CallWithChatComposite experiences for calling scenarios involving ACS users only. Captions can be enabled both
43-
in Mobile Web sessions and in Desktop Web sessions.
31+
Azure Communication Service Closed Captions are supported by default and are automatically included within the
32+
CallComposite and CallWithChatComposite experiences for calling scenarios involving Azure Communication Service
33+
users only. Captions can be enabled in both Mobile Web sessions and in Desktop Web sessions.
4434
</Description>
4535
<Description>
46-
For acs captions, users can enable captions in the menu and select the spoken language for the captions.
47-
Captions does not detect language automatically, so the spoken language selected needs to match the language
48-
that will be used in the call. Currently, ACS captions does not support translation.
36+
For Azure Communication Service captions, users can enable captions in the menu and select the spoken language
37+
for the captions. Captions does not detect language automatically, so the spoken language selected needs to
38+
match the language that will be used in the call. Currently, Azure Communication Service captions does not
39+
support translation.
4940
</Description>
5041

5142
<Heading>Teams Interop Closed Captions</Heading>
5243
<Description>
53-
Teams Interop Closed Captions is enabled by default and are automatically included within the CallComposite and
54-
CallWithChatComposite experiences during a call including one or more teams users.
44+
Teams Interop Closed Captions is supported by default and are automatically included within the CallComposite
45+
and CallWithChatComposite experiences during a call including one or more teams users.
5546
</Description>
5647
<Description>
57-
The main difference between ACS Closed Captions and Teams Interop Closed Captions is that Teams Interop Closed
58-
Captions supports translation. End users can choose to have captions translated to a different language by using
59-
captions settings.
48+
The main difference between Azure Communication Service Closed Captions and Teams Interop Closed Captions is
49+
that Teams Interop Closed Captions supports translation. End users can choose to have captions translated to a
50+
different language by using captions settings.
6051
</Description>
6152

6253
<Heading>How to use Captions</Heading>
@@ -76,40 +67,45 @@ const getDocs: () => JSX.Element = () => {
7667
</Description>
7768
<Stack tokens={{ childrenGap: '3rem' }} style={overviewPageImagesStackStyle}>
7869
<Stack.Item align="center">
79-
<Description>Using the more menu to turn on captions.</Description>
70+
<Subheading>Using the more menu to turn on captions</Subheading>
8071
<img
8172
style={{ width: '100%' }}
8273
src="images/StartCaptions.png"
8374
alt="example of component that can be used for starting captions"
8475
/>
8576
</Stack.Item>
8677
<Stack.Item align="center">
87-
<Description>Captions Setting modal to change spoken language.</Description>
78+
<Subheading>Captions Setting modal to change spoken language</Subheading>
8879
<img
8980
style={{ width: '100%' }}
9081
src="images/CaptionsSettings.png"
9182
alt="example of component that can be used for setting languages for captions"
9283
/>
9384
</Stack.Item>
9485
<Stack.Item align="center">
95-
<Description>Captions Setting modal to change spoken language and caption language.</Description>
86+
<Subheading>Captions Setting modal to change spoken language and caption language</Subheading>
9687
<img
9788
style={{ width: '100%' }}
9889
src="images/TeamsCaptionsSettings.png"
9990
alt="example of component that can be used for setting languages for teams captions"
10091
/>
10192
</Stack.Item>
10293
<Stack.Item align="center">
103-
<Description>Captions is started.</Description>
94+
<Subheading>Captions started</Subheading>
10495
<img
10596
style={{ width: '100%' }}
10697
src="images/Captions.png"
10798
alt="example of component that can be used for displaying captions"
10899
/>
109100
</Stack.Item>
101+
<PrimaryButton
102+
style={{ width: 'fit-content' }}
103+
text="Go to CallComposite to see captions in action"
104+
href="../?path=/story/composites-call-basicexample--basic-example"
105+
/>
110106
</Stack>
111107

112-
<Subheading>Disable captions</Subheading>
108+
<Heading>Disable captions</Heading>
113109
<Description>
114110
The UI Library enables users to hide captions UI when they do not wish to use the captions service.
115111
</Description>
@@ -119,62 +115,17 @@ const getDocs: () => JSX.Element = () => {
119115
);
120116
};
121117

122-
const storyControls = {
123-
userId: controlsToAdd.userId,
124-
token: controlsToAdd.token,
125-
displayName: controlsToAdd.requiredDisplayName,
126-
compositeFormFactor: controlsToAdd.formFactor,
127-
errorBar: controlsToAdd.showErrorBar
128-
};
129-
130-
const ClosedCaptionsStory = (args: ArgsFrom<typeof storyControls>, context): JSX.Element => {
131-
const {
132-
globals: { locale }
133-
} = context;
134-
135-
const containerProps = useMemo(() => {
136-
if (args.userId && args.token) {
137-
const containerProps = {
138-
userId: { communicationUserId: args.userId },
139-
token: args.token,
140-
locator: createGUID()
141-
};
142-
return containerProps;
143-
}
144-
return undefined;
145-
}, [args.userId, args.token]);
146-
147-
return (
148-
<Stack horizontalAlign="center" verticalAlign="center" styles={compositeExperienceContainerStyle}>
149-
{containerProps ? (
150-
<ContosoCallContainer
151-
fluentTheme={context.theme}
152-
rtl={context.globals.rtl === 'rtl'}
153-
displayName={args.displayName}
154-
{...containerProps}
155-
locale={compositeLocale(locale)}
156-
formFactor={args.compositeFormFactor}
157-
options={{ errorBar: args.errorBar }}
158-
/>
159-
) : (
160-
<ConfigHintBanner />
161-
)}
162-
</Stack>
163-
);
118+
const ClosedCaptionsStory = (): JSX.Element => {
119+
return <></>;
164120
};
165121

166122
export const ClosedCaptions = ClosedCaptionsStory.bind({});
167123

168124
export default {
169125
id: `${COMPONENT_FOLDER_PREFIX}-internal-ClosedCaptions`,
170126
title: `${COMPONENT_FOLDER_PREFIX}/Internal/ClosedCaptions`,
171-
component: CallComposite,
172-
argTypes: {
173-
...storyControls,
174-
// Hiding auto-generated controls
175-
...defaultCallCompositeHiddenControls
176-
},
177127
parameters: {
128+
previewTabs: { canvas: { disable: true, hidden: true } },
178129
docs: {
179130
page: () => getDocs()
180131
}

packages/storybook/stories/INTERNAL/ClosedCaptions/ClosedCaptions.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Licensed under the MIT License.
33

44
export const exampleDisableCaptions = `
5-
const options: CallWithChatCompositeOptions = {
5+
const options: CallCompositeOptions = {
66
callControls: {
77
captionsButton: false
88
}

0 commit comments

Comments
 (0)