Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: device count flag without variant #8773

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,13 @@ import type { FC } from 'react';
import { IconCell } from 'component/common/Table/cells/IconCell/IconCell';
import WarningIcon from '@mui/icons-material/WarningAmber';
import { Tooltip } from '@mui/material';
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
import { useVariant } from 'hooks/useVariant';

type UserSessionsCellProps = {
count?: number;
};

export const UserSessionsCell: FC<UserSessionsCellProps> = ({ count }) => {
const { uiConfig } = useUiConfig();
const minimumCountToShow = useVariant<number>(
uiConfig.flags.showUserDeviceCount,
);

if (!count || count < (minimumCountToShow ? minimumCountToShow : 5)) {
if (!count || count < 5) {
return null;
}

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/interfaces/uiConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export type UiFlags = {
'enterprise-payg'?: boolean;
simplifyProjectOverview?: boolean;
productivityReportEmail?: boolean;
showUserDeviceCount?: Variant;
showUserDeviceCount?: boolean;
flagOverviewRedesign?: boolean;
};

Expand Down
1 change: 1 addition & 0 deletions frontend/src/interfaces/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export interface IUser {
addedAt?: string;
accountType?: AccountType;
scimId?: string;
activeSessions?: number;
}

export interface IPermission {
Expand Down
Loading