Skip to content

Commit 7d6294c

Browse files
carocao-msftdmceachernmsftprabhjot-msftmgamis-msftgithub-actions[bot]
authored
Fixed some captionsBanner naming issues, improved styling and internal storybook (#2844)
* captions composite * captions composite * captions composite * Change files * Duplicate change files for beta release * captions composite * captions composite * Video gallery show local tile and horizontal/vertical gallery when screensharing with no participant (#2822) * video gallery show local tile when screensharing * Change files * Duplicate change files for beta release * [VerticalGallery Bugfix] Video tile rendering controlled by index (#2818) * calculate indexes in verticalGallery * update logic to horizontal galleries using indexes * add logic to scrollable gallery 1D array * Change files * Duplicate change files for beta release * add to default layout * fix lint * generate paginated children from indexes array * remove the use of useCallBack * fix test throw error * remove console * [Vertical Gallery] Calculate children utils (#2823) * mock children calc functions * update index array to be created with values * Change files * Duplicate change files for beta release * fix lint * update max streams default * update comments * update comments --------- Signed-off-by: Donald McEachern <94866715+dmceachernmsft@users.noreply.github.com> * Video Effects Button and Pane (#2825) * Video effects button and Pane * Change files * Duplicate change files for beta release * minor change * minor changes * minor changes * minor change * minor change * minor changes * [A11y bugfix] Allow voice controls to action people button in Call and CallWithChat (#2833) * update aria strings for people button * fix ??? * Change files * Duplicate change files for beta release * Fix CTE storybook sample code (#2835) * memoize Teams call adapter args for CTE storybook sample code * Change files * Duplicate change files * lint fix * lint fix * [Vertical Galleries Bugfix] Horizontal gallery tile resizing (#2830) * update styles to allow horizontal resizing * Change files * Duplicate change files for beta release * fix test bug * create test file for horizontal resizing tests * change sizing in tests * Update packages/react-composites CallWithChatComposite browser test snapshots * Update packages/react-composites CallComposite browser test snapshots * Update packages/react-composites CallWithChatComposite browser test snapshots * write horizontal gallery tests * build API * Update packages/react-composites CallComposite browser test snapshots * Update packages/react-composites CallComposite browser test snapshots * update comments --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * [Refactor] Modal styles sizes change to rem (#2838) * Refactor modal sizes in VideoGallery to use rem instead of px * Change files * Duplicate change files * Update packages/react-composites CallComposite browser test snapshots * Update packages/react-composites CallComposite browser test snapshots --------- Co-authored-by: Donald McEachern <94866715+dmceachernmsft@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Keep dominant speakers on the first page of overflow gallery (#2819) * fix dominant speaker ordering to keep dominant speakers on the first page of overflow gallery * Change files * Duplicate change files * adding video participants at the end of dominant speaker list in case there is room * adjust max horizontal gallery dominant speakers based on pinned participants * order remote participants such that video participants are first. do not maintain order for indices after max dominant speakers. * update expectations in VideoGallery.test.tsx * added tests to videoGalleryLayoutUtils.test.tsx * change childrenPerPage initial value to 4 * update dominant speaker test expected value --------- Co-authored-by: Donald McEachern <94866715+dmceachernmsft@users.noreply.github.com> * [InlineImages] Update FileAdapter to include new method to download authenticated attachments from teams (#2827) * [AzureCommunicationAttachmentManager] Introduce new attachment manager * [AzureCommunicationChatAdapter] Bind new method to fetch attachments * [ChatAdapter] fixing spelling * [AzureCommunicationAttachmentManager.ts] Temp remove reference to ChatAttachment and use a string for now * Change files * Duplicate change files for beta release * [AzureCommunicationAttachmentManager.ts] fixing tagging * [AzureCommunicationFileUploadAdapter.ts] Combine the attachment manager into this adapter so all attachments logic is in one place * Change files * Duplicate change files for beta release * [APIView] updating apiview with new changes * [changelog] removing old change log * fix captions style and storybook * Change files * Duplicate change files for beta release * fix captions style and storybook * pr fix --------- Signed-off-by: Donald McEachern <94866715+dmceachernmsft@users.noreply.github.com> Co-authored-by: Donald McEachern <94866715+dmceachernmsft@users.noreply.github.com> Co-authored-by: prabhjot-msft <97124699+prabhjot-msft@users.noreply.github.com> Co-authored-by: mgamis-msft <79475487+mgamis-msft@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: JoshuaLai <9044372+JoshuaLai@users.noreply.github.com>
1 parent a0c332d commit 7d6294c

8 files changed

Lines changed: 107 additions & 78 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "none",
3+
"comment": "Fixed captionsBannerProps naming to adhere to internal type naming convention, improved styling and internal storybook",
4+
"packageName": "@azure/communication-react",
5+
"email": "carolinecao@microsoft.com",
6+
"dependentChangeType": "none"
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "none",
3+
"comment": "Fixed captionsBannerProps naming to adhere to internal type naming convention, improved styling and internal storybook",
4+
"packageName": "@azure/communication-react",
5+
"email": "carolinecao@microsoft.com",
6+
"dependentChangeType": "none"
7+
}

packages/react-components/review/beta/react-components.api.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -210,25 +210,23 @@ export interface CameraSitePermissionsProps extends CommonSitePermissionsProps {
210210
// @beta
211211
export type CameraSitePermissionsStrings = SitePermissionsStrings;
212212

213-
// Warning: (ae-internal-missing-underscore) The name "CaptionInfo" should be prefixed with an underscore because the declaration is marked as @internal
214-
//
215-
// @internal
216-
export type CaptionInfo = {
217-
displayName: string;
218-
caption: string;
219-
userId?: string;
220-
};
221-
222213
// @internal
223214
export const _CaptionsBanner: (props: _CaptionsBannerProps) => JSX.Element;
224215

225216
// @internal
226217
export interface _CaptionsBannerProps {
227218
// (undocumented)
228-
captions: CaptionInfo[];
219+
captions: _CaptionsInfo[];
229220
onRenderAvatar?: OnRenderAvatarCallback;
230221
}
231222

223+
// @internal
224+
export type _CaptionsInfo = {
225+
displayName: string;
226+
captionText: string;
227+
userId?: string;
228+
};
229+
232230
// @public
233231
export interface ChatMessage extends MessageCommon {
234232
// (undocumented)

packages/react-components/review/stable/react-components.api.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -122,25 +122,23 @@ export interface CameraButtonStyles extends ControlBarButtonStyles {
122122
menuStyles?: Partial<CameraButtonContextualMenuStyles>;
123123
}
124124

125-
// Warning: (ae-internal-missing-underscore) The name "CaptionInfo" should be prefixed with an underscore because the declaration is marked as @internal
126-
//
127-
// @internal
128-
export type CaptionInfo = {
129-
displayName: string;
130-
caption: string;
131-
userId?: string;
132-
};
133-
134125
// @internal
135126
export const _CaptionsBanner: (props: _CaptionsBannerProps) => JSX.Element;
136127

137128
// @internal
138129
export interface _CaptionsBannerProps {
139130
// (undocumented)
140-
captions: CaptionInfo[];
131+
captions: _CaptionsInfo[];
141132
onRenderAvatar?: OnRenderAvatarCallback;
142133
}
143134

135+
// @internal
136+
export type _CaptionsInfo = {
137+
displayName: string;
138+
captionText: string;
139+
userId?: string;
140+
};
141+
144142
// @public
145143
export interface ChatMessage extends MessageCommon {
146144
// (undocumented)

packages/react-components/src/components/CaptionsBanner.tsx

Lines changed: 9 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT license.
3-
import { IPersona, Persona, Stack, PersonaSize, Text, mergeStyles } from '@fluentui/react';
3+
import { IPersona, Persona, Stack, PersonaSize, Text } from '@fluentui/react';
44
import React, { useEffect, useRef } from 'react';
5-
import { _pxToRem } from '@internal/acs-ui-common';
65
import { _FileUploadCardsStrings } from './FileUploadCards';
76
import { OnRenderAvatarCallback } from '../types';
87
import { Ref } from '@fluentui/react-northstar';
8+
import { captionClassName, displayNameClassName, gridContainerClassName } from './styles/CaptionsBanner.style';
99

1010
/**
1111
* @internal
1212
* information required for each line of caption
1313
*/
14-
export type CaptionInfo = {
14+
export type _CaptionsInfo = {
1515
displayName: string;
16-
caption: string;
16+
captionText: string;
1717
userId?: string;
1818
};
1919

@@ -22,7 +22,7 @@ export type CaptionInfo = {
2222
* _CaptionsBanner Component Props.
2323
*/
2424
export interface _CaptionsBannerProps {
25-
captions: CaptionInfo[];
25+
captions: _CaptionsInfo[];
2626
/**
2727
* Optional callback to override render of the avatar.
2828
*
@@ -37,31 +37,6 @@ export interface _CaptionsBannerProps {
3737
*/
3838
export const _CaptionsBanner = (props: _CaptionsBannerProps): JSX.Element => {
3939
const { captions, onRenderAvatar } = props;
40-
41-
const gridContainerClassName = mergeStyles({
42-
overflowY: 'scroll',
43-
overflowX: 'hidden',
44-
width: '100%',
45-
height: _pxToRem(60),
46-
display: 'grid',
47-
gridTemplateColumns: '20% 80%',
48-
alignItems: 'stretch',
49-
columnGap: _pxToRem(16),
50-
padding: _pxToRem(8)
51-
});
52-
53-
const displayNameClassName = mergeStyles({
54-
fontWeight: 600,
55-
fontSize: _pxToRem(12),
56-
lineHeight: _pxToRem(30)
57-
});
58-
59-
const captionClassName = mergeStyles({
60-
fontWeight: 400,
61-
fontSize: _pxToRem(16),
62-
lineHeight: _pxToRem(30)
63-
});
64-
6540
const captionsScrollDivRef = useRef<HTMLElement>(null);
6641
const scrollToBottom = (): void => {
6742
if (captionsScrollDivRef.current) {
@@ -76,7 +51,7 @@ export const _CaptionsBanner = (props: _CaptionsBannerProps): JSX.Element => {
7651
return (
7752
<Ref innerRef={captionsScrollDivRef}>
7853
<div data-is-focusable={true} className={gridContainerClassName}>
79-
{captions.map((caption) => {
54+
{captions.map((caption, key) => {
8055
const personaOptions: IPersona = {
8156
hidePersonaDetails: true,
8257
size: PersonaSize.size24,
@@ -97,15 +72,15 @@ export const _CaptionsBanner = (props: _CaptionsBannerProps): JSX.Element => {
9772

9873
return (
9974
<>
100-
<div>
75+
<div key={`username_${key}`}>
10176
<Stack horizontal verticalAlign="center" horizontalAlign="end">
10277
<span>{userIcon}</span>
10378
<Text className={displayNameClassName}>{caption.displayName}</Text>
10479
</Stack>
10580
</div>
106-
<div>
81+
<div key={`captionText_${key}`}>
10782
<span>
108-
<Text className={captionClassName}>{caption.caption}</Text>
83+
<Text className={captionClassName}>{caption.captionText}</Text>
10984
</span>
11085
</div>
11186
</>
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// Copyright (c) Microsoft Corporation.
2+
// Licensed under the MIT license.
3+
4+
import { mergeStyles } from '@fluentui/react';
5+
import { _pxToRem } from '@internal/acs-ui-common';
6+
7+
/**
8+
* @private
9+
*/
10+
export const gridContainerClassName = mergeStyles({
11+
overflowY: 'scroll',
12+
overflowX: 'hidden',
13+
width: '100%',
14+
height: _pxToRem(60),
15+
display: 'grid',
16+
gridTemplateColumns: 'auto 1fr',
17+
alignItems: 'stretch',
18+
columnGap: _pxToRem(16),
19+
padding: _pxToRem(8)
20+
});
21+
22+
/**
23+
* @private
24+
*/
25+
export const displayNameClassName = mergeStyles({
26+
fontWeight: 600,
27+
fontSize: _pxToRem(12),
28+
lineHeight: _pxToRem(30)
29+
});
30+
31+
/**
32+
* @private
33+
*/
34+
export const captionClassName = mergeStyles({
35+
fontWeight: 400,
36+
fontSize: _pxToRem(16),
37+
lineHeight: _pxToRem(30)
38+
});

packages/storybook/stories/INTERNAL/Captions/CaptionsBanner/CaptionsBanner.stories.tsx

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Licensed under the MIT license.
33

44
import { PrimaryButton, Stack } from '@fluentui/react';
5-
import { CaptionInfo, _CaptionsBanner } from '@internal/react-components';
5+
import { _CaptionsInfo, _CaptionsBanner } from '@internal/react-components';
66
import { Meta } from '@storybook/react/types-6-0';
77
import React, { useState } from 'react';
88
import { COMPONENT_FOLDER_PREFIX } from '../../../constants';
@@ -15,7 +15,7 @@ import {
1515
} from './mockCaptions';
1616

1717
const CaptionsBannerStory = (): JSX.Element => {
18-
const [captions, setCaptions] = useState<CaptionInfo[]>(GenerateMockNewCaptions());
18+
const [captions, setCaptions] = useState<_CaptionsInfo[]>(GenerateMockNewCaptions());
1919

2020
const addNewCaption = (): void => {
2121
setCaptions([...captions, GenerateMockNewCaption()]);
@@ -30,24 +30,30 @@ const CaptionsBannerStory = (): JSX.Element => {
3030
};
3131

3232
const extendLastCaption = (): void => {
33-
captions[captions.length - 1].caption = `${captions[captions.length - 1].caption} hello`;
33+
captions[captions.length - 1].captionText = `${captions[captions.length - 1].captionText} hello`;
3434
setCaptions([...captions]);
3535
};
3636

3737
const containerStyles = {
3838
width: '100%',
3939
height: '100%',
40-
padding: '1rem'
40+
padding: '2rem'
4141
};
4242

4343
return (
44-
<Stack verticalFill tokens={{ childrenGap: '1rem' }} style={containerStyles}>
45-
<_CaptionsBanner captions={captions} />
44+
<Stack verticalFill tokens={{ childrenGap: '5rem' }} style={containerStyles} verticalAlign="space-between">
45+
<Stack style={{ border: 'solid grey 0.1rem' }} horizontalAlign="center">
46+
<Stack.Item style={{ width: '60%' }}>
47+
<_CaptionsBanner captions={captions} />
48+
</Stack.Item>
49+
</Stack>
4650

47-
<PrimaryButton text="Add new captions" onClick={addNewCaption} />
48-
<PrimaryButton text="Add new short captions" onClick={addNewShortCaption} />
49-
<PrimaryButton text="Add new captions with long name" onClick={addNewLongNameCaption} />
50-
<PrimaryButton text="Extend last caption" onClick={extendLastCaption} />
51+
<Stack horizontal horizontalAlign="space-between">
52+
<PrimaryButton text="Add new captions" onClick={addNewCaption} />
53+
<PrimaryButton text="Add new short captions" onClick={addNewShortCaption} />
54+
<PrimaryButton text="Add new captions with long name" onClick={addNewLongNameCaption} />
55+
<PrimaryButton text="Extend last caption" onClick={extendLastCaption} />
56+
</Stack>
5157
</Stack>
5258
);
5359
};
@@ -58,7 +64,7 @@ export const CaptionsBanner = CaptionsBannerStory.bind({});
5864

5965
export default {
6066
id: `${COMPONENT_FOLDER_PREFIX}-internal-CaptionsBanner`,
61-
title: `${COMPONENT_FOLDER_PREFIX}/Internal/CaptionsBanners/CaptionsBanner`,
67+
title: `${COMPONENT_FOLDER_PREFIX}/Internal/CaptionsBanner/CaptionsBanner`,
6268
component: _CaptionsBanner,
6369
argTypes: {
6470
captions: hiddenControl,
Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,53 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT license.
33

4-
import { CaptionInfo } from '@internal/react-components';
4+
import { _CaptionsInfo } from '@internal/react-components';
55

6-
export const GenerateMockNewCaption = (): CaptionInfo => {
6+
export const GenerateMockNewCaption = (): _CaptionsInfo => {
77
return {
88
displayName: 'SpongeBob',
9-
caption:
9+
captionText:
1010
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.'
1111
};
1212
};
1313

14-
export const GenerateMockNewShortCaption = (): CaptionInfo => {
14+
export const GenerateMockNewShortCaption = (): _CaptionsInfo => {
1515
return {
1616
displayName: 'SpongeBob Patrick',
17-
caption: 'Lorem ipsum dolor sit amet'
17+
captionText: 'Lorem ipsum dolor sit amet'
1818
};
1919
};
2020

21-
export const GenerateMockNewCaptionWithLongName = (): CaptionInfo => {
21+
export const GenerateMockNewCaptionWithLongName = (): _CaptionsInfo => {
2222
return {
2323
displayName: 'SpongeBob Patrick Robert',
24-
caption: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt'
24+
captionText: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt'
2525
};
2626
};
2727

28-
export const GenerateMockNewCaptions = (): CaptionInfo[] => {
28+
export const GenerateMockNewCaptions = (): _CaptionsInfo[] => {
2929
return [
3030
{
3131
displayName: 'Caroline',
32-
caption: 'Hello there'
32+
captionText: 'Hello there'
3333
},
3434
{
3535
displayName: 'Mike',
36-
caption: 'Hi welcome'
36+
captionText: 'Hi welcome'
3737
},
3838
{
3939
displayName: 'SpongeBob Patrick Robert',
40-
caption:
40+
captionText:
4141
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.'
4242
},
4343
{
4444
displayName: 'Patrick',
45-
caption:
45+
captionText:
4646
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.'
4747
},
4848
{
4949
displayName: 'Sandy',
50-
caption: 'Lorem ipsum dolor sit amet'
50+
captionText: 'Lorem ipsum dolor sit amet'
5151
}
5252
];
5353
};

0 commit comments

Comments
 (0)