aboutsummaryrefslogtreecommitdiff
path: root/src/components/profile
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/profile')
-rw-r--r--src/components/profile/MomentMoreInfoDrawer.tsx34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/components/profile/MomentMoreInfoDrawer.tsx b/src/components/profile/MomentMoreInfoDrawer.tsx
index 3f8707e8..1265497e 100644
--- a/src/components/profile/MomentMoreInfoDrawer.tsx
+++ b/src/components/profile/MomentMoreInfoDrawer.tsx
@@ -116,26 +116,26 @@ const MomentMoreInfoDrawer: React.FC<MomentMoreInfoDrawerProps> = (props) => {
* Update bottom drawer options to contain/not contain 'remove tag' option
*/
useEffect(() => {
- const setupBottomDrawer = async () => {
+ const setupBottomDrawer = () => {
const present = drawerButtons.findIndex(
(button) => button[0] === MomentDrawerOptions.RemoveTag,
);
- if (momentTagId !== '') {
- if (present === -1) {
- const localDrawerButtons = drawerButtons;
- localDrawerButtons.push([
- MomentDrawerOptions.RemoveTag,
- handleRemoveTag,
- ]);
- setDrawerButtons(localDrawerButtons);
- }
- } else {
- if (present !== -1) {
- const filteredButtons = drawerButtons.filter(
- (button) => button[0] !== MomentDrawerOptions.RemoveTag,
- );
- setDrawerButtons(filteredButtons);
- }
+ /*
+ * If user is not tagged but button is present, remove button from bottom drawer
+ * If user is tagged but button is not present, add button to bottom drawer
+ */
+ if (momentTagId !== '' && present === -1) {
+ const localDrawerButtons = drawerButtons;
+ localDrawerButtons.push([
+ MomentDrawerOptions.RemoveTag,
+ handleRemoveTag,
+ ]);
+ setDrawerButtons(localDrawerButtons);
+ } else if (momentTagId === '' && present !== -1) {
+ const filteredButtons = drawerButtons.filter(
+ (button) => button[0] !== MomentDrawerOptions.RemoveTag,
+ );
+ setDrawerButtons(filteredButtons);
}
};
setupBottomDrawer();