Skip to content

Commit

Permalink
Update gym popup to support Copy ID
Browse files Browse the repository at this point in the history
  • Loading branch information
mkl committed Mar 20, 2024
1 parent d65b94a commit bc6e7c6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/features/gym/GymPopup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ const DropdownOptions = ({
raid_level,
}) => {
const { t } = useTranslation()
const { perms } = useMemory((s) => s.auth)

const { gyms, raids, gymBadges, webhooks } = useMemory((s) => s.auth.perms)
const gymValidDataLimit = useMemory((s) => s.gymValidDataLimit)
Expand Down Expand Up @@ -208,6 +209,11 @@ const DropdownOptions = ({
})
}

const copyId = () => {
setAnchorEl(null)
navigator.clipboard.writeText(id)
}

const options = [{ name: 'hide', action: handleHide }]

if (gyms) {
Expand Down Expand Up @@ -251,6 +257,10 @@ const DropdownOptions = ({
})
}

if (perms.admin) {
options.push({ name: 'Copy ID', action: copyId })
}

return options.filter(Boolean).map((option) => (
<MenuItem key={option.key || option.name} onClick={option.action} dense>
{typeof option.name === 'string' ? t(option.name) : option.name}
Expand Down

0 comments on commit bc6e7c6

Please sign in to comment.