Skip to content

Commit 9efb583

Browse files
authored
feat: replace ai-translations component with a plugin slot (#1186)
* feat: replace ai-translations component with a plugin slot * feat: move ai-translations enabled check to plugin
1 parent 680b5ff commit 9efb583

File tree

4 files changed

+16
-122
lines changed

4 files changed

+16
-122
lines changed

package-lock.json

Lines changed: 0 additions & 77 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
"@dnd-kit/sortable": "^8.0.0",
4343
"@dnd-kit/utilities": "^3.2.2",
4444
"@edx/brand": "npm:@openedx/brand-openedx@^1.2.3",
45-
"@edx/frontend-component-ai-translations": "^2.1.0",
4645
"@edx/frontend-component-footer": "^14.0.3",
4746
"@edx/frontend-component-header": "^5.3.3",
4847
"@edx/frontend-enterprise-hotjar": "^2.0.0",

src/files-and-videos/videos-page/transcript-settings/TranscriptSettings.jsx

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
TransitionReplace,
1212
} from '@openedx/paragon';
1313
import { ChevronLeft, ChevronRight, Close } from '@openedx/paragon/icons';
14-
import AITranslationsComponent from '@edx/frontend-component-ai-translations';
14+
import { PluginSlot } from '@openedx/frontend-plugin-framework';
1515
import OrderTranscriptForm from './OrderTranscriptForm';
1616
import messages from './messages';
1717
import {
@@ -114,18 +114,19 @@ const TranscriptSettings = ({
114114
</TransitionReplace>
115115
</>
116116
)}
117-
{(!transcriptType && isAiTranslationsEnabled) && (
118-
<TransitionReplace>
119-
<div data-testid="ai-translations-component">
120-
<AITranslationsComponent
121-
setIsAiTranslations={setIsAiTranslations}
122-
closeTranscriptSettings={closeTranscriptSettings}
123-
courseId={courseId}
124-
key="ai-component"
125-
/>
126-
</div>
127-
</TransitionReplace>
128-
)}
117+
<TransitionReplace>
118+
<div data-testid="translations-component">
119+
<PluginSlot
120+
id="additonal_translations_component_slot"
121+
pluginProps={{
122+
setIsAiTranslations,
123+
closeTranscriptSettings,
124+
courseId,
125+
additionalProps: { transcriptType, isAiTranslationsEnabled },
126+
}}
127+
/>
128+
</div>
129+
</TransitionReplace>
129130
</div>
130131
</Sheet>
131132
);

src/files-and-videos/videos-page/transcript-settings/TranscriptSettings.test.jsx

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -616,36 +616,7 @@ describe('TranscriptSettings', () => {
616616
});
617617
});
618618

619-
describe('Ai translations component fails', () => {
620-
beforeEach(async () => {
621-
initializeMockApp({
622-
authenticatedUser: {
623-
userId: 3,
624-
username: 'abc123',
625-
administrator: false,
626-
roles: [],
627-
},
628-
});
629-
store = initializeStore({
630-
...initialState,
631-
videos: {
632-
...initialState.videos,
633-
pageSettings: {
634-
...initialState.videos.pageSettings,
635-
},
636-
},
637-
});
638-
axiosMock = new MockAdapter(getAuthenticatedHttpClient());
639-
640-
renderComponent(defaultProps);
641-
});
642-
643-
it('doesn\'t display AI translations component if not enabled', () => {
644-
expect(screen.queryByTestId('ai-translations-component')).not.toBeInTheDocument();
645-
});
646-
});
647-
648-
describe('Ai translations component success', () => {
619+
describe('Translations component success', () => {
649620
beforeEach(async () => {
650621
initializeMockApp({
651622
authenticatedUser: {
@@ -671,7 +642,7 @@ describe('TranscriptSettings', () => {
671642
});
672643

673644
it('displays AI translations component if enabled', () => {
674-
const component = screen.getByTestId('ai-translations-component');
645+
const component = screen.getByTestId('translations-component');
675646
expect(component).toBeInTheDocument();
676647
});
677648
});

0 commit comments

Comments
 (0)