notification button is now present and clickable in team list

This commit is contained in:
Carter 2024-11-19 18:02:05 -06:00
parent aa56f05c25
commit de9da91c2e
3 changed files with 32 additions and 46 deletions

View file

@ -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 })}>

View file

@ -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>