notification button is now present and clickable in team list
This commit is contained in:
parent
aa56f05c25
commit
de9da91c2e
3 changed files with 32 additions and 46 deletions
|
|
@ -1,13 +1,9 @@
|
|||
import { createStyles, IconButton, Tooltip } from "@mui/material";
|
||||
import { IconButton, Tooltip } from "@mui/material";
|
||||
// import { Theme } from "@material-ui/core/styles/createMuiTheme";
|
||||
// import withStyles, { WithStyles } from "@material-ui/core/styles/withStyles";
|
||||
import NotificationsEnabledIcon from "@mui/icons-material/NotificationsActive";
|
||||
import NotificationsDisabledIcon from "@mui/icons-material/NotificationsOff";
|
||||
import { WithStyles } from "@mui/styles";
|
||||
|
||||
const styles = () => createStyles({});
|
||||
|
||||
interface Props extends WithStyles<typeof styles> {
|
||||
interface Props {
|
||||
notify: boolean;
|
||||
hidden?: boolean;
|
||||
onChange: Function;
|
||||
|
|
@ -15,7 +11,6 @@ interface Props extends WithStyles<typeof styles> {
|
|||
tooltip: string;
|
||||
}
|
||||
|
||||
// interface State {}
|
||||
|
||||
export default function NotificationButton (props: Props) {
|
||||
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ export default function TeamActions(props: Props) {
|
|||
const canWrite = permissions.includes(pond.Permission.PERMISSION_WRITE);
|
||||
return (
|
||||
<React.Fragment>
|
||||
{/* <NotificationButton
|
||||
<NotificationButton
|
||||
notify={preferences.notify}
|
||||
onChange={toggleNotificationPreference}
|
||||
tooltip={
|
||||
|
|
@ -181,7 +181,7 @@ export default function TeamActions(props: Props) {
|
|||
(preferences.notify ? "enabled" : "disabled")
|
||||
}
|
||||
// hidden={isLoading}
|
||||
/> */}
|
||||
/>
|
||||
{canWrite && (
|
||||
<Tooltip title="Team Settings">
|
||||
<IconButton onClick={() => setOpenState({ ...openState, settings: true })}>
|
||||
|
|
|
|||
|
|
@ -134,16 +134,6 @@ export default function TeamList() {
|
|||
userAPI
|
||||
.getUser(u, teamScope(team.settings?.key))
|
||||
.then(resp => {
|
||||
// let permissions: pond.Permission[] = resp.permissions.map(perm => pond.Permission[perm as unknown as keyof typeof pond.Permission]);
|
||||
// console.log(resp.permissions)
|
||||
// console.log(typeof(resp.permissions))
|
||||
resp.permissions.forEach(p => {
|
||||
// console.log('Value:', p, 'Type:', typeof p);
|
||||
});
|
||||
// permissions.forEach(p => {
|
||||
// console.log('Value:', p, 'Type:', typeof p);
|
||||
// });
|
||||
// console.log('Expected Value:', pond.Permission.PERMISSION_WRITE, 'Type:', typeof pond.Permission.PERMISSION_WRITE);
|
||||
newTeamPerms[index] = resp.permissions;
|
||||
newTeamPrefs[index] = resp.preferences;
|
||||
})
|
||||
|
|
@ -178,7 +168,34 @@ export default function TeamList() {
|
|||
}
|
||||
return (
|
||||
<React.Fragment key={index}>
|
||||
<ListItem alignItems="flex-start">
|
||||
<ListItem
|
||||
alignItems="flex-start"
|
||||
secondaryAction={
|
||||
<TeamActions
|
||||
team={Team.create(team)}
|
||||
permissions={permissions}
|
||||
refreshCallback={loadTeams}
|
||||
removeSelfCallback={loadTeams}
|
||||
preferences={preferences}
|
||||
toggleNotificationPreference={() => {
|
||||
if (preferences) {
|
||||
let newTeamPrefs = cloneDeep(teamPrefs);
|
||||
newTeamPrefs[index].notify = !newTeamPrefs[index].notify;
|
||||
teamAPI
|
||||
.updatePreferences(
|
||||
Team.create(team).key(),
|
||||
newTeamPrefs[index],
|
||||
getContextKeys(),
|
||||
getContextTypes()
|
||||
)
|
||||
.then(() => {
|
||||
setTeamPrefs(newTeamPrefs);
|
||||
});
|
||||
}
|
||||
}}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<ListItemAvatar>
|
||||
<Avatar
|
||||
onClick={() => {
|
||||
|
|
@ -207,32 +224,6 @@ export default function TeamList() {
|
|||
</React.Fragment>
|
||||
}
|
||||
/>
|
||||
<ListItemSecondaryAction>
|
||||
<TeamActions
|
||||
team={Team.create(team)}
|
||||
permissions={permissions}
|
||||
refreshCallback={loadTeams}
|
||||
removeSelfCallback={loadTeams}
|
||||
preferences={preferences}
|
||||
toggleNotificationPreference={() => {
|
||||
if (preferences) {
|
||||
let newTeamPrefs = cloneDeep(teamPrefs);
|
||||
newTeamPrefs[index].notify = !newTeamPrefs[index].notify;
|
||||
teamAPI
|
||||
.updatePreferences(
|
||||
Team.create(team).key(),
|
||||
newTeamPrefs[index],
|
||||
getContextKeys(),
|
||||
getContextTypes()
|
||||
)
|
||||
.then(() => {
|
||||
setTeamPrefs(newTeamPrefs);
|
||||
});
|
||||
// setTeamPrefs(newTeamPrefs)
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</ListItemSecondaryAction>
|
||||
</ListItem>
|
||||
<Divider variant="inset" component="li" />
|
||||
</React.Fragment>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue