diff --git a/src/api/client/createClient.ts b/src/api/client/createClient.ts index 07e0cf151e..03dacd9801 100644 --- a/src/api/client/createClient.ts +++ b/src/api/client/createClient.ts @@ -28,6 +28,8 @@ export const createClient = ({ const client = new ApolloClient({ name: 'cord-field', version: process.env.RAZZLE_GIT_HASH, + // This should be the default, but it doesn't appear that the library can detect the environment correctly. + connectToDevTools: process.env.NODE_ENV !== 'production', ssrMode: !!ssr, cache: createCache(), link: ApolloLink.from([ diff --git a/src/components/Icons/SvgSkeleton.tsx b/src/components/Icons/SvgSkeleton.tsx new file mode 100644 index 0000000000..efaa60f81c --- /dev/null +++ b/src/components/Icons/SvgSkeleton.tsx @@ -0,0 +1,32 @@ +import { Skeleton, SvgIconProps } from '@mui/material'; +import { alpha, useTheme } from '@mui/material/styles'; +import { forwardRef } from 'react'; + +/** + * Add skeleton effect to SVG icons. + * @example + * + */ +export const SvgSkeleton = forwardRef( + function SvgSkeleton(props, ref) { + const theme = useTheme(); + return ( + *': { visibility: 'initial' }, + }} + /> + ); + } +); diff --git a/src/components/Sensitivity/SensitivityIcon.tsx b/src/components/Sensitivity/SensitivityIcon.tsx index 4cd016a851..8ce321354e 100644 --- a/src/components/Sensitivity/SensitivityIcon.tsx +++ b/src/components/Sensitivity/SensitivityIcon.tsx @@ -1,23 +1,8 @@ -import { VerifiedUser } from '@mui/icons-material'; -import { SvgIconProps, Tooltip } from '@mui/material'; -import { grey } from '@mui/material/colors'; -import { makeStyles } from 'tss-react/mui'; +import { GppGood, GppMaybe, Shield } from '@mui/icons-material'; +import { SvgIcon, SvgIconProps, Tooltip } from '@mui/material'; +import { forwardRef } from 'react'; import { Sensitivity as SensitivityType } from '~/api/schema.graphql'; - -const useStyles = makeStyles()(({ palette }) => ({ - // eslint-disable-next-line tss-unused-classes/unused-classes - Low: { - color: grey[400], - }, - // eslint-disable-next-line tss-unused-classes/unused-classes - Medium: { - color: palette.warning.main, - }, - // eslint-disable-next-line tss-unused-classes/unused-classes - High: { - color: palette.error.main, - }, -})); +import { SvgSkeleton } from '../Icons/SvgSkeleton'; export interface SensitivityIconProps extends SvgIconProps { value?: SensitivityType; @@ -32,14 +17,42 @@ export const SensitivityIcon = ({ disableTooltip, ...rest }: SensitivityIconProps) => { - const { classes, cx } = useStyles(); - + const Icon = value && !loading ? icons[value] : Loading; return ( - + ); }; + +const Loading = forwardRef( + function LoadingSensitivity(props, ref) { + return ; + } +); + +const High = forwardRef(function HighSensitivity( + props, + ref +) { + return ; +}); + +const Medium = forwardRef( + function MediumSensitivity(props, ref) { + return ( + + + + ); + } +); + +const Low = forwardRef(function LowSensitivity( + props, + ref +) { + return ; +}); + +const icons = { High, Medium, Low }; diff --git a/src/scenes/Projects/Members/Create/CreateProjectMember.tsx b/src/scenes/Projects/Members/Create/CreateProjectMember.tsx index 38971e491a..87fea23c7e 100644 --- a/src/scenes/Projects/Members/Create/CreateProjectMember.tsx +++ b/src/scenes/Projects/Members/Create/CreateProjectMember.tsx @@ -7,7 +7,6 @@ import { addItemToList } from '~/api'; import { CreateProjectMember as CreateProjectMemberInput, RoleLabels, - RoleList, } from '~/api/schema.graphql'; import { labelFrom } from '~/common'; import { @@ -98,7 +97,8 @@ export const CreateProjectMember = ({ - !!userRoles && !userRoles.includes(option) - } variant="outlined" /> diff --git a/yarn.lock b/yarn.lock index ce5bad6851..7031d40a85 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6272,9 +6272,9 @@ __metadata: linkType: hard "caniuse-lite@npm:^1.0.0, caniuse-lite@npm:^1.0.30001426, caniuse-lite@npm:^1.0.30001449": - version: 1.0.30001450 - resolution: "caniuse-lite@npm:1.0.30001450" - checksum: 511b360bfc907b2e437699364cf96b83507bc45043926450056642332bcd6f65a1e72540c828534ae15e0ac906e3e9af46cb2bb84458dd580bc31478e9dce282 + version: 1.0.30001519 + resolution: "caniuse-lite@npm:1.0.30001519" + checksum: 66085133ede05d947e30b62fed2cbae18e5767afda8b0de38840883e1cfe5846bf1568ddbafd31647544e59112355abedaf9c867ac34541bfc20d69e7a19d94c languageName: node linkType: hard