fix: update transcript settings default logic (#745)
* fix: update transcript settings default logic * fix: remove extra state logic
This commit is contained in:
@@ -25,6 +25,9 @@ const OrderTranscriptForm = ({
|
||||
const [data, setData] = useState(activeTranscriptPreferences || { videoSourceLanguage: '' });
|
||||
|
||||
const [validCieloTranscriptionPlan, validThreePlayTranscriptionPlan] = checkTranscriptionPlans(transcriptionPlans);
|
||||
useEffect(() => {
|
||||
setTranscriptType(activeTranscriptPreferences?.provider || 'order');
|
||||
}, []);
|
||||
|
||||
let [cieloHasCredentials, threePlayHasCredentials] = checkCredentials(transcriptCredentials);
|
||||
useEffect(() => {
|
||||
|
||||
@@ -35,7 +35,7 @@ const TranscriptSettings = ({
|
||||
isAiTranslationsEnabled,
|
||||
} = pageSettings;
|
||||
const { transcriptionPlans } = videoTranscriptSettings || {};
|
||||
const [transcriptType, setTranscriptType] = useState(activeTranscriptPreferences?.provider);
|
||||
const [transcriptType, setTranscriptType] = useState(null);
|
||||
const [isAiTranslations, setIsAiTranslations] = useState(false);
|
||||
|
||||
const handleOrderTranscripts = (data, provider) => {
|
||||
@@ -81,7 +81,7 @@ const TranscriptSettings = ({
|
||||
<IconButton size="sm" iconAs={Icon} src={Close} onClick={closeTranscriptSettings} alt="close settings" />
|
||||
</ActionRow>
|
||||
<TransitionReplace>
|
||||
{transcriptType ? (
|
||||
{ transcriptType ? (
|
||||
<div key="transcript-settings">
|
||||
<OrderTranscriptForm
|
||||
{...{
|
||||
|
||||
@@ -144,6 +144,10 @@ describe('TranscriptSettings', () => {
|
||||
});
|
||||
|
||||
it('should load page with Cielo24 selected', async () => {
|
||||
const orderButton = screen.getByText(messages.orderTranscriptsTitle.defaultMessage);
|
||||
await act(async () => {
|
||||
userEvent.click(orderButton);
|
||||
});
|
||||
const cielo24Button = screen.getByText(messages.cieloLabel.defaultMessage);
|
||||
|
||||
expect(within(cielo24Button).getByLabelText('Cielo24 radio')).toHaveProperty('checked', true);
|
||||
@@ -180,6 +184,10 @@ describe('TranscriptSettings', () => {
|
||||
axiosMock = new MockAdapter(getAuthenticatedHttpClient());
|
||||
|
||||
renderComponent(defaultProps);
|
||||
const orderButton = screen.getByText(messages.orderTranscriptsTitle.defaultMessage);
|
||||
await act(async () => {
|
||||
userEvent.click(orderButton);
|
||||
});
|
||||
const noneButton = screen.getAllByLabelText('none radio')[0];
|
||||
|
||||
await act(async () => {
|
||||
|
||||
Reference in New Issue
Block a user