Skip to content

Commit

Permalink
[Gitar] Updating TSX files
Browse files Browse the repository at this point in the history
  • Loading branch information
Gitar committed Aug 28, 2024
1 parent ee168ff commit 30dd75c
Showing 1 changed file with 45 additions and 80 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import { FeatureToggleFilters } from './FeatureToggleFilters/FeatureToggleFilter
import { withTableState } from 'utils/withTableState';
import { FeatureTagCell } from 'component/common/Table/cells/FeatureTagCell/FeatureTagCell';
import { FeatureSegmentCell } from 'component/common/Table/cells/FeatureSegmentCell/FeatureSegmentCell';
import { useUiFlag } from 'hooks/useUiFlag';
import { FeatureToggleListActions } from './FeatureToggleListActions/FeatureToggleListActions';
import useLoading from 'hooks/useLoading';
import { usePlausibleTracker } from 'hooks/usePlausibleTracker';
Expand All @@ -55,23 +54,19 @@ const feedbackCategory = 'search';

export const FeatureToggleListTable: VFC = () => {
const theme = useTheme();
const featureSearchFeedback = useUiFlag('featureSearchFeedback');
const featureSearchFeedback = true;
const { trackEvent } = usePlausibleTracker();
const { environments } = useEnvironments();
const enabledEnvironments = environments
.filter((env) => env.enabled)
.map((env) => env.name);
const isSmallScreen = useMediaQuery(theme.breakpoints.down('md'));
const isMediumScreen = useMediaQuery(theme.breakpoints.down('lg'));
const [showExportDialog, setShowExportDialog] = useState(false);

const { setToastApiError } = useToast();
const { uiConfig } = useUiConfig();

const variant =
featureSearchFeedback !== false
? featureSearchFeedback?.name ?? ''
: '';
const variant = featureSearchFeedback?.name ?? '';

const { openFeedback } = useFeedback(
feedbackCategory,
Expand Down Expand Up @@ -234,25 +229,6 @@ export const FeatureToggleListTable: VFC = () => {
}),
);

useEffect(() => {
if (isSmallScreen) {
table.setColumnVisibility({
type: false,
createdAt: false,
tags: false,
lastSeenAt: false,
stale: false,
});
} else if (isMediumScreen) {
table.setColumnVisibility({
lastSeenAt: false,
stale: false,
});
} else {
table.setColumnVisibility({});
}
}, [isSmallScreen, isMediumScreen]);

const setSearchValue = (query = '') => {
setTableState({ query });
trackEvent('search-bar', {
Expand Down Expand Up @@ -322,64 +298,53 @@ export const FeatureToggleListTable: VFC = () => {
<FeatureToggleListActions
onExportClick={() => setShowExportDialog(true)}
/>
{featureSearchFeedback !== false &&
featureSearchFeedback?.enabled && (
<>
<ConditionallyRender
condition={
variant === 'withoutText'
}
show={
<Tooltip
title='Provide feedback'
arrow
>
<IconButton
onClick={
createFeedbackContext
}
size='large'
>
<ReviewsOutlined />
</IconButton>
</Tooltip>
}
/>
<ConditionallyRender
condition={variant === 'withText'}
show={
<Button
startIcon={
<ReviewsOutlined />
}
{featureSearchFeedback?.enabled && (
<>
<ConditionallyRender
condition={variant === 'withoutText'}
show={
<Tooltip
title='Provide feedback'
arrow
>
<IconButton
onClick={
createFeedbackContext
}
size='large'
>
Provide feedback
</Button>
}
/>{' '}
<ConditionallyRender
condition={
variant === 'withTextOutlined'
}
show={
<Button
startIcon={
<ReviewsOutlined />
}
onClick={
createFeedbackContext
}
variant='outlined'
>
Provide feedback
</Button>
}
/>
</>
)}
<ReviewsOutlined />
</IconButton>
</Tooltip>
}
/>
<ConditionallyRender
condition={variant === 'withText'}
show={
<Button
startIcon={<ReviewsOutlined />}
onClick={createFeedbackContext}
>
Provide feedback
</Button>
}
/>{' '}
<ConditionallyRender
condition={
variant === 'withTextOutlined'
}
show={
<Button
startIcon={<ReviewsOutlined />}
onClick={createFeedbackContext}
variant='outlined'
>
Provide feedback
</Button>
}
/>
</>
)}
</>
}
>
Expand Down

0 comments on commit 30dd75c

Please sign in to comment.