diff --git a/src/pages/Bug/Actions.tsx b/src/pages/Bug/Actions.tsx index c54ec22d7..d1206eb42 100644 --- a/src/pages/Bug/Actions.tsx +++ b/src/pages/Bug/Actions.tsx @@ -2,6 +2,7 @@ import { ChatProvider, LG } from '@appquality/unguess-design-system'; import { useCallback, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { useParams } from 'react-router-dom'; +import { useFeatureFlag } from 'src/hooks/useFeatureFlag'; import { appTheme } from 'src/app/theme'; import { BugStateDropdown } from 'src/common/components/BugDetail/BugStateDropdown'; import BugPriority from 'src/common/components/BugDetail/Priority'; @@ -44,6 +45,9 @@ export const Actions = () => { const cid = campaignId ? campaignId.toString() : ''; const bid = bugId ? bugId.toString() : ''; + const { hasFeatureFlag } = useFeatureFlag(); + + const canAccessComments = hasFeatureFlag('bug-comments'); const { data: bug, @@ -96,15 +100,17 @@ export const Actions = () => { - - - - + {canAccessComments && ( + + + + + )} ); }; diff --git a/src/pages/Bug/Chat.tsx b/src/pages/Bug/Chat.tsx index d095f59c2..d7913ee43 100644 --- a/src/pages/Bug/Chat.tsx +++ b/src/pages/Bug/Chat.tsx @@ -7,8 +7,6 @@ import { import { format } from 'date-fns'; import { t } from 'i18next'; import { useEffect, useState } from 'react'; -import { useFeatureFlag } from 'src/hooks/useFeatureFlag'; -import { styled } from 'styled-components'; import { useAppSelector } from 'src/app/hooks'; import defaultBkg from 'src/assets/bg-chat.svg'; import { getInitials } from 'src/common/components/navigation/header/utils'; @@ -16,6 +14,7 @@ import { useDeleteCampaignsByCidBugsAndBidCommentsCmidMutation, useGetCampaignsByCidBugsAndBidCommentsQuery, } from 'src/features/api'; +import { styled } from 'styled-components'; import { DeleteCommentModal } from './DeleteCommentModal'; function convertToLocalTime(utcString: string) { @@ -67,10 +66,6 @@ export const ChatBox = ({ commentsRefetch(); }; - const { hasFeatureFlag } = useFeatureFlag(); - - const canAccessFeature = hasFeatureFlag('bug-comments'); - useEffect(() => { if (comments) { // Scroll to bottom of chat @@ -82,69 +77,64 @@ export const ChatBox = ({ }, [comments]); return ( <> - {canAccessFeature && ( - - {t('__BUG_COMMENTS_CHAT_HEADER__')} - {comments && comments.items.length > 0 && ( - - {comments.items.map((comment) => ( - - <> -
- {(comment.creator.id === user.id || - user.role === 'administrator') && ( - - )} - -
- ))} -
- )} - t('__BUG_COMMENTS_CHAT_PLACEHOLDER'), + + {t('__BUG_COMMENTS_CHAT_HEADER__')} + {comments && comments.items.length > 0 && ( + + {comments.items.map((comment) => ( + + <> +
+ {(comment.creator.id === user.id || + user.role === 'administrator') && ( + + )} + +
+ ))} +
+ )} + t('__BUG_COMMENTS_CHAT_PLACEHOLDER'), + }} + /> + + - - -
- )} + > + {t('__BUG_COMMENTS_CHAT_CANCEL__')} + + + +
{isModalOpen && ( theme.palette.azure[600]}; color: ${({ theme }) => theme.palette.white}; margin-right: ${({ theme }) => theme.space.md}; - width: ${appTheme.space.md}; + padding: 0 ${appTheme.space.xxs}; height: ${appTheme.space.sm}; font-size: ${appTheme.fontSizes.xs}; border-radius: ${appTheme.borderRadii.lg};