Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions localization/TranscriberAdmin-en-1.2.xliff
Original file line number Diff line number Diff line change
Expand Up @@ -6521,13 +6521,6 @@
<context context-type="sourcefile">GeneralResourceDeleteDialog.tsx</context>
</context-group>
</trans-unit>
<trans-unit id="passageDetailArtifacts.createResources">
<source>Create Resources</source>
<target/>
<context-group>
<context context-type="sourcefile">PassageMedia.tsx</context>
</context-group>
</trans-unit>
<trans-unit id="passageDetailArtifacts.createXResources">
<source>Create {0} resources</source>
<target/>
Expand Down
6 changes: 0 additions & 6 deletions localization/TranscriberAdmin-en.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -5590,12 +5590,6 @@
<target/>
</segment>
</unit>
<unit id="passageDetailArtifacts.createResources">
<segment>
<source>Create Resources</source>
<target/>
</segment>
</unit>
<unit id="passageDetailArtifacts.createXResources">
<segment>
<source>Create {0} resources</source>
Expand Down
1 change: 1 addition & 0 deletions web/public/localization/strings0a33bab6.json

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion web/public/localization/stringsa12d2133.json

This file was deleted.

1 change: 0 additions & 1 deletion web/src/components/AudioTab/AudioTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,6 @@ export function AudioTab() {
<Uploader
isOpen={uploadVisible}
onOpen={setUploadVisible}
showMessage={showMessage}
multiple={true}
finish={afterUpload}
cancelled={cancelled}
Expand Down
54 changes: 12 additions & 42 deletions web/src/components/MediaRecord.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ import { useRecordSave } from './useRecordSave';
import { shallowEqual, useSelector } from 'react-redux';
import { passageRecordSelector, sharedSelector } from '../selector';

// TODO cleanup in next PR: no caller passes setCanCancel, onLoaded,
// hideControls, onProgress, onDuration or hasRecording, and cancelMethod is
// never read. (controlsRef is only passed by the Cypress specs; keep it.)
// TODO cleanup: controlsRef is only passed by the Cypress specs
export interface IProps {
toolId: string;
artifactId: string | null;
Expand Down Expand Up @@ -104,9 +102,7 @@ export interface IProps {
* path.
*/
onSaveRejected?: (() => void) | undefined;
setCanCancel?: ((canCancel: boolean) => void) | undefined;
setStatusText: (status: string) => void;
cancelMethod?: (() => void) | undefined;
allowRecord?: boolean | undefined;
oneTryOnly?: boolean | undefined;
allowWave?: boolean | undefined;
Expand All @@ -115,7 +111,6 @@ export interface IProps {
doReset?: boolean | undefined;
setDoReset?: ((r: boolean) => void) | undefined;
preload?: number | undefined;
onLoaded?: (() => void) | undefined;
autoStart?: boolean | undefined;
trackState?: ((mediaState: IMediaState) => void) | undefined;
noNewVoice?: boolean | undefined;
Expand All @@ -124,14 +119,10 @@ export interface IProps {
/** When true, disable drag-to-create-region (the red loop region) on the waveform. */
disableDragSelection?: boolean;
controlsRef?: React.RefObject<WSAudioPlayerControls | null>;
hideControls?: boolean;
/** Forwarded to WSAudioPlayer: when false, this recorder claims no keyboard
* shortcuts (so an off-screen instance yields them). Default true. */
hotkeys?: boolean;
onProgress?: (progress: number) => void;
onDuration?: (duration: number) => void;
hideToolbar?: boolean;
hasRecording?: boolean;
isStopLogic?: boolean;
showSize?: boolean;
handleUpload?: () => void;
Expand Down Expand Up @@ -180,7 +171,6 @@ function MediaRecord(props: IProps) {
beforeUpload,
setCanSave,
setHasTake,
setCanCancel,
setStatusText,
allowRecord,
oneTryOnly,
Expand All @@ -191,21 +181,16 @@ function MediaRecord(props: IProps) {
height,
metaData,
preload,
onLoaded,
trackState,
noNewVoice,
allowNoNoise,
allowZoom,
disableDragSelection,
controlsRef,
hideControls,
hotkeys = true,
onProgress,
onDuration,
hideToolbar,
width,
keepItSmall,
hasRecording,
isStopLogic,
showSize = true,
handleUpload,
Expand Down Expand Up @@ -344,21 +329,15 @@ function MediaRecord(props: IProps) {
processingRecordingRef.current = value;
};

const handleWaveformDuration = useCallback(
(duration: number) => {
setWaveformDuration((prev) => {
// Only ignore a spurious zero while finalizing a recording stop (peaks race).
if (duration <= 0 && processingRecordingRef.current) {
return prev;
}
return duration;
});
if (duration > 0 || !processingRecordingRef.current) {
onDuration?.(duration);
const handleWaveformDuration = useCallback((duration: number) => {
setWaveformDuration((prev) => {
// Only ignore a spurious zero while finalizing a recording stop (peaks race).
if (duration <= 0 && processingRecordingRef.current) {
return prev;
}
},
[onDuration]
);
return duration;
});
}, []);

const getCompressedStatusMessage = useCallback(() => {
if (allowWave) {
Expand Down Expand Up @@ -621,10 +600,6 @@ function MediaRecord(props: IProps) {
queuedTake,
]);

useEffect(() => {
if (setCanCancel) setCanCancel(!inFlight);
}, [inFlight, setCanCancel]);

// A usable take is loaded in the waveform — the same readiness canSave
// requires, but without the (pendingSave || filechanged) dirty gate. A
// successful upload clears those flags (so canSave drops) yet leaves the take
Expand All @@ -640,8 +615,8 @@ function MediaRecord(props: IProps) {
// parent, which CODING_STANDARDS "Effects" calls a finding. Notify the parent
// from the handlers that change hasTake's inputs (recording start/stop,
// waveform load, upload start/finish), or lift those inputs up so the parent
// derives hasTake itself. setCanSave/setCanCancel above follow the same
// pattern and should move together.
// derives hasTake itself. setCanSave follows the same pattern and should
// move together.
useEffect(() => {
setHasTake?.(hasTake);
}, [hasTake, setHasTake]);
Expand Down Expand Up @@ -684,7 +659,6 @@ function MediaRecord(props: IProps) {
// Keep loading true until wavesurfer reports ready (setBlobReady(true)).
// Clearing here left Record looking idle while the waveform decoded.
setBlobReady(false);
onLoaded && onLoaded();
setAudioBlob(b);
};

Expand Down Expand Up @@ -714,7 +688,6 @@ function MediaRecord(props: IProps) {
loadInFlightRef.current = false;
setLoadBusy(false);
setStatusText('');
onLoaded && onLoaded();
};
const blobError = (urlorError: string) => {
showMessage(urlorError);
Expand All @@ -730,7 +703,7 @@ function MediaRecord(props: IProps) {
setOriginalBlob(undefined);
},
// eslint-disable-next-line react-hooks/exhaustive-deps

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we decided as a team that we don't need to do these

[ts.mediaError, showMessage, onLoaded]
[ts.mediaError, showMessage]
);
const getGoodUrl = async () => {
const TWENTY_MINUTES = 20 * 60 * 1000; // 20 minutes in milliseconds
Expand Down Expand Up @@ -877,19 +850,16 @@ function MediaRecord(props: IProps) {
onPlayStatus={onPlayStatus}
doReset={doReset}
autoStart={autoStart}
onProgress={onProgress}
onDuration={handleWaveformDuration}
controlsRef={controlsRef}
hideToolbar={hideToolbar}
hideControls={hideControls}
segments={segments}
reload={gotTheBlob}
noNewVoice={noNewVoice}
allowNoNoise={allowNoNoise}
captureEchoCancellation={captureAudioProcessing.echoCancellation}
captureNoiseSuppression={captureAudioProcessing.noiseSuppression}
keepItSmall={keepItSmall}
hasRecording={hasRecording ?? false}
isStopLogic={effectiveIsStopLogic}
hideWaveformEditTools={simplified}
isRecordingRights={isRecordingRights}
Expand Down
3 changes: 0 additions & 3 deletions web/src/components/MediaUploadContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ interface IProps {
ready?: boolean | undefined; // false disables the save/upload button
speaker?: string | undefined;
onSpeaker?: ((speaker: string) => void) | undefined;
team?: string | undefined; // used to check for speakers when adding a card
onFiles?: ((files: File[]) => void) | undefined;
inValue?: string | undefined;
audioOnly?: boolean | undefined;
Expand Down Expand Up @@ -211,7 +210,6 @@ function MediaUploadContent(props: IProps) {
ready,
speaker,
onSpeaker,
team,
onFiles,
inValue,
audioOnly,
Expand Down Expand Up @@ -430,7 +428,6 @@ function MediaUploadContent(props: IProps) {
name={hasRights ? speaker || '' : ''}
onRights={handleRights}
onChange={handleSpeaker}
team={team}
aiip={false}
/>
)}
Expand Down
28 changes: 1 addition & 27 deletions web/src/components/MediaUploadDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,46 +11,27 @@ import { UploadType } from './UploadType';
interface IProps {
visible: boolean;
onVisible: (v: boolean) => void;
bp?: BigDialogBp;
uploadType: UploadType;
uploadMethod?:
((files: File[]) => void | boolean | Promise<void | boolean>) | undefined;
multiple?: boolean | undefined;
cancelMethod?: (() => void) | undefined;
metaData?: React.JSX.Element | undefined;
ready?: boolean | undefined; // false disables the save/upload button
speaker?: string | undefined;
onSpeaker?: ((speaker: string) => void) | undefined;
team?: string | undefined; // used to check for speakers when adding a card
onFiles?: ((files: File[]) => void) | undefined;
inValue?: string | undefined;
audioOnly?: boolean | undefined;
validationMessage?: string | undefined;
/** Hide the bottom "Cancel" button (cancel is reached via the dialog's X). */
// I think we are moving towards using the dialog's X as the standard way to cancel instead of an explicit Cancel button.
// hopefully in the future we can remove the explicit Cancel button entirely.
hideCancel?: boolean | undefined;
}

function MediaUploadDialog(props: IProps) {
const {
visible,
onVisible,
bp,
uploadType,
multiple,
uploadMethod,
cancelMethod,
metaData,
ready,
speaker,
onSpeaker,
team,
onFiles,
inValue,
audioOnly,
validationMessage,
hideCancel,
} = props;
const { isMobile } = useMobile();
const t: IMediaUploadStrings = useSelector(mediaUploadSelector, shallowEqual);
Expand Down Expand Up @@ -81,7 +62,7 @@ function MediaUploadDialog(props: IProps) {
isOpen={visible}
onOpen={handleCancel}
title={title[uploadType] ?? ''}
bp={isMobile ? BigDialogBp.mobile : (bp ?? BigDialogBp.sm)}
bp={isMobile ? BigDialogBp.mobile : BigDialogBp.sm}
>
<>
<MediaUploadContent
Expand All @@ -90,16 +71,9 @@ function MediaUploadDialog(props: IProps) {
multiple={multiple}
uploadMethod={uploadMethod}
cancelMethod={cancelMethod}
metaData={metaData}
ready={ready}
speaker={speaker}
onSpeaker={onSpeaker}
team={team}
onFiles={onFiles}
inValue={inValue}
audioOnly={audioOnly}
validationMessage={validationMessage}
hideCancel={hideCancel}
/>
</>
</BigDialog>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,11 @@ export function AddResourceWizard({
metaData={
<ResourceData
uploadType={w.uploadType}
catAllowNew={true} //if they can upload they can add cat
initCategory=""
onCategoryChange={w.handleCategory}
catCommitRef={w.addCategorySaveRef}
initDescription={w.initDescription}
// TODO naming consistency
onDescriptionChange={w.handleDescription}
catRequired={false}
resourceKind={w.resourceKind}
onPassResChange={w.handlePassRes}
allowGeneralResourceOption={w.isAddingAudioResource}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -792,13 +792,11 @@ export function PassageDetailArtifacts() {
<ResourceData
media={mediaRef.current}
uploadType={uploadType}
catAllowNew={true}
initCategory={catIdRef.current || ''}
onCategoryChange={handleCategory}
catCommitRef={editCatCommitRef}
initDescription={descriptionRef.current}
onDescriptionChange={handleDescription}
catRequired={false}
resourceKind={resourceKind}
onPassResChange={handlePassRes}
allowGeneralResourceOption={false}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -793,13 +793,11 @@ export function PassageDetailArtifactsMobile() {
<ResourceData
media={mediaRef.current}
uploadType={uploadType}
catAllowNew={true}
initCategory={catIdRef.current || ''}
onCategoryChange={handleCategory}
catCommitRef={editCatCommitRef}
initDescription={descriptionRef.current}
onDescriptionChange={handleDescription}
catRequired={false}
resourceKind={resourceKind}
onPassResChange={handlePassRes}
allowGeneralResourceOption={false}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,6 @@ interface IProps {
onPassResChange?: ((value: ResourceTypeEnum) => void) | undefined;
onTextChange?: ((text: string) => void) | undefined;
allowGeneralResourceOption: boolean;
// TODO cleanup in next PR: every caller passes catRequired={false} and
// catAllowNew={true}; hard-code them and drop the props.
catRequired: boolean;
catAllowNew?: boolean | undefined;
// Forwarded to SelectArtifactCategory so the parent form can create a new
// category at submission (rather than on blur).
catCommitRef?: RefObject<(() => Promise<string>) | null> | undefined;
Expand All @@ -77,8 +73,6 @@ export function ResourceData(props: IProps) {
onCategoryChange,
onDescriptionChange,
onPassResChange,
catRequired,
catAllowNew,
allowGeneralResourceOption,
media,
uploadType,
Expand Down Expand Up @@ -161,10 +155,10 @@ export function ResourceData(props: IProps) {
</Grid>
<Grid size={{ xs: 12, sm: 6 }}>
<SelectArtifactCategory
allowNew={catAllowNew}
allowNew
initCategory={initCategory || ''}
onCategoryChange={onCategoryChange}
required={catRequired}
required={false}
scripture={ArtCatScr.highlight}
type={ArtifactCategoryType.Resource}
commitRef={catCommitRef}
Expand Down
1 change: 0 additions & 1 deletion web/src/components/PassageDetail/PassageDetailItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,6 @@ export function PassageDetailItem(props: IProps) {
noBusy={true}
isOpen={uploadVisible}
onOpen={handleUploadVisible}
showMessage={showMessage}
multiple={false}
finish={afterUpload}
cancelled={cancelled}
Expand Down
Loading
Loading