From bc6e7c650f661887710f57ed4603e167966a8a63 Mon Sep 17 00:00:00 2001 From: mkl <> Date: Wed, 20 Mar 2024 15:07:40 +0100 Subject: [PATCH] Update gym popup to support Copy ID --- src/features/gym/GymPopup.jsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/features/gym/GymPopup.jsx b/src/features/gym/GymPopup.jsx index 923c3202b..32c3d2cf7 100644 --- a/src/features/gym/GymPopup.jsx +++ b/src/features/gym/GymPopup.jsx @@ -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) @@ -208,6 +209,11 @@ const DropdownOptions = ({ }) } + const copyId = () => { + setAnchorEl(null) + navigator.clipboard.writeText(id) + } + const options = [{ name: 'hide', action: handleHide }] if (gyms) { @@ -251,6 +257,10 @@ const DropdownOptions = ({ }) } + if (perms.admin) { + options.push({ name: 'Copy ID', action: copyId }) + } + return options.filter(Boolean).map((option) => ( {typeof option.name === 'string' ? t(option.name) : option.name}