-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add oer info page (to be done) (#612)
* feat: add oer info page (to be done) * feat: finalize oer page * refactor: apply PR requested changes * refactor: fix trans and tooltip for fb and twitter buttons
- Loading branch information
Showing
22 changed files
with
699 additions
and
168 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ( | ||
<Hydrate state={dehydratedState}> | ||
<Suspense> | ||
<Wrapper dehydratedState={dehydratedState}> | ||
<OERInformation /> | ||
</Wrapper> | ||
</Suspense> | ||
</Hydrate> | ||
); | ||
}; | ||
export default Page; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ( | ||
<Stack | ||
p={3} | ||
borderRadius={3} | ||
textAlign="center" | ||
width="fit-content" | ||
margin="auto" | ||
border="1px solid lightgrey" | ||
style={{ | ||
background: 'white', | ||
}} | ||
gap={3} | ||
alignContent="center" | ||
> | ||
<iframe | ||
style={{ margin: 'auto', border: 'none', display: 'block' }} | ||
width="560" | ||
height="315" | ||
src={url} | ||
title={title} | ||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" | ||
allowFullScreen | ||
/> | ||
<Stack direction="row" justifyContent="center" alignItems="center"> | ||
<List dense> | ||
{production && ( | ||
<ListItem> | ||
<strong> | ||
{t(LIBRARY.OER_INFORMATION_VIDEO_DESCRIPTION_PRODUCTION)} | ||
</strong> | ||
: {production} | ||
</ListItem> | ||
)} | ||
{duration && ( | ||
<ListItem> | ||
<strong> | ||
{t(LIBRARY.OER_INFORMATION_VIDEO_DESCRIPTION_DURATION)} | ||
</strong> | ||
: {duration} | ||
</ListItem> | ||
)} | ||
{edition && ( | ||
<ListItem> | ||
<strong> | ||
{t(LIBRARY.OER_INFORMATION_VIDEO_DESCRIPTION_EDITION)} | ||
</strong> | ||
: {edition} | ||
</ListItem> | ||
)} | ||
</List> | ||
{ccLicenseAdaption && ( | ||
<CreativeCommons | ||
iconSize={30} | ||
ccLicenseAdaption={ccLicenseAdaption} | ||
/> | ||
)} | ||
</Stack> | ||
</Stack> | ||
); | ||
}; | ||
|
||
export default VideoWithCC; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.