generated from graasp/graasp-repo
-
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: improvements in Player interface (#72)
* feat: improvements in Player interface * change paragraph font size * fix: minor code changes * chore: update yarn.lock * chore: minor changes * chore: update yarn.lock * refactor: update yarn.lock, prettify * test: change tests and minor changes * fix: minor changes Co-authored-by: pyphilia <pyphilia@gmail.com>
- Loading branch information
Showing
18 changed files
with
1,819 additions
and
981 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
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,55 @@ | ||
import React from 'react'; | ||
import EditIcon from '@material-ui/icons/Edit'; | ||
import { PermissionedComponent, Loader } from '@graasp/ui'; | ||
import PropTypes from 'prop-types'; | ||
import { Tooltip, makeStyles } from '@material-ui/core'; | ||
import { useTranslation } from 'react-i18next'; | ||
import IconButton from '@material-ui/core/IconButton'; | ||
import { hooks } from '../../config/queryClient'; | ||
import { buildGraaspComposeItemRoute } from '../../config/constants'; | ||
import { isRegularUser } from '../../utils/user'; | ||
|
||
const useStyles = makeStyles(() => ({ | ||
iconButton: { | ||
float: 'right', | ||
}, | ||
})); | ||
|
||
const BuilderButton = ({ id }) => { | ||
const { t } = useTranslation(); | ||
const classes = useStyles(); | ||
const { data: user, isLoading } = hooks.useCurrentMember(); | ||
|
||
const onClickComposeView = () => { | ||
window.location.href = buildGraaspComposeItemRoute(id); | ||
}; | ||
|
||
if (isLoading) { | ||
<Loader />; | ||
} | ||
|
||
const ActionButtons = ( | ||
<Tooltip title={t('Compose View')}> | ||
<IconButton | ||
className={classes.iconButton} | ||
aria-label={t('Compose view')} | ||
onClick={onClickComposeView} | ||
> | ||
<EditIcon /> | ||
</IconButton> | ||
</Tooltip> | ||
); | ||
|
||
return ( | ||
<PermissionedComponent | ||
component={ActionButtons} | ||
checkPermissions={() => isRegularUser(user)} | ||
/> | ||
); | ||
}; | ||
|
||
BuilderButton.propTypes = { | ||
id: PropTypes.string.isRequired, | ||
}; | ||
|
||
export default BuilderButton; |
Oops, something went wrong.