-
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.
fix: some loaders to display data first and pagination bugs (#967)
* fix: move screens and loaders * fix: remove waits * fix: actions should not display before we get memberships
- Loading branch information
Showing
16 changed files
with
322 additions
and
316 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
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
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,46 +1,25 @@ | ||
import Stack from '@mui/material/Stack'; | ||
|
||
import { Loader, useShortenURLParams } from '@graasp/ui'; | ||
|
||
import { ITEM_ID_PARAMS } from '@/config/paths'; | ||
|
||
import { hooks } from '../../../config/queryClient'; | ||
import { ITEM_HEADER_ID } from '../../../config/selectors'; | ||
import ErrorAlert from '../../common/ErrorAlert'; | ||
import Navigation from '../../layout/Navigation'; | ||
import ItemHeaderActions from './ItemHeaderActions'; | ||
|
||
const { useItem } = hooks; | ||
|
||
type Props = { | ||
showNavigation?: boolean; | ||
}; | ||
|
||
const ItemHeader = ({ showNavigation = true }: Props): JSX.Element => { | ||
const itemId = useShortenURLParams(ITEM_ID_PARAMS); | ||
const { data: item, isLoading: isItemLoading, isError } = useItem(itemId); | ||
|
||
if (isItemLoading) { | ||
return <Loader />; | ||
} | ||
|
||
if (isError) { | ||
return <ErrorAlert />; | ||
} | ||
|
||
return ( | ||
<Stack | ||
direction="row" | ||
justifyContent="space-between" | ||
alignItems="center" | ||
mb={1} | ||
id={ITEM_HEADER_ID} | ||
> | ||
{/* display empty div to render actions on the right */} | ||
{showNavigation ? <Navigation /> : <div />} | ||
<ItemHeaderActions item={item} /> | ||
</Stack> | ||
); | ||
}; | ||
const ItemHeader = ({ showNavigation = true }: Props): JSX.Element | null => ( | ||
<Stack | ||
direction="row" | ||
justifyContent="space-between" | ||
alignItems="center" | ||
mb={1} | ||
id={ITEM_HEADER_ID} | ||
> | ||
{/* display empty div to render actions on the right */} | ||
{showNavigation ? <Navigation /> : <div />} | ||
<ItemHeaderActions /> | ||
</Stack> | ||
); | ||
|
||
export default ItemHeader; |
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
Oops, something went wrong.