Skip to content

Commit 66a37e2

Browse files
committed
docs: reformat voice-recording.mdx
1 parent 7f41302 commit 66a37e2

File tree

1 file changed

+94
-95
lines changed

1 file changed

+94
-95
lines changed

docusaurus/docs/React/components/message-components/attachment/voice-recording.mdx

+94-95
Original file line numberDiff line numberDiff line change
@@ -6,65 +6,65 @@ title: Voice Recording Attachment
66
import GHComponentLink from '../../../_docusaurus-components/GHComponentLink';
77
import ImageShowcase from '@site/src/components/ImageShowcase';
88

9-
import VoiceRecordingRequestPayload from "../../../assets/voice-recording-response-payload.png";
10-
import VoiceRecordingPlayer from "../../../assets/voice-recording-player.png";
11-
import VoiceRecordingPlayerInProgress from "../../../assets/voice-recording-player-in-progress.png";
12-
import VoiceRecordingPlayerStoppedRepro from "../../../assets/voice-recording-player-stopped-repro.png";
13-
import VoiceRecordingPlayerFileSizeFallback from "../../../assets/voice-recording-player-file-size-fallback.png";
14-
import VoiceRecordingPlayerFallbackTitle from "../../../assets/voice-recording-fallback-title.png";
15-
import VoiceRecordingPlayerMissingWaveformData from "../../../assets/voice-recording-empty-waveform-data.png";
16-
17-
import QuotedVoiceRecording from "../../../assets/voice-recording-quoted.png";
18-
import QuotedVoiceRecordingFileSizeFallback from "../../../assets/voice-recording-quoted-file-size-fallback.png";
19-
import QuotedVoiceRecordingFallbackTitle from "../../../assets/voice-recording-quoted-fallback-title.png";
9+
import VoiceRecordingRequestPayload from '../../../assets/voice-recording-response-payload.png';
10+
import VoiceRecordingPlayer from '../../../assets/voice-recording-player.png';
11+
import VoiceRecordingPlayerInProgress from '../../../assets/voice-recording-player-in-progress.png';
12+
import VoiceRecordingPlayerStoppedRepro from '../../../assets/voice-recording-player-stopped-repro.png';
13+
import VoiceRecordingPlayerFileSizeFallback from '../../../assets/voice-recording-player-file-size-fallback.png';
14+
import VoiceRecordingPlayerFallbackTitle from '../../../assets/voice-recording-fallback-title.png';
15+
import VoiceRecordingPlayerMissingWaveformData from '../../../assets/voice-recording-empty-waveform-data.png';
16+
17+
import QuotedVoiceRecording from '../../../assets/voice-recording-quoted.png';
18+
import QuotedVoiceRecordingFileSizeFallback from '../../../assets/voice-recording-quoted-file-size-fallback.png';
19+
import QuotedVoiceRecordingFallbackTitle from '../../../assets/voice-recording-quoted-fallback-title.png';
2020

2121
Audio attachments recorded directly from the chat UI are called voice recordings. The SDK provides a default implementation called <GHComponentLink text='VoiceRecording' path='/Attachment/VoiceRecording.tsx'/>. The default component renders or <GHComponentLink text='VoiceRecordingPlayer component' path='/Attachment/VoiceRecording.tsx'/> or <GHComponentLink text='QuotedVoiceRecording' path='/Attachment/VoiceRecording.tsx'/>.
2222

2323
The `VoiceRecordingPlayer` component is displayed in the message attachment list and is used to reproduce the audio.
2424

2525
<ImageShowcase
26-
border
27-
items={[
28-
{
29-
image: VoiceRecordingPlayer,
30-
caption: <span>VoiceRecordingPlayer component</span>,
31-
alt: 'Image of the VoiceRecordingPlayer component',
32-
},
33-
]}
26+
border
27+
items={[
28+
{
29+
image: VoiceRecordingPlayer,
30+
caption: <span>VoiceRecordingPlayer component</span>,
31+
alt: 'Image of the VoiceRecordingPlayer component',
32+
},
33+
]}
3434
/>
3535

3636
Whereas `QuotedVoiceRecording` is used to display basic information about the voice recording in quoted message reply.
3737

3838
<ImageShowcase
39-
border
40-
items={[
41-
{
42-
image: QuotedVoiceRecording,
43-
caption: <span>QuotedVoiceRecording component</span>,
44-
alt: 'Image of the QuotedVoiceRecording component',
45-
},
46-
]}
39+
border
40+
items={[
41+
{
42+
image: QuotedVoiceRecording,
43+
caption: <span>QuotedVoiceRecording component</span>,
44+
alt: 'Image of the QuotedVoiceRecording component',
45+
},
46+
]}
4747
/>
4848

4949
## Attachment payload
5050

5151
The response payload for the voice recording attachment comes with the following properties:
5252

5353
<ImageShowcase
54-
border
55-
items={[
56-
{
57-
image: VoiceRecordingRequestPayload,
58-
caption: <span>Voice recording payload</span>,
59-
alt: 'Image of the voice recording payload',
60-
},
61-
]}
54+
border
55+
items={[
56+
{
57+
image: VoiceRecordingRequestPayload,
58+
caption: <span>Voice recording payload</span>,
59+
alt: 'Image of the voice recording payload',
60+
},
61+
]}
6262
/>
6363

6464
These properties serve the following purpose:
6565

6666
| Property | Description |
67-
|-------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
67+
| ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
6868
| **asset_url** | the URL where the voice recording is downloaded from |
6969
| **duration** | the audio duration in seconds |
7070
| **file_size** | the file size in bytes (displayed as fallback to duration if duration is not available) |
@@ -80,29 +80,29 @@ These properties serve the following purpose:
8080
By clicking in the space of waveform or by dragging the progress indicator a user can navigate to a specific place in the audio track. The progress indicator is placed at the point of the click or drag end and the preceding amplitude bars are highlighted to manifest the progress.
8181

8282
<ImageShowcase
83-
border
84-
items={[
85-
{
86-
image: VoiceRecordingPlayerStoppedRepro,
87-
caption: <span>VoiceRecordingPlayer navigation</span>,
88-
alt: 'Image of the VoiceRecordingPlayer stopped in the middle of the reproduction',
89-
},
90-
]}
83+
border
84+
items={[
85+
{
86+
image: VoiceRecordingPlayerStoppedRepro,
87+
caption: <span>VoiceRecordingPlayer navigation</span>,
88+
alt: 'Image of the VoiceRecordingPlayer stopped in the middle of the reproduction',
89+
},
90+
]}
9191
/>
9292

9393
### Playback speed change
9494

95-
The playback speed can be changed by clicking the <GHComponentLink text='PlaybackRateButton' path='/Attachment/components/PlaybackRateButton.tsx'/>. The button is visible only during the audio reproduction. The rate is changed by repeatedly clicking the <GHComponentLink text='PlaybackRateButton' path='/Attachment/components/PlaybackRateButton.tsx'/>. Once the highest rate speed is achieved, the next click resets the speed to the initial value.
95+
The playback speed can be changed by clicking the <GHComponentLink text='PlaybackRateButton' path='/Attachment/components/PlaybackRateButton.tsx'/>. The button is visible only during the audio reproduction. The rate is changed by repeatedly clicking the <GHComponentLink text='PlaybackRateButton' path='/Attachment/components/PlaybackRateButton.tsx'/>. Once the highest rate speed is achieved, the next click resets the speed to the initial value.
9696

9797
<ImageShowcase
98-
border
99-
items={[
100-
{
101-
image: VoiceRecordingPlayerInProgress,
102-
caption: <span>VoiceRecordingPlayer playing the audio</span>,
103-
alt: 'Image of the VoiceRecordingPlayer playing the audio',
104-
},
105-
]}
98+
border
99+
items={[
100+
{
101+
image: VoiceRecordingPlayerInProgress,
102+
caption: <span>VoiceRecordingPlayer playing the audio</span>,
103+
alt: 'Image of the VoiceRecordingPlayer playing the audio',
104+
},
105+
]}
106106
/>
107107

108108
## UI Fallbacks
@@ -112,55 +112,54 @@ The playback speed can be changed by clicking the <GHComponentLink text='Playba
112112
If the duration is not available in the [attachment object payload](./#attachment-payload), `VoiceRecordingPlayer` as well as `QuotedVoiceRecording` component will display the attachment size instead.
113113

114114
<ImageShowcase
115-
border
116-
items={[
117-
{
118-
image: VoiceRecordingPlayerFileSizeFallback,
119-
caption: <span>VoiceRecordingPlayer displaying file size instead of audio duration</span>,
120-
alt: 'Image of the VoiceRecordingPlayer displaying file size instead of audio duration',
121-
},
122-
{
123-
image: QuotedVoiceRecordingFileSizeFallback,
124-
caption: <span>QuotedVoiceRecording displaying file size instead of audio duration</span>,
125-
alt: 'Image of the QuotedVoiceRecording displaying file size instead of audio duration',
126-
},
127-
]}
115+
border
116+
items={[
117+
{
118+
image: VoiceRecordingPlayerFileSizeFallback,
119+
caption: <span>VoiceRecordingPlayer displaying file size instead of audio duration</span>,
120+
alt: 'Image of the VoiceRecordingPlayer displaying file size instead of audio duration',
121+
},
122+
{
123+
image: QuotedVoiceRecordingFileSizeFallback,
124+
caption: <span>QuotedVoiceRecording displaying file size instead of audio duration</span>,
125+
alt: 'Image of the QuotedVoiceRecording displaying file size instead of audio duration',
126+
},
127+
]}
128128
/>
129129

130-
131130
### Missing title
132131

133132
If the voice recording does not come with title, a fallback title is provided.
134133

135134
<ImageShowcase
136-
border
137-
items={[
138-
{
139-
image: VoiceRecordingPlayerFallbackTitle,
140-
caption: <span>VoiceRecordingPlayer displaying the fallback title</span>,
141-
alt: 'Image of the VoiceRecordingPlayer displaying the fallback title',
142-
},
143-
{
144-
image: QuotedVoiceRecordingFallbackTitle,
145-
caption: <span>QuotedVoiceRecording displaying the fallback title</span>,
146-
alt: 'Image of the QuotedVoiceRecording displaying the fallback title',
147-
},
148-
]}
135+
border
136+
items={[
137+
{
138+
image: VoiceRecordingPlayerFallbackTitle,
139+
caption: <span>VoiceRecordingPlayer displaying the fallback title</span>,
140+
alt: 'Image of the VoiceRecordingPlayer displaying the fallback title',
141+
},
142+
{
143+
image: QuotedVoiceRecordingFallbackTitle,
144+
caption: <span>QuotedVoiceRecording displaying the fallback title</span>,
145+
alt: 'Image of the QuotedVoiceRecording displaying the fallback title',
146+
},
147+
]}
149148
/>
150149

151150
### Missing `waveform_data`
152151

153152
If the `waveform_data` is an empty array, then no progress bar is rendered.
154153

155154
<ImageShowcase
156-
border
157-
items={[
158-
{
159-
image: VoiceRecordingPlayerMissingWaveformData,
160-
caption: <span>VoiceRecordingPlayer without progress bar</span>,
161-
alt: 'Image of the VoiceRecordingPlayer missing progress bar',
162-
},
163-
]}
155+
border
156+
items={[
157+
{
158+
image: VoiceRecordingPlayerMissingWaveformData,
159+
caption: <span>VoiceRecordingPlayer without progress bar</span>,
160+
alt: 'Image of the VoiceRecordingPlayer missing progress bar',
161+
},
162+
]}
164163
/>
165164

166165
## Default components customization
@@ -187,23 +186,23 @@ import {
187186
QuotedVoiceRecording,
188187
} from 'stream-chat-react';
189188

190-
import {ChannelInner} from './ChannelInner';
189+
import { ChannelInner } from './ChannelInner';
191190

192191
const CustomVoiceRecording = ({ attachment, isQuoted }: VoiceRecordingProps) =>
193192
isQuoted ? (
194193
<QuotedVoiceRecording attachment={attachment} />
195194
) : (
196-
<VoiceRecordingPlayer attachment={attachment} playbackRates={[2.0, 3.0]} />
195+
<VoiceRecordingPlayer attachment={attachment} playbackRates={[2.0, 3.0]} />
197196
);
198197

199198
const CustomAttachment = (props: AttachmentProps) => (
200-
<Attachment {...props} VoiceRecording={CustomVoiceRecording}/>
199+
<Attachment {...props} VoiceRecording={CustomVoiceRecording} />
201200
);
202201

203202
const App = () => (
204-
<Channel Attachment={CustomAttachment}>
205-
<ChannelInner/>
206-
</Channel>
203+
<Channel Attachment={CustomAttachment}>
204+
<ChannelInner />
205+
</Channel>
207206
);
208207

209208
export default App;
@@ -215,7 +214,7 @@ This could be solved by customizing the styles. You can stop displaying the reco
215214
216215
```css
217216
.str-chat__message-attachment__voice-recording-widget__title {
218-
display: none;
217+
display: none;
219218
}
220219
```
221220

0 commit comments

Comments
 (0)