@edx/unit-title-plugin

0.0.10 • Public • Published

UnitTranslationSelectorPlugin

Translation selector plugin for unit title in frontend-app-learning

Hosted project

frontend-app-learning::env.config.jsx

import { useDispatch } from 'react-redux';
import {
  PLUGIN_OPERATIONS,
  DIRECT_PLUGIN,
} from "@openedx/frontend-plugin-framework";
import Plugin from "@edx/unit-title-plugin";

// Load environment variables from .env file
const config = {
  ...process.env,
  // this is necessary for feedback widget to
  AI_TRANSLATIONS_URL: "http://localhost:18760",
  pluginSlots: {
    unit_title_slot: {
      keepDefault: false,
      plugins: [
        {
          op: PLUGIN_OPERATIONS.Insert,
          widget: {
            id: "unit_title_slot",
            type: DIRECT_PLUGIN,
            RenderWidget: (props) => {
              const dispatch = useDispatch();
              return <Plugin {...props} dispatch={dispatch} />
            },
          },
        },
      ],
    },
    sequence_container_slot: {
      plugins: [
        {
          op: PLUGIN_OPERATIONS.Insert,
          widget: {
            id: "sequence_container_slot",
            type: DIRECT_PLUGIN,
            priority: 1,
            // this is necessary for feedback widget to show up.
            RenderWidget: () => (
              <div id="whole-course-translation-feedback-widget" />
            ),
          },
        },
      ],
    },
  },
};

export default config;

frontend-app-learning::module.config.js

module.exports = {
  localModules: [
    {
      moduleName: "@edx/unit-translation-selector-plugin",
      dir: "../src/frontend-plugins/packages/unit-translation-selector-plugin",
    },
  ],
};

Readme

Keywords

none

Package Sidebar

Install

npm i @edx/unit-title-plugin

Weekly Downloads

6

Version

0.0.10

License

AGPL-3.0

Unpacked Size

515 kB

Total Files

103

Last publish

Collaborators

  • edx-old-org
  • edx-semantic-release
  • feanil
  • openedx-semantic-release-bot