diff --git a/app/oer/page.tsx b/app/oer/page.tsx new file mode 100644 index 00000000..84535b99 --- /dev/null +++ b/app/oer/page.tsx @@ -0,0 +1,40 @@ +import { Suspense } from 'react'; +import { dehydrate } from 'react-query/core'; + +import Hydrate from '../../src/components/HydrateClient'; +import Wrapper from '../../src/components/common/Wrapper'; +import OERInformation from '../../src/components/pages/OERInformation'; +import { APP_AUTHOR } from '../../src/config/constants'; +import getQueryClient from '../../src/config/get-query-client'; +import LIBRARY from '../../src/langs/constants'; +import en from '../../src/langs/en.json'; +import { buildSeo } from '../seo'; + +export async function generateMetadata() { + // todo: get lang from location and crawler + // question: how to get language from + // @ts-ignore + const t = (s: string): string => en[s]; + + return buildSeo({ + title: t(LIBRARY.OER_INFORMATION_PAGE_TITLE), + description: t(LIBRARY.OER_INFORMATION_PAGE_DESCRIPTION), + author: APP_AUTHOR, + }); +} + +const Page = async () => { + const queryClient = getQueryClient(); + const dehydratedState = dehydrate(queryClient); + + return ( + + + + + + + + ); +}; +export default Page; diff --git a/src/components/collection/Badges.tsx b/src/components/collection/Badges.tsx index 43464ea7..770ade12 100644 --- a/src/components/collection/Badges.tsx +++ b/src/components/collection/Badges.tsx @@ -1,18 +1,11 @@ -import truncate from 'lodash.truncate'; +import { Stack } from '@mui/material'; -import { useEffect, useState } from 'react'; - -import { Email, Facebook, Twitter } from '@mui/icons-material'; -import { IconButton, Stack } from '@mui/material'; - -import { - MAIL_BREAK_LINE, - TWITTER_MESSAGE_MAX_LENGTH, -} from '../../config/constants'; import { useLibraryTranslation } from '../../config/i18n'; import LIBRARY from '../../langs/constants'; -import { openInNewTab } from '../../utils/helpers'; import { removeTagsFromString } from '../../utils/text'; +import EmailButton from '../common/EmailButton'; +import FacebookButton from '../common/FacebookButton'; +import TwitterButton from '../common/TwitterButton'; type Props = { name?: string; @@ -21,48 +14,20 @@ type Props = { const Badges = ({ name, description }: Props) => { const { t } = useLibraryTranslation(); - const [pageLocation, setPageLocation] = useState(); - const parsedDescription = removeTagsFromString(description); - - useEffect(() => { - setPageLocation(window?.location.href); - }, []); - const shareOnTwitter = () => { - const message = truncate( - `${t(LIBRARY.SHARE_TWITTER_MESSAGE, { - name, - })} ${pageLocation} : ${parsedDescription}`, - { length: TWITTER_MESSAGE_MAX_LENGTH, separator: /,? +/ }, - ); - openInNewTab(`https://twitter.com/intent/tweet?text=${message}`); - }; - - const shareOnFacebook = () => { - const link = pageLocation; - openInNewTab(`https://www.facebook.com/sharer/sharer.php?u=${link}`); - }; - - const subject = `${t(LIBRARY.SHARE_FACEBOOK_SUBJECT, { name })}`; - const message = `${t(LIBRARY.SHARE_FACEBOOK_SUBJECT, { - name, - })} ${pageLocation}${MAIL_BREAK_LINE}${MAIL_BREAK_LINE}${parsedDescription}`; - const mailString = `mailto:?subject=${subject}&body=${message}`; + const parsedDescription = removeTagsFromString(description); const iconSize = 'medium'; return ( - - - - - - - - - - - + + + ); }; diff --git a/src/components/collection/ItemCollection.tsx b/src/components/collection/ItemCollection.tsx index 8423ab3a..06d6e407 100644 --- a/src/components/collection/ItemCollection.tsx +++ b/src/components/collection/ItemCollection.tsx @@ -1,25 +1,13 @@ import React from 'react'; -import { - Box, - Container, - SxProps, - Theme, - Typography, - styled, -} from '@mui/material'; +import { Container, SxProps, Theme, Typography } from '@mui/material'; import { DiscriminatedItem } from '@graasp/sdk'; import { SECTION_TITLE_ID } from '../../config/selectors'; +import StyledContainer from '../layout/StyledContainer'; import CollectionsGrid from './CollectionsGrid'; -const StyledContainer = styled(Box)(({ theme }) => ({ - backgroundColor: 'white', - ':nth-child(even)': { backgroundColor: '#fafafa' }, - padding: theme.spacing(4, 3, 8, 3), -})); - type ItemCollectionProps = { id: string; collectionGridId?: string; diff --git a/src/components/collection/oer/VideoWithCC.tsx b/src/components/collection/oer/VideoWithCC.tsx new file mode 100644 index 00000000..b8caf588 --- /dev/null +++ b/src/components/collection/oer/VideoWithCC.tsx @@ -0,0 +1,89 @@ +import { List, ListItem, Stack } from '@mui/material'; + +import { CCLicenseAdaptions } from '@graasp/sdk'; + +import { useLibraryTranslation } from '../../../config/i18n'; +import LIBRARY from '../../../langs/constants'; +import CreativeCommons from '../../common/CreativeCommons'; + +type Props = { + ccLicenseAdaption?: CCLicenseAdaptions; + url: string; + title: string; + production?: string; + duration?: string; + edition?: string; +}; + +const VideoWithCC = ({ + url, + title, + ccLicenseAdaption = CCLicenseAdaptions.CC_BY_SA, + production, + duration, + edition, +}: Props): JSX.Element => { + const { t } = useLibraryTranslation(); + + return ( + +