-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathTeleprompterPage.razor
More file actions
236 lines (228 loc) · 21.2 KB
/
TeleprompterPage.razor
File metadata and controls
236 lines (228 loc) · 21.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
@page "/teleprompter"
@namespace PrompterOne.Shared.Pages
@using PrompterOne.Shared.Components
@using PrompterOne.Shared.Contracts
<div id="@UiDomIds.Design.TeleprompterScreen"
class="screen active"
tabindex="0"
@ref="_screenRoot"
@onkeydown="HandleTeleprompterKeyDownAsync"
@onkeydown:preventDefault="true"
data-test="@UiTestIds.Teleprompter.Page">
<div class="rd">
<TeleprompterReaderBackdrop CameraAutoStart="@_cameraLayer.AutoStart" CameraCssClass="@BuildCameraCssClass()"
CameraDeviceId="@_cameraLayer.DeviceId" CameraElementId="@_cameraLayer.ElementId"
CameraOrder="@_cameraLayer.Order" CameraRole="@_cameraLayer.Role" CameraStyle="@BuildCameraStyle()"
CameraTestId="@_cameraLayer.TestId" CameraTintCssClass="@BuildCameraTintCssClass()"
GradientCssClass="@BuildReaderGradientCssClass()" GradientValue="@_gradientClass"
IsCameraActive="@_isReaderCameraActive" />
<div class="rd-ui">
<TeleprompterReaderHeader BackButtonCssClass="@BuildReaderBackButtonCssClass()"
CountdownCssClass="@BuildCountdownCssClass()" CountdownLabel="@BuildCountdownLabel()"
OnBack="NavigateBackToEditorAsync" />
<div class="rd-left-rail">
<TeleprompterReaderMirrorToggles FullscreenButtonCssClass="@BuildReaderFullscreenButtonCssClass()" FullscreenTitle="@ReaderFullscreenTitle"
IsFullscreenActive="@_isReaderFullscreenActive" IsMirrorHorizontal="@_isReaderMirrorHorizontal"
IsMirrorVertical="@_isReaderMirrorVertical" IsRotatedOrientation="@(_readerTextOrientation != ReaderTextOrientation.Landscape)"
MirrorHorizontalButtonCssClass="@BuildReaderMirrorButtonCssClass(_isReaderMirrorHorizontal)" MirrorHorizontalLabel="@ReaderMirrorHorizontalLabel"
MirrorHorizontalTitle="@ReaderMirrorHorizontalTitle" MirrorVerticalButtonCssClass="@BuildReaderMirrorButtonCssClass(_isReaderMirrorVertical)"
MirrorVerticalLabel="@ReaderMirrorVerticalLabel" MirrorVerticalTitle="@ReaderMirrorVerticalTitle"
OnToggleFullscreen="ToggleReaderFullscreenAsync" OnToggleMirrorHorizontal="ToggleReaderMirrorHorizontalAsync"
OnToggleMirrorVertical="ToggleReaderMirrorVerticalAsync" OnToggleOrientation="ToggleReaderOrientationAsync"
OrientationButtonCssClass="@BuildReaderOrientationButtonCssClass()" OrientationTitle="@ReaderOrientationTitle"
TooltipCssClassFactory="BuildRailTooltipCssClass" TooltipDomIdFactory="BuildRailTooltipDomId"
TooltipFocusIn="HandleRailTooltipFocusIn" TooltipFocusOut="HandleRailTooltipFocusOut"
TooltipKeyDown="HandleRailTooltipKeyDown" TooltipPointerDown="HandleRailTooltipPointerDown"
TooltipPointerEnter="HandleRailTooltipPointerEnter" TooltipPointerLeave="HandleRailTooltipPointerLeave"
TooltipTestIdFactory="BuildRailTooltipTestId" />
<TeleprompterReaderAlignmentControls AlignmentCenterButtonCssClass="@BuildReaderAlignmentButtonCssClass(ReaderTextAlignment.Center)"
AlignmentJustifyButtonCssClass="@BuildReaderAlignmentButtonCssClass(ReaderTextAlignment.Justify)"
AlignmentLeftButtonCssClass="@BuildReaderAlignmentButtonCssClass(ReaderTextAlignment.Left)"
AlignmentRightButtonCssClass="@BuildReaderAlignmentButtonCssClass(ReaderTextAlignment.Right)"
AlignCenterTitle="@ReaderTextAlignCenterTitle" AlignJustifyTitle="@ReaderTextAlignJustifyTitle"
AlignLeftTitle="@ReaderTextAlignLeftTitle" AlignRightTitle="@ReaderTextAlignRightTitle"
IsCenterAlignment="@(_readerTextAlignment == ReaderTextAlignment.Center)" IsJustifyAlignment="@(_readerTextAlignment == ReaderTextAlignment.Justify)"
IsLeftAlignment="@(_readerTextAlignment == ReaderTextAlignment.Left)" IsRightAlignment="@(_readerTextAlignment == ReaderTextAlignment.Right)"
OnSetCenterAlignment="@(() => SetReaderTextAlignmentAsync(ReaderTextAlignment.Center))" OnSetJustifyAlignment="@(() => SetReaderTextAlignmentAsync(ReaderTextAlignment.Justify))"
OnSetLeftAlignment="@(() => SetReaderTextAlignmentAsync(ReaderTextAlignment.Left))" OnSetRightAlignment="@(() => SetReaderTextAlignmentAsync(ReaderTextAlignment.Right))"
TooltipCssClassFactory="BuildRailTooltipCssClass" TooltipDomIdFactory="BuildRailTooltipDomId"
TooltipFocusIn="HandleRailTooltipFocusIn" TooltipFocusOut="HandleRailTooltipFocusOut"
TooltipKeyDown="HandleRailTooltipKeyDown" TooltipPointerDown="HandleRailTooltipPointerDown"
TooltipPointerEnter="HandleRailTooltipPointerEnter" TooltipPointerLeave="HandleRailTooltipPointerLeave"
TooltipTestIdFactory="BuildRailTooltipTestId" />
</div>
<TeleprompterReaderSliders FontMax="@ReaderMaxFontSize" FontMin="@ReaderMinFontSize" FontTitle="@ReaderFontSliderTitle"
FontValue="@_readerFontSize" FocalMax="@ReaderMaxFocalPointPercent" FocalMin="@ReaderMinFocalPointPercent"
FocalTitle="@ReaderFocalSliderTitle" FocalValue="@_readerFocalPointPercent" OnFontInput="HandleReaderFontSizeInputAsync"
OnFocalInput="HandleReaderFocalPointInputAsync" OnWidthInput="HandleReaderTextWidthInputAsync"
OnSetSpeedCueDisplayMultiplier="@(() => SetReaderSpeedCueDisplayModeAsync(ReaderSpeedCueDisplayMode.Multiplier))"
OnSetSpeedCueDisplayWpm="@(() => SetReaderSpeedCueDisplayModeAsync(ReaderSpeedCueDisplayMode.WordsPerMinute))"
SpeedCueDisplayMode="@_readerSpeedCueDisplayMode" SpeedCueDisplayMultiplierTitle="@ReaderSpeedCueDisplayMultiplierTitle"
SpeedCueDisplayTitle="@ReaderSpeedCueDisplayTitle" SpeedCueDisplayWpmTitle="@ReaderSpeedCueDisplayWpmTitle"
TooltipCssClassFactory="BuildRailTooltipCssClass" TooltipDomIdFactory="BuildRailTooltipDomId"
TooltipFocusIn="HandleRailTooltipFocusIn" TooltipFocusOut="HandleRailTooltipFocusOut"
TooltipKeyDown="HandleRailTooltipKeyDown" TooltipPointerDown="HandleRailTooltipPointerDown"
TooltipPointerEnter="HandleRailTooltipPointerEnter" TooltipPointerLeave="HandleRailTooltipPointerLeave"
TooltipTestIdFactory="BuildRailTooltipTestId" WidthMax="@ReaderMaxTextWidthPercent"
WidthMin="@ReaderMinTextWidthPercent" WidthTitle="@ReaderWidthSliderTitle"
WidthValue="@_readerTextWidthPercent" WidthValueLabel="@BuildReaderWidthLabel()" />
<div class="@BuildReaderStageCssClass()"
id="@UiDomIds.Teleprompter.Stage"
data-test="@UiTestIds.Teleprompter.Stage"
style="@BuildReaderStageStyle()">
<div class="rd-center-guide"></div>
<div class="@BuildFocalGuideCssClass()"
id="@UiDomIds.Teleprompter.FocalGuide"
data-test="@UiTestIds.Teleprompter.FocalGuide"
style="@BuildFocalGuideStyle()"></div>
<div class="@BuildWidthGuideCssClass(true)"
id="@UiDomIds.Teleprompter.WidthGuideLeft"
style="@BuildWidthGuideStyle(true)"></div>
<div class="@BuildWidthGuideCssClass(false)"
id="@UiDomIds.Teleprompter.WidthGuideRight"
style="@BuildWidthGuideStyle(false)"></div>
<div class="rd-cluster-wrap"
id="@UiDomIds.Teleprompter.ClusterWrap"
data-reader-orientation="@BuildReaderOrientationDataAttribute()"
data-reader-text-alignment="@BuildReaderTextAlignmentDataAttribute()"
data-test="@UiTestIds.Teleprompter.ClusterWrap"
style="@BuildClusterWrapStyle()">
@foreach (var entry in _cards.Select((card, index) => (card, index)))
{
<div class="@BuildReaderCardCssClass(entry.index)"
data-reader-card-state="@BuildReaderCardStateDataAttribute(entry.index)"
data-test="@entry.card.TestId">
<div class="rd-cluster rd-cluster-active"
data-test="@UiTestIds.Teleprompter.CardCluster(entry.index)">
<div class="rd-cluster-emotion">
<span class="rd-emo-marker"
aria-label="@entry.card.EmotionLabel">@entry.card.EmotionMarker</span>
<span class="rd-emo-name">@entry.card.EmotionLabel</span>
<span class="rd-emo-wpm">@entry.card.TargetWpm <small>@Text(UiTextKey.CommonWpm)</small></span>
</div>
@if (entry.card.Attachments.Count > 0)
{
<div class="rd-attachments"
data-test="@UiTestIds.Teleprompter.CardAttachments(entry.index)">
@foreach (var attachment in entry.card.Attachments.Select((value, index) => (value, index)))
{
<div class="rd-attachment"
data-test="@UiTestIds.Teleprompter.CardAttachment(entry.index, attachment.index)">
@if (!string.IsNullOrWhiteSpace(attachment.value.PreviewDataUrl))
{
<img class="rd-attachment-thumb"
src="@attachment.value.PreviewDataUrl"
alt="" />
}
else
{
<span class="rd-attachment-icon" aria-hidden="true">▣</span>
}
<span class="rd-attachment-name">@attachment.value.FileName</span>
<span class="rd-attachment-meta">@attachment.value.KindLabel · @attachment.value.SizeLabel</span>
</div>
}
</div>
}
<p class="rd-cluster-text"
id="@UiDomIds.Teleprompter.CardText(entry.index)"
style="@BuildReaderCardTextStyle(entry.index)"
data-test="@UiTestIds.Teleprompter.CardText(entry.index)">
<span class="rd-focus-lens"
id="@UiDomIds.Teleprompter.FocusLens(entry.index)"
aria-hidden="true"></span>
@for (var chunkIndex = 0; chunkIndex < entry.card.Chunks.Count; chunkIndex++)
{
var chunk = entry.card.Chunks[chunkIndex];
var nextChunk = chunkIndex < entry.card.Chunks.Count - 1
? entry.card.Chunks[chunkIndex + 1]
: null;
if (chunk is ReaderGroupViewModel group)
{
<span class="@BuildReaderGroupCssClass(entry.index, chunkIndex)"
data-emphasis="@BuildBooleanDataAttribute(group.IsEmphasis)"
data-test="@UiTestIds.Teleprompter.CardGroup(entry.index, chunkIndex)">
@for (var wordIndex = 0; wordIndex < group.Words.Count; wordIndex++)
{
var word = group.Words[wordIndex];
var speedCueLabel = BuildReaderWordSpeedCueLabel(word, entry.card.TargetWpm);
<span class="@BuildReaderWordCssClass(entry.index, chunkIndex, wordIndex)"
id="@UiDomIds.Teleprompter.CardWord(entry.index, chunkIndex, wordIndex)"
@attributes="BuildReaderWordDataAttributes(word, entry.card.TargetWpm, entry.index, chunkIndex, wordIndex)"
style="@word.Style"
data-test="@BuildReaderWordTestId(entry.index, chunkIndex, wordIndex)">
@if (!string.IsNullOrWhiteSpace(word.EmotionMarker))
{
<span class="rd-emotion-marker"
aria-label="@word.EmotionLabel"
@attributes="BuildReaderEmotionMarkerDataAttributes(word)"
data-test="@UiTestIds.Teleprompter.CardWordEmotionMarker(entry.index, chunkIndex, wordIndex)"></span>
}
@word.Text
</span>
@if (!string.IsNullOrWhiteSpace(speedCueLabel))
{
<span class="rd-speed-cue-label"
@attributes="BuildReaderSpeedCueLabelDataAttributes(speedCueLabel)"
data-test="@UiTestIds.Teleprompter.CardWordSpeedCueLabel(entry.index, chunkIndex, wordIndex)">@speedCueLabel</span>
}
@if (wordIndex < group.Words.Count - 1)
{
@(" ")
}
}
</span>
}
else if (chunk is ReaderPauseViewModel pause)
{
<span class="@BuildReaderPauseCssClass(entry.index, chunkIndex, pause)"
id="@UiDomIds.Teleprompter.CardChunk(entry.index, chunkIndex)"
@attributes="BuildReaderPauseDataAttributes(pause)"></span>
}
else if (chunk is ReaderEditPointViewModel editPoint)
{
<span class="@editPoint.CssClass"
@attributes="BuildReaderEditPointDataAttributes(editPoint)"
aria-hidden="true"></span>
}
if (nextChunk is ReaderGroupViewModel)
{
@(" ")
}
}
</p>
</div>
</div>
}
</div>
</div>
<TeleprompterReaderTransport BlockIndicatorLabel="@BuildBlockIndicatorLabel()" CameraButtonCssClass="@BuildCameraButtonCssClass()"
CameraTooltip="@ReaderCameraTooltip" ControlsCssClass="@BuildReaderControlsCssClass()"
EdgeInfoCssClass="@BuildReaderEdgeInfoCssClass()" EdgeProgressCssClass="@BuildReaderEdgeProgressCssClass()"
EdgeSectionLabel="@_edgeSectionLabel" EdgeSegments="@BuildReaderEdgeSegments()" ElapsedLabel="@BuildElapsedLabel()"
IsAutoLoopEnabled="@_isReaderAutoLoopEnabled" IsCameraActive="@_isReaderCameraActive" IsReaderPlaying="@_isReaderPlaying"
IsRecordingActive="@_isReaderRecording"
NextBlockTooltip="@ReaderNextBlockTooltip"
NextWordTooltip="@ReaderNextWordTooltip" OnCameraToggle="ToggleReaderCameraAsync" OnNextBlock="JumpToNextReaderCardAsync"
OnAutoLoopToggle="ToggleReaderAutoLoopAsync" OnNextWord="StepReaderForwardAsync" OnPlayToggle="ToggleReaderPlaybackAsync" OnPreviousBlock="JumpToPreviousReaderCardAsync"
OnPreviousWord="StepReaderBackwardAsync" OnSpeedDown="DecreaseReaderPlaybackSpeedAsync" OnSpeedUp="IncreaseReaderPlaybackSpeedAsync"
OnRecordingToggle="ToggleReaderRecordingAsync" OnRecordingCameraChange="HandleReaderRecordingCameraChangeAsync"
OnRecordingMicrophoneChange="HandleReaderRecordingMicrophoneChangeAsync" OnRecordingModeChange="HandleReaderRecordingModeChangeAsync"
AutoLoopTooltip="@ReaderAutoLoopTooltip" PlayToggleTooltip="@ReaderPlayToggleTooltip" PreviousBlockTooltip="@ReaderPreviousBlockTooltip"
PreviousWordTooltip="@ReaderPreviousWordTooltip" ProgressFillStyle="@BuildReaderProgressStyle()"
ProgressLabel="@BuildReaderProgressLabel()" ProgressSegments="@BuildReaderProgressSegments()"
ProgressShellCssClass="@BuildReaderProgressShellCssClass()" SpeedDownTooltip="@ReaderSpeedDownTooltip"
RecordingCameraTooltip="@ReaderRecordingCameraTooltip" RecordingCameras="@_readerRecordingCameras"
RecordingLevelLabel="@ReaderRecordingLevelLabel"
RecordingLevelPercent="@_readerRecordingAudioLevelPercent" RecordingMicrophones="@_readerRecordingMicrophones"
RecordingMicrophoneTooltip="@ReaderRecordingMicrophoneTooltip" RecordingMode="@_readerRecordingMode"
RecordingModeTooltip="@ReaderRecordingModeTooltip" RecordingStartLabel="@ReaderRecordingStartLabel"
RecordingStatusLabel="@ReaderRecordingStatusLabel" RecordingStopLabel="@ReaderRecordingStopLabel"
RecordingToggleTooltip="@ReaderRecordingToggleTooltip" SelectedRecordingCameraId="@_readerRecordingCameraId"
SelectedRecordingMicrophoneId="@_readerRecordingMicrophoneId"
SpeedUpTooltip="@ReaderSpeedUpTooltip"
SpeedValueLabel="@BuildReaderSpeedLabel()"
TimeDataAttributes="@BuildReaderTimeDataAttributes()" />
</div>
</div>
</div>