diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f2e6d4c90..7ba06a9d64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ Versioning](https://semver.org/spec/v2.0.0.html). - standalone website: - Integrate VOD dashboard (#2086) - List the lives in the contents section (#2104) + - Create a live from the website (#2134) - Add a License Manager widget for LTI VOD view - Add a title to the classroom file dropzone - Add can_edit property on a serialized video diff --git a/src/frontend/apps/standalone_site/src/features/Contents/features/Live/components/Create/LiveCreate.spec.tsx b/src/frontend/apps/standalone_site/src/features/Contents/features/Live/components/Create/LiveCreate.spec.tsx new file mode 100644 index 0000000000..69d3d2e2d0 --- /dev/null +++ b/src/frontend/apps/standalone_site/src/features/Contents/features/Live/components/Create/LiveCreate.spec.tsx @@ -0,0 +1,29 @@ +import { screen } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; +import { render } from 'lib-tests'; + +import LiveCreate from './LiveCreate'; + +jest.mock('./LiveCreateForm', () => ({ + __esModule: true, + default: () =>
My LiveCreate Form
, +})); + +describe('', () => { + test('renders LiveCreate', () => { + render(); + + const button = screen.getByRole('button', { name: /Create Live/i }); + expect(button).toBeInTheDocument(); + expect( + screen.queryByRole('heading', { name: /Create Live/i }), + ).not.toBeInTheDocument(); + + userEvent.click(button); + + expect( + screen.getByRole('heading', { name: /Create Live/i }), + ).toBeInTheDocument(); + expect(screen.getByText('My LiveCreate Form')).toBeInTheDocument(); + }); +}); diff --git a/src/frontend/apps/standalone_site/src/features/Contents/features/Live/components/Create/LiveCreate.tsx b/src/frontend/apps/standalone_site/src/features/Contents/features/Live/components/Create/LiveCreate.tsx new file mode 100644 index 0000000000..4190fd5284 --- /dev/null +++ b/src/frontend/apps/standalone_site/src/features/Contents/features/Live/components/Create/LiveCreate.tsx @@ -0,0 +1,80 @@ +import { Button, Heading, Text } from 'grommet'; +import { useResponsive } from 'lib-components'; +import { Fragment } from 'react'; +import { defineMessages, useIntl } from 'react-intl'; +import { Link, Route, Switch, useHistory } from 'react-router-dom'; + +import { WhiteCard } from 'components/Cards'; +import { Modal } from 'components/Modal'; +import { routes } from 'routes'; + +import LiveCreateForm from './LiveCreateForm'; + +const messages = defineMessages({ + LiveTitle: { + defaultMessage: 'Lives', + description: 'Lives title', + id: 'features.Contents.features.Live.Create.LiveTitle', + }, + CreateLiveLabel: { + defaultMessage: 'Create Live', + description: 'Text heading create live.', + id: 'features.Contents.features.Live.Create.CreateLiveLabel', + }, +}); + +const LiveCreate = () => { + const intl = useIntl(); + const { breakpoint } = useResponsive(); + const history = useHistory(); + + const liveRoute = routes.CONTENTS.subRoutes.LIVE; + const livePath = liveRoute.path; + const liveCreatePath = liveRoute.subRoutes?.CREATE?.path || ''; + + return ( + + + + {intl.formatMessage(messages.LiveTitle)} + + +