-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3a385e6
commit 133b474
Showing
5 changed files
with
63 additions
and
14 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 |
---|---|---|
|
@@ -145,7 +145,8 @@ | |
"nth-check": "2.1.1", | ||
"react-error-overlay": "6.0.11", | ||
"@types/react": "17.0.62", | ||
"@svgr/webpack": "8.0.1" | ||
"@svgr/webpack": "8.0.1", | ||
"@graasp/translations": "portal:/home/momochan/dev/graasp/graasp-translations" | ||
}, | ||
"packageManager": "[email protected]" | ||
} |
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 |
---|---|---|
@@ -1,22 +1,61 @@ | ||
import { List } from 'immutable'; | ||
|
||
import { Box } from '@mui/material'; | ||
|
||
import { Member } from '@graasp/sdk'; | ||
import { BUILDER } from '@graasp/translations'; | ||
import { Loader } from '@graasp/ui'; | ||
|
||
import { useBuilderTranslation } from '../../config/i18n'; | ||
import { hooks } from '../../config/queryClient'; | ||
import { | ||
PUBLISHED_ITEMS_ERROR_ALERT_ID, | ||
PUBLISHED_ITEMS_ID, | ||
} from '../../config/selectors'; | ||
import ErrorAlert from '../common/ErrorAlert'; | ||
import { useCurrentUserContext } from '../context/CurrentUserContext'; | ||
import ItemHeader from '../item/header/ItemHeader'; | ||
import Items from './Items'; | ||
import Main from './Main'; | ||
|
||
// todo: remove | ||
/* eslint-disable */ | ||
const PublishedItemsDisplay = ({ member }: { member: Member }): JSX.Element => { | ||
const { t: translateBuilder } = useBuilderTranslation(); | ||
const { | ||
data: sharedItems, | ||
isLoading, | ||
isError, | ||
} = hooks.usePublishedItemsForMember(member.id); | ||
|
||
interface Props {} | ||
if (isError) { | ||
return <ErrorAlert id={PUBLISHED_ITEMS_ERROR_ALERT_ID} />; | ||
} | ||
|
||
if (isLoading) { | ||
return <Loader />; | ||
} | ||
|
||
const PublishedItems = ({}: Props): JSX.Element => { | ||
return ( | ||
<Main> | ||
<Box mx={2}> | ||
<ItemHeader showNavigation={false} /> | ||
{} | ||
<Items | ||
id={PUBLISHED_ITEMS_ID} | ||
title={translateBuilder(BUILDER.PUBLISHED_ITEMS_TITLE)} | ||
items={sharedItems ?? List()} | ||
/> | ||
</Box> | ||
</Main> | ||
); | ||
}; | ||
|
||
const PublishedItems = (): JSX.Element => { | ||
const { data: member, isError } = useCurrentUserContext(); | ||
|
||
if (!member || isError) { | ||
return <ErrorAlert id={PUBLISHED_ITEMS_ERROR_ALERT_ID} />; | ||
} | ||
|
||
return <PublishedItemsDisplay member={member} />; | ||
}; | ||
|
||
export default PublishedItems; |
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