|
1 | 1 | @namespace PrompterOne.Shared.Components.GoLive |
2 | | -@using PrompterOne.Core.Models.Workspace |
3 | 2 |
|
4 | 3 | <section class="gl-sources-panel"> |
5 | 4 | <div class="gl-sources-header"> |
|
52 | 51 | <span class="gl-cam-name">@source.Label</span> |
53 | 52 | <span class="gl-cam-hw">@GetSourceStatus(source)</span> |
54 | 53 | </div> |
55 | | - |
56 | | - <div class="gl-cam-row2"> |
57 | | - <div class="gl-cam-reader"> |
58 | | - <div class="@GetSourceAvatarCssClass(source)">@GetSourceAvatarInitial(source)</div> |
59 | | - <span class="gl-cam-reader-name">@GetSourceReaderLabel(source)</span> |
60 | | - </div> |
61 | | - |
62 | | - <div class="gl-crop-btns"> |
63 | | - @foreach (var crop in CropOptions) |
64 | | - { |
65 | | - var cropIsActive = GetCropSelection(source.SourceId) == crop; |
66 | | - <button type="button" |
67 | | - class="gl-crop-btn @(cropIsActive ? "active" : null)" |
68 | | - @onclick="() => SetCropSelection(source.SourceId, crop)">@GetCropLabel(crop)</button> |
69 | | - } |
70 | | - </div> |
71 | | - </div> |
72 | | - |
73 | | - <div class="gl-cam-script-tag @GetSourceScriptTagCssClass(source)"> |
74 | | - <svg width="10" |
75 | | - height="10" |
76 | | - viewBox="0 0 24 24" |
77 | | - fill="none" |
78 | | - stroke="currentColor" |
79 | | - stroke-width="2" |
80 | | - aria-hidden="true"> |
81 | | - <path d="M4 6h16M4 12h12M4 18h14" /> |
82 | | - </svg> |
83 | | - <span>@CurrentScriptTitle</span> |
84 | | - <span class="gl-script-progress">@CurrentScriptProgressLabel</span> |
85 | | - </div> |
86 | 54 | </div> |
87 | 55 | </button> |
88 | 56 |
|
|
128 | 96 | private const string PrompterUtilitySourceId = "prompter-display"; |
129 | 97 | private const string RemoveLabel = "Remove"; |
130 | 98 | private const string ScreenShareUtilitySourceId = "screen-share"; |
131 | | - private const string ScriptProgressDefaultLabel = "No script loaded"; |
132 | 99 | private const string SourceIncludedLabel = "Armed for output"; |
133 | 100 | private const string SourceLiveLabel = "Ready for canvas"; |
134 | 101 | private const string SourceOnAirLabel = "On air"; |
135 | 102 | private const string SourceSceneOnlyLabel = "Scene only"; |
136 | | - private static readonly IReadOnlyList<GoLiveCropPreset> CropOptions = |
137 | | - [ |
138 | | - GoLiveCropPreset.Full, |
139 | | - GoLiveCropPreset.HeadAndShoulders, |
140 | | - GoLiveCropPreset.Face |
141 | | - ]; |
142 | | - |
143 | | - private readonly Dictionary<string, GoLiveCropPreset> _cropSelections = new(StringComparer.Ordinal); |
144 | 103 |
|
145 | 104 | [Parameter] public EventCallback AddCamera { get; set; } |
146 | 105 | [Parameter] public string? ActiveSourceId { get; set; } |
147 | 106 | [Parameter] public bool CanAddCamera { get; set; } |
148 | | - [Parameter] public string CurrentScriptProgressLabel { get; set; } = ScriptProgressDefaultLabel; |
149 | | - [Parameter] public string CurrentScriptTitle { get; set; } = ScriptWorkspaceState.UntitledScriptTitle; |
150 | 107 | [Parameter] public bool HasPrimaryMicrophone { get; set; } |
151 | 108 | [Parameter] public string MicrophoneName { get; set; } = string.Empty; |
152 | 109 | [Parameter] public string MicrophoneRouteLabel { get; set; } = string.Empty; |
|
175 | 132 | : SourceSceneOnlyLabel; |
176 | 133 | } |
177 | 134 |
|
178 | | - private static string GetCropLabel(GoLiveCropPreset crop) => |
179 | | - crop switch |
180 | | - { |
181 | | - GoLiveCropPreset.HeadAndShoulders => "H&S", |
182 | | - GoLiveCropPreset.Face => "Face", |
183 | | - _ => "Full" |
184 | | - }; |
185 | | - |
186 | | - private static string GetSourceAvatarInitial(SceneCameraSource source) |
187 | | - { |
188 | | - return string.IsNullOrWhiteSpace(source.Label) |
189 | | - ? "C" |
190 | | - : source.Label[..1].ToUpperInvariant(); |
191 | | - } |
192 | | - |
193 | | - private string GetSourceAvatarCssClass(SceneCameraSource source) |
194 | | - { |
195 | | - var classes = new List<string> { "gl-cam-avatar" }; |
196 | | - classes.Add(IsActive(source) |
197 | | - ? "gl-cam-avatar-live" |
198 | | - : IsSelected(source) |
199 | | - ? "gl-cam-avatar-preview" |
200 | | - : "gl-cam-avatar-idle"); |
201 | | - return string.Join(' ', classes); |
202 | | - } |
203 | | - |
204 | | - private string GetSourceReaderLabel(SceneCameraSource source) |
205 | | - { |
206 | | - if (IsActive(source)) |
207 | | - { |
208 | | - return SourceOnAirLabel; |
209 | | - } |
210 | | - |
211 | | - if (IsSelected(source)) |
212 | | - { |
213 | | - return SourceLiveLabel; |
214 | | - } |
215 | | - |
216 | | - return source.Transform.IncludeInOutput |
217 | | - ? SourceIncludedLabel |
218 | | - : SourceSceneOnlyLabel; |
219 | | - } |
220 | | - |
221 | 135 | private string GetSourceBadge(SceneCameraSource source) |
222 | 136 | { |
223 | 137 | if (IsActive(source)) |
|
232 | 146 | : SourceSceneOnlyLabel; |
233 | 147 | } |
234 | 148 |
|
235 | | - private string GetSourceScriptTagCssClass(SceneCameraSource source) |
236 | | - { |
237 | | - return IsActive(source) || IsSelected(source) |
238 | | - ? "gl-script-active" |
239 | | - : string.Empty; |
240 | | - } |
241 | | - |
242 | | - private GoLiveCropPreset GetCropSelection(string sourceId) |
243 | | - { |
244 | | - return _cropSelections.TryGetValue(sourceId, out var crop) ? crop : GoLiveCropPreset.Full; |
245 | | - } |
246 | | - |
247 | | - private void SetCropSelection(string sourceId, GoLiveCropPreset crop) |
248 | | - { |
249 | | - _cropSelections[sourceId] = crop; |
250 | | - } |
251 | | - |
252 | 149 | private string GetSourceCardCssClass(SceneCameraSource source) |
253 | 150 | { |
254 | 151 | var classes = new List<string> { "gl-cam-card" }; |
|
0 commit comments