diff --git a/frontend/src/component/Reporting/ReportCard/ReportCard.module.scss b/frontend/src/component/Reporting/ReportCard/ReportCard.module.scss deleted file mode 100644 index b6ad146ea2..0000000000 --- a/frontend/src/component/Reporting/ReportCard/ReportCard.module.scss +++ /dev/null @@ -1,116 +0,0 @@ -.card { - width: 100%; - padding: var(--card-padding); - margin: var(--card-margin-y) 0; - border-radius: 10px; - box-shadow: none; -} - -.header { - font-size: var(--h1-size); - font-weight: 'bold'; - margin: 0 0 0.5rem 0; -} - -.reportCardContainer { - display: flex; - justify-content: space-between; -} -.reportCardHealth { - padding: 10px; -} -.reportCardAction { - padding: 10px; -} -.reportCardToggle { - padding: 10px; -} - -.reportCardHealthInnerContainer { - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - align-items: center; - height: 80%; -} - -.reportCardHealthRating { - font-size: 2rem; - font-weight: bold; - color: var(--success); -} - -.reportCardList { - list-style-type: none; - margin: 0; - padding: 0; -} - -.reportCardList li { - display: flex; - align-items: center; - margin: 0.5rem 0; -} - -.reportCardList li span { - margin: 0; - padding: 0; - margin-left: 0.5rem; - font-size: var(--p-size); -} - -.check, -.danger { - margin-right: 5px; -} - -.check { - color: var(--success); -} - -.danger { - color: var(--danger); -} - -.reportCardActionContainer { - display: flex; - justify-content: center; - flex-direction: column; -} - -.reportCardActionText { - max-width: 300px; - font-size: var(--p-size); - margin-left: 35px; -} -.reportCardNoActionText { - max-width: 300px; - font-size: var(--p-size); - margin-left: 15px; -} - -.reportCardBtn { - background-color: #f2f2f2; -} - -.healthDanger { - color: var(--danger); -} - -.healthWarning { - color: var(--warning); -} -.lastUpdate { - color: #585858; -} - -@media (max-width: 600px) { - .reportCardContainer { - flex-wrap: wrap; - } - .reportCardToggle { - margin: 10px 5px; - flex-basis: 100%; - } -} diff --git a/frontend/src/component/Reporting/ReportCard/ReportCard.tsx b/frontend/src/component/Reporting/ReportCard/ReportCard.tsx index 04e73f5372..1a4fb34c48 100644 --- a/frontend/src/component/Reporting/ReportCard/ReportCard.tsx +++ b/frontend/src/component/Reporting/ReportCard/ReportCard.tsx @@ -1,132 +1,180 @@ -import classnames from 'classnames'; -import { Paper } from '@mui/material'; +import { Box, Paper, styled } from '@mui/material'; import CheckIcon from '@mui/icons-material/Check'; import ReportProblemOutlinedIcon from '@mui/icons-material/ReportProblemOutlined'; import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender'; -import styles from './ReportCard.module.scss'; import ReactTimeAgo from 'react-timeago'; import { IProjectHealthReport } from 'interfaces/project'; +const StyledBoxActive = styled(Box)(({ theme }) => ({ + display: 'flex', + alignItems: 'center', + color: theme.palette.success.dark, + '& svg': { + color: theme.palette.success.main, + }, +})); + +const StyledBoxStale = styled(Box)(({ theme }) => ({ + display: 'flex', + alignItems: 'center', + color: theme.palette.warning.dark, + '& svg': { + color: theme.palette.warning.main, + }, +})); + +const StyledPaper = styled(Paper)(({ theme }) => ({ + padding: theme.spacing(4), + marginBottom: theme.spacing(2), + borderRadius: theme.shape.borderRadiusLarge, + boxShadow: 'none', + display: 'flex', + justifyContent: 'space-between', + [theme.breakpoints.down('md')]: { + flexDirection: 'column', + gap: theme.spacing(2), + }, +})); + +const StyledHeader = styled('h2')(({ theme }) => ({ + fontSize: theme.fontSizes.mainHeader, + marginBottom: theme.spacing(1), +})); + +const StyledHealthRating = styled('p')(({ theme }) => ({ + fontSize: '2rem', + fontWeight: theme.fontWeight.bold, +})); + +const StyledLastUpdated = styled('p')(({ theme }) => ({ + color: theme.palette.text.secondary, +})); + +const StyledList = styled('ul')(({ theme }) => ({ + listStyleType: 'none', + margin: 0, + padding: 0, + '& svg': { + marginRight: theme.spacing(1), + }, +})); + +const StyledAlignedItem = styled('p')(({ theme }) => ({ + marginLeft: theme.spacing(4), +})); + interface IReportCardProps { healthReport: IProjectHealthReport; } export const ReportCard = ({ healthReport }: IReportCardProps) => { - const healthLessThan50 = healthReport.health < 50; - const healthLessThan75 = healthReport.health < 75; - - const healthClasses = classnames(styles.reportCardHealthRating, { - [styles.healthWarning]: healthLessThan75, - [styles.healthDanger]: healthLessThan50, - }); + const healthRatingColor = + healthReport.health < 50 + ? 'error.main' + : healthReport.health < 75 + ? 'warning.main' + : 'success.main'; const renderActiveToggles = () => ( - <> - + + {healthReport.activeCount} active toggles - + ); const renderStaleToggles = () => ( - <> - + + {healthReport.staleCount} stale toggles - + ); const renderPotentiallyStaleToggles = () => ( - <> - + + {healthReport.potentiallyStaleCount} potentially stale toggles - + ); return ( - -
-
-

Health rating

-
- -1} - show={ -
-

- {healthReport.health}% -

-

- Last updated:{' '} - -

-
- } - /> -
-
-
-

Toggle report

-
    -
  • - -
  • + + + Health rating + -1} + show={ + <> + + {healthReport.health}% + + + Last updated:{' '} + + + + } + /> + + + Toggle report + +
  • - Also includes potentially stale toggles. -

    - } + show={renderActiveToggles} /> +
  • + + Also includes potentially stale toggles. + + } + /> -
  • - -
  • -
-
- -
-

Potential actions

-
-
    -
  • - -
  • -
+
  • + +
  • + + + + Potential actions + +
  • - Review your feature toggles and delete - unused toggles. -

    - } - elseShow={ -

    - No action is required -

    - } + show={renderPotentiallyStaleToggles} /> -
  • -
    -
    -
    + + + + Review your feature toggles and delete unused + toggles. + + } + elseShow={ + + No action is required + + } + /> + + ); }; diff --git a/frontend/src/component/Reporting/ReportStatusCell/ReportStatusCell.tsx b/frontend/src/component/Reporting/ReportStatusCell/ReportStatusCell.tsx index ae4498b228..9dc9f57b8b 100644 --- a/frontend/src/component/Reporting/ReportStatusCell/ReportStatusCell.tsx +++ b/frontend/src/component/Reporting/ReportStatusCell/ReportStatusCell.tsx @@ -4,12 +4,20 @@ import { ReportProblemOutlined, Check } from '@mui/icons-material'; import { styled } from '@mui/material'; import { IReportTableRow } from 'component/Reporting/ReportTable/ReportTable'; -const StyledText = styled('span')(({ theme }) => ({ +const StyledTextPotentiallyStale = styled('span')(({ theme }) => ({ display: 'flex', gap: '1ch', alignItems: 'center', - textAlign: 'right', - '& svg': { color: theme.palette.inactiveIcon }, + color: theme.palette.warning.dark, + '& svg': { color: theme.palette.warning.main }, +})); + +const StyledTextHealthy = styled('span')(({ theme }) => ({ + display: 'flex', + gap: '1ch', + alignItems: 'center', + color: theme.palette.success.dark, + '& svg': { color: theme.palette.success.main }, })); interface IReportStatusCellProps { @@ -24,20 +32,20 @@ export const ReportStatusCell: VFC = ({ if (row.original.status === 'potentially-stale') { return ( - + Potentially stale - + ); } return ( - + Healthy - + ); }; diff --git a/frontend/src/component/Reporting/ReportTable/ReportTable.tsx b/frontend/src/component/Reporting/ReportTable/ReportTable.tsx index 792c621b03..80d8156b79 100644 --- a/frontend/src/component/Reporting/ReportTable/ReportTable.tsx +++ b/frontend/src/component/Reporting/ReportTable/ReportTable.tsx @@ -55,7 +55,7 @@ export const ReportTable = ({ projectId, features }: IReportTableProps) => { const initialState = useMemo( () => ({ hiddenColumns: [], - sortBy: [{ id: 'name' }], + sortBy: [{ id: 'createdAt', desc: true }], }), [] ); @@ -84,9 +84,11 @@ export const ReportTable = ({ projectId, features }: IReportTableProps) => { ); useEffect(() => { + const hiddenColumns = []; if (isSmallScreen) { - setHiddenColumns(['createdAt', 'expiredAt']); + hiddenColumns.push('createdAt', 'expiredAt'); } + setHiddenColumns(hiddenColumns); }, [setHiddenColumns, isSmallScreen]); const header = ( @@ -101,8 +103,6 @@ export const ReportTable = ({ projectId, features }: IReportTableProps) => { /> ); - console.log(rows); - return ( @@ -131,15 +131,15 @@ export const ReportTable = ({ projectId, features }: IReportTableProps) => { condition={globalFilter?.length > 0} show={ - No features found matching “ + No feature toggles found matching “ {globalFilter} ” } elseShow={ - No features available. Get started by adding a - new feature toggle. + No feature toggles available. Get started by + adding a new feature toggle. } /> @@ -182,7 +182,7 @@ const COLUMNS = [ disableGlobalFilter: true, }, { - Header: 'Feature toggle name', + Header: 'Name', accessor: 'name', width: '60%', sortType: 'alphanumeric', @@ -204,8 +204,8 @@ const COLUMNS = [ { Header: 'Status', accessor: 'status', - align: 'right', Cell: ReportStatusCell, + disableGlobalFilter: true, }, { Header: 'State', diff --git a/frontend/src/component/admin/apiToken/ApiTokenTable/ApiTokenTable.tsx b/frontend/src/component/admin/apiToken/ApiTokenTable/ApiTokenTable.tsx index 2c2b97a2d3..5a9315faf5 100644 --- a/frontend/src/component/admin/apiToken/ApiTokenTable/ApiTokenTable.tsx +++ b/frontend/src/component/admin/apiToken/ApiTokenTable/ApiTokenTable.tsx @@ -13,7 +13,6 @@ import { SearchHighlightProvider } from 'component/common/Table/SearchHighlightC import { ApiTokenDocs } from 'component/admin/apiToken/ApiTokenDocs/ApiTokenDocs'; import { CreateApiTokenButton } from 'component/admin/apiToken/CreateApiTokenButton/CreateApiTokenButton'; import { IconCell } from 'component/common/Table/cells/IconCell/IconCell'; -import { TextCell } from 'component/common/Table/cells/TextCell/TextCell'; import { Key } from '@mui/icons-material'; import { ActionCell } from 'component/common/Table/cells/ActionCell/ActionCell'; import { CopyApiTokenButton } from 'component/admin/apiToken/CopyApiTokenButton/CopyApiTokenButton'; @@ -176,12 +175,10 @@ const COLUMNS = [ Header: 'Project', accessor: 'project', Cell: (props: any) => ( - - - + ), minWidth: 120, }, diff --git a/frontend/src/component/admin/apiToken/ProjectsList/ProjectsList.tsx b/frontend/src/component/admin/apiToken/ProjectsList/ProjectsList.tsx index cbac134731..c18918e88f 100644 --- a/frontend/src/component/admin/apiToken/ProjectsList/ProjectsList.tsx +++ b/frontend/src/component/admin/apiToken/ProjectsList/ProjectsList.tsx @@ -1,8 +1,17 @@ +import { styled } from '@mui/material'; import { Highlighter } from 'component/common/Highlighter/Highlighter'; +import { TextCell } from 'component/common/Table/cells/TextCell/TextCell'; import { useSearchHighlightContext } from 'component/common/Table/SearchHighlightContext/SearchHighlightContext'; import { Fragment, VFC } from 'react'; import { Link } from 'react-router-dom'; +const StyledLink = styled(Link)(() => ({ + textDecoration: 'none', + '&:hover, &:focus': { + textDecoration: 'underline', + }, +})); + interface IProjectsListProps { project?: string; projects?: string | string[]; @@ -22,25 +31,29 @@ export const ProjectsList: VFC = ({ : []; if (fields.length === 0) { - return *; + return ( + + * + + ); } return ( - <> + {fields.map((item, index) => ( {index > 0 && ', '} {!item || item === '*' ? ( * ) : ( - + {item} - + )} ))} - + ); }; diff --git a/frontend/src/component/admin/billing/BillingHistory/BillingHistory.tsx b/frontend/src/component/admin/billing/BillingHistory/BillingHistory.tsx index 5d53109448..373f8cf4c6 100644 --- a/frontend/src/component/admin/billing/BillingHistory/BillingHistory.tsx +++ b/frontend/src/component/admin/billing/BillingHistory/BillingHistory.tsx @@ -69,7 +69,7 @@ export const BillingHistory: VFC = ({ }) => { const initialState = useMemo( () => ({ - sortBy: [{ id: 'createdAt', desc: false }], + sortBy: [{ id: 'dueDate' }], }), [] ); diff --git a/frontend/src/component/admin/projectRoles/ProjectRoles/ProjectRoleList/ProjectRoleList.tsx b/frontend/src/component/admin/projectRoles/ProjectRoles/ProjectRoleList/ProjectRoleList.tsx index cebedfd551..6362ae0cf3 100644 --- a/frontend/src/component/admin/projectRoles/ProjectRoles/ProjectRoleList/ProjectRoleList.tsx +++ b/frontend/src/component/admin/projectRoles/ProjectRoles/ProjectRoleList/ProjectRoleList.tsx @@ -175,10 +175,11 @@ const ProjectRoleList = () => { ); useEffect(() => { - setHiddenColumns([]); + const hiddenColumns = []; if (isExtraSmallScreen) { - setHiddenColumns(['Icon']); + hiddenColumns.push('Icon'); } + setHiddenColumns(hiddenColumns); }, [setHiddenColumns, isExtraSmallScreen]); return ( diff --git a/frontend/src/component/admin/users/UsersList/UsersList.tsx b/frontend/src/component/admin/users/UsersList/UsersList.tsx index 3c37da0794..6679524bcd 100644 --- a/frontend/src/component/admin/users/UsersList/UsersList.tsx +++ b/frontend/src/component/admin/users/UsersList/UsersList.tsx @@ -139,6 +139,7 @@ const UsersList = () => { disableSortBy: true, }, { + id: 'name', Header: 'Name', accessor: (row: any) => row.name || '', width: '40%', @@ -231,10 +232,10 @@ const UsersList = () => { hiddenColumns.push('type'); } if (isSmallScreen) { - hiddenColumns.push(...['createdAt', 'username']); + hiddenColumns.push('createdAt', 'username'); } if (isExtraSmallScreen) { - hiddenColumns.push(...['imageUrl', 'role', 'last-login']); + hiddenColumns.push('imageUrl', 'role', 'last-login'); } setHiddenColumns(hiddenColumns); }, [setHiddenColumns, isExtraSmallScreen, isSmallScreen, isBillingUsers]); diff --git a/frontend/src/component/common/PermissionIconButton/PermissionIconButton.tsx b/frontend/src/component/common/PermissionIconButton/PermissionIconButton.tsx index 0728efb26e..74023f1b0c 100644 --- a/frontend/src/component/common/PermissionIconButton/PermissionIconButton.tsx +++ b/frontend/src/component/common/PermissionIconButton/PermissionIconButton.tsx @@ -58,6 +58,7 @@ const PermissionIconButton = ({ {...tooltipProps} title={formatAccessText(access, tooltipProps?.title)} arrow + onClick={e => e.preventDefault()} >