Skip to content

Commit

Permalink
Merge remote-tracking branch 'library-authoring/master' into rpenido/…
Browse files Browse the repository at this point in the history
…fal-3600-merge-library-authoring
  • Loading branch information
rpenido committed Jan 2, 2024
2 parents 4ffebda + ed13c15 commit 948c3a4
Show file tree
Hide file tree
Showing 153 changed files with 12,586 additions and 30 deletions.
3 changes: 3 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,6 @@ HOTJAR_VERSION=6
HOTJAR_DEBUG=false
INVITE_STUDENTS_EMAIL_TO=''
AI_TRANSLATIONS_BASE_URL=''
SECURE_ORIGIN_XBLOCK_BOOTSTRAP_HTML_URL=null
BLOCKSTORE_COLLECTION_UUID=null
LIBRARY_LISTING_PAGINATION_PAGE_SIZE=50
6 changes: 5 additions & 1 deletion .env.development
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ LANGUAGE_PREFERENCE_COOKIE_NAME='openedx-language-preference'
LMS_BASE_URL='http://localhost:18000'
LEARNING_BASE_URL='http://localhost:2000'
LOGIN_URL='http://localhost:18000/login'
LOGOUT_URL='http://localhost:18000/logout'
LOGO_TRADEMARK_URL=https://edx-cdn.org/v3/default/logo-trademark.svg
LOGO_URL=https://edx-cdn.org/v3/default/logo.svg
LOGO_WHITE_URL=https://edx-cdn.org/v3/default/logo-white.svg
LOGOUT_URL='http://localhost:18000/logout'
MARKETING_SITE_BASE_URL='http://localhost:18000'
TERMS_OF_SERVICE_URL=
PRIVACY_POLICY_URL=
Expand Down Expand Up @@ -43,3 +43,7 @@ HOTJAR_VERSION=6
HOTJAR_DEBUG=true
INVITE_STUDENTS_EMAIL_TO="[email protected]"
AI_TRANSLATIONS_BASE_URL='http://localhost:18760'
SECURE_ORIGIN_XBLOCK_BOOTSTRAP_HTML_URL=/xblock-bootstrap.html
BLOCKSTORE_COLLECTION_UUID=11111111-2111-4111-8111-111111111111
LIBRARY_LISTING_PAGINATION_PAGE_SIZE=50
ENABLE_ACCESSIBILITY_PAGE=false
6 changes: 6 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,9 @@ ENABLE_VIDEO_UPLOAD_PAGE_LINK_IN_CONTENT_DROPDOWN = true
ENABLE_TAGGING_TAXONOMY_PAGES = true
BBB_LEARN_MORE_URL=''
INVITE_STUDENTS_EMAIL_TO="[email protected]"
SECURE_ORIGIN_XBLOCK_BOOTSTRAP_HTML_URL=/xblock-bootstrap.html
BLOCKSTORE_COLLECTION_UUID=null
LIBRARY_LISTING_PAGINATION_PAGE_SIZE=50
TERMS_OF_SERVICE_URL=
PRIVACY_POLICY_URL=
ENABLE_ACCESSIBILITY_PAGE=false
22 changes: 21 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// eslint-disable-next-line import/no-extraneous-dependencies
const { createConfig } = require('@edx/frontend-build');

module.exports = createConfig(
const combined = createConfig(
'eslint',
{
rules: {
Expand All @@ -15,3 +15,23 @@ module.exports = createConfig(
},
},
);

combined.plugins = Array.isArray(combined.plugins) ? [...combined.plugins, 'jsx-a11y'] : ['jsx-a11y'];

// This is already defined upstream, so we need to modify it. The merge functionality provided by createConfig
// doesn't handle it correctly.
combined.rules['import/no-extraneous-dependencies'][1].devDependencies.push('**/specs/**');

// https://github.com/evcohen/eslint-plugin-jsx-a11y/issues/340#issuecomment-338424908
combined.rules['jsx-a11y/anchor-is-valid'] = ['error', {
components: ['Link'],
specialLink: ['to'],
}];

combined.rules['jsx-a11y/label-has-for'] = [2, {
components: ['label'],
required: 'id',
allowChildren: false,
}];

module.exports = combined;
44 changes: 44 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: node_js CI

on:
push:
branches:
- master
pull_request:
branches:
- '**'

jobs:
tests:
runs-on: ubuntu-22.04

steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Nodejs Env
run: echo "NODE_VER=`cat .nvmrc`" >> $GITHUB_ENV
- name: Setup Nodejs
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VER }}

- name: Install dependencies
run: npm ci

- name: Package lock check
run: make validate-no-uncommitted-package-lock-changes

- name: Extract i18n
run: npm run i18n_extract

- name: Lint
run: npm run lint -- --max-warnings 0

- name: Test
run: npm run test

- name: Build
run: npm run build

- name: Run Coverage
uses: codecov/codecov-action@v3
3 changes: 1 addition & 2 deletions .tx/config
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ host = https://www.transifex.com
file_filter = src/i18n/messages/<lang>.json
source_file = src/i18n/transifex_input.json
source_lang = en
type = KEYVALUEJSON

type = KEYVALUEJSON
2 changes: 2 additions & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# The following users are the maintainers of all frontend-app-library-authoring files
* @openedx/teaching-and-learning
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,16 @@ transifex_input = $(i18n)/transifex_input.json
# This directory must match .babelrc .
transifex_temp = ./temp/babel-plugin-formatjs

test:
npm run test

precommit:
npm run lint
npm audit

requirements:
npm ci
# npm ci --legacy-peer-deps

i18n.extract:
# Pulling display strings from .jsx files into .json files...
Expand Down Expand Up @@ -59,7 +63,7 @@ pull_translations:
translations/frontend-component-footer/src/i18n/messages:frontend-component-footer \
translations/frontend-app-course-authoring/src/i18n/messages:frontend-app-course-authoring

$(intl_imports) paragon frontend-component-footer frontend-app-course-authoring
$(intl_imports) paragon frontend-component-footer paragon frontend-app-course-authoring
endif

# This target is used by Travis.
Expand Down
18 changes: 18 additions & 0 deletions catalog-info.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# This file records information about this repo. Its use is described in OEP-55:
# https://open-edx-proposals.readthedocs.io/en/latest/processes/oep-0055-proc-project-maintainers.html

apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: 'frontend-app-library-authoring'
description: "The frontend (MFE) for Open edX Content Library Authoring"
links:
- url: "https://github.com/openedx/frontend-app-library-authoring"
title: "Frontend app library authoring"
icon: "Web"
annotations:
openedx.org/arch-interest-groups: ""
spec:
owner: group:teaching-and-learning
type: 'website'
lifecycle: 'experimental'
Binary file added docs/images/screenshot_adding_components.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/screenshot_creating.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/screenshot_mfe.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 24 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,39 @@
const { createConfig } = require('@edx/frontend-build');

module.exports = createConfig('jest', {
setupFilesAfterEnv: [
setupFiles: [
'<rootDir>/src/setupTest.js',
],
setupFilesAfterEnv: [
'<rootDir>/src/setupTestEnv.js',
],
coveragePathIgnorePatterns: [
'src/setupTestEnv.js',
'src/setupTest.js',
'jest.config.js',
'src/i18n',
'/node_modules/',
'/specs/'
],
snapshotSerializers: [
'enzyme-to-json/serializer',
],
collectCoverageFrom: [
"**/*.{js,jsx}",
],
testMatch: [
'**/specs/**/*.spec.(js|jsx)|**/__tests__/*.(js|jsx)|**/specs/*.spec.(js|jsx)',
],
roots: [
'<rootDir>src/',
],
coveragePathIgnorePatterns: [
'src/setupTest.js',
'jest.config.js',
'src/i18n',
'/node_modules/',
'/specs/'
],
moduleNameMapper: {
'^lodash-es$': 'lodash',
},
Expand Down
48 changes: 34 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
"start": "fedx-scripts webpack-dev-server --progress",
"start:with-theme": "paragon install-theme && npm start && npm install",
"test": "fedx-scripts jest --coverage --passWithNoTests",
"test:watch": "fedx-scripts jest --coverage --watchAll --watch",
"clear-jest": "fedx-scripts jest --clearCache",
"types": "tsc --noEmit"
},
"husky": {
Expand All @@ -38,63 +40,81 @@
"dependencies": {
"@edx/brand": "npm:@openedx/brand-openedx@^1.2.2",
"@edx/frontend-component-ai-translations-edx": "^1.4.2",
"@edx/frontend-component-footer": "^12.3.0",
"@edx/frontend-component-header": "^4.7.0",
"@edx/frontend-component-footer": "^12.5.1",
"@edx/frontend-component-header": "^4.10.1",
"@edx/frontend-enterprise-hotjar": "^2.0.0",
"@edx/frontend-lib-content-components": "^1.177.8",
"@edx/frontend-platform": "5.6.1",
"@edx/paragon": "^21.5.6",
"@fortawesome/fontawesome-svg-core": "1.2.36",
"@fortawesome/free-brands-svg-icons": "5.15.4",
"@fortawesome/free-regular-svg-icons": "5.15.4",
"@fortawesome/free-solid-svg-icons": "5.15.4",
"@fortawesome/fontawesome-svg-core": "6.4.2",
"@fortawesome/free-brands-svg-icons": "6.4.2",
"@fortawesome/free-regular-svg-icons": "6.4.2",
"@fortawesome/free-solid-svg-icons": "6.4.2",
"@fortawesome/react-fontawesome": "0.2.0",
"@reduxjs/toolkit": "1.9.7",
"@tanstack/react-query": "4.36.1",
"@openedx/paragon": "^21.6.0",
"@popperjs/core": "2.11.8",
"classnames": "2.2.6",
"core-js": "3.8.1",
"core-js": "3.31.1",
"email-validator": "2.0.4",
"eslint-plugin-jsx-a11y": "^6.6.1",
"file-saver": "^2.0.5",
"formik": "2.2.6",
"immutability-helper": "3.1.1",
"jszip": "^3.10.1",
"lodash": "4.17.21",
"lodash.debounce": "^4.0.8",
"history": "5.3.0",
"prop-types": "15.8.1",
"moment": "2.29.4",
"prop-types": "15.7.2",
"querystring": "0.2.1",
"react": "17.0.2",
"react-datepicker": "^4.13.0",
"react-dom": "17.0.2",
"react-datepicker": "^4.13.0",
"react-dropzone": "14.2.3",
"react-helmet": "^6.1.0",
"react-onclickoutside": "^6.12.1",
"react-redux": "7.2.9",
"react-responsive": "9.0.2",
"react-router": "6.16.0",
"react-router-dom": "6.16.0",
"react-textarea-autosize": "^8.4.1",
"react-transition-group": "4.4.5",
"redux": "4.0.5",
"regenerator-runtime": "0.13.7",
"redux": "4.2.1",
"regenerator-runtime": "0.13.11",
"reselect": "4.1.8",
"universal-cookie": "^4.0.4",
"uuid": "^3.4.0",
"uuid": "9.0.1",
"yup": "0.31.1"
},
"devDependencies": {
"@edx/browserslist-config": "1.2.0",
"@edx/frontend-build": "13.0.5",
"@edx/reactifex": "^1.0.3",
"@edx/reactifex": "^2.1.1",
"@edx/stylelint-config-edx": "^2.3.0",
"@edx/typescript-config": "^1.0.1",
"@sheerun/mutationobserver-shim": "0.3.3",
"@testing-library/dom": "9.3.3",
"@testing-library/jest-dom": "5.17.0",
"@testing-library/react": "12.1.5",
"@testing-library/react-hooks": "^8.0.1",
"@testing-library/user-event": "^13.2.1",
"@wojtekmaj/enzyme-adapter-react-17": "0.8.0",
"axios-mock-adapter": "1.22.0",
"copy-webpack-plugin": "^11.0.0",
"enzyme": "3.11.0",
"enzyme-to-json": "^3.6.2",
"glob": "7.2.3",
"husky": "7.0.4",
"husky": "8.0.3",
"jest": "29.7.0",
"jest-canvas-mock": "^2.5.2",
"jest-fetch-mock": "3.0.3",
"react-test-renderer": "17.0.2",
"redux-mock-store": "1.5.4",
"mock-xmlhttprequest": "8.2.0",
"reactifex": "1.1.1",
"rosie": "2.1.1",
"ts-loader": "^9.5.0"
},
"peerDependencies": {
Expand Down
41 changes: 41 additions & 0 deletions src/generic/LoadingPage.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import React from 'react';
import { Col } from '@edx/paragon';
import PropTypes from 'prop-types';

const LoadingPage = ({ loadingMessage }) => (
<Col
xs={12}
className="justify-content-center d-flex"
style={{
height: '50vh',
}}
>
<div className="spinner-border text-primary text-center align-self-center" role="status">
{loadingMessage && (
<span className="sr-only">
{loadingMessage}
</span>
)}
</div>
</Col>
);

LoadingPage.propTypes = {
loadingMessage: PropTypes.string.isRequired,
};

export const LoadGuard = ({ condition, children, loadingMessage }) => (
<>
{condition && children()}
{condition || <LoadingPage loadingMessage={loadingMessage} />}
</>
);

export default LoadingPage;

LoadGuard.propTypes = {
loadingMessage: PropTypes.string.isRequired,
children: PropTypes.func.isRequired,
// eslint-disable-next-line react/forbid-prop-types
condition: PropTypes.any.isRequired,
};
16 changes: 16 additions & 0 deletions src/generic/NotFoundPage.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from 'react';
import { FormattedMessage } from '@edx/frontend-platform/i18n';

const NotFoundPage = () => (
<div className="container-fluid d-flex py-5 justify-content-center align-items-start text-center">
<p className="my-0 py-5 text-muted" style={{ maxWidth: '32em' }}>
<FormattedMessage
id="error.notfound.message"
defaultMessage="The page you're looking for is unavailable or there's an error in the URL. Please check the URL and try again."
description="error message when a page does not exist"
/>
</p>
</div>
);

export default NotFoundPage;
2 changes: 2 additions & 0 deletions src/generic/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default as LoadingPage } from './LoadingPage';
export { default as NotFoundPage } from './NotFoundPage';
Loading

0 comments on commit 948c3a4

Please sign in to comment.