-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
System form/vendor selector fixes (#4420)
Showing
6 changed files
with
260 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
126 changes: 39 additions & 87 deletions
126
clients/admin-ui/src/features/system/dictionary-data-uses/EmptyTableState.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,99 +1,51 @@ | ||
import { AddIcon, WarningTwoIcon } from "@chakra-ui/icons"; | ||
import { Box, Button, HStack, Stack, Text, Tooltip } from "@fidesui/react"; | ||
import { ReactNode, useMemo } from "react"; | ||
|
||
import { SparkleIcon } from "../../common/Icon/SparkleIcon"; | ||
import { Box, Button, HStack, Stack, Text } from "@fidesui/react"; | ||
import { ReactNode } from "react"; | ||
|
||
type Props = { | ||
title: string; | ||
description: string | ReactNode; | ||
dictAvailable: boolean; | ||
handleAdd: () => void; | ||
handleDictSuggestion: () => void; | ||
vendorSelected: boolean; | ||
}; | ||
|
||
const EmptyTableState = ({ | ||
title, | ||
description, | ||
dictAvailable = false, | ||
handleAdd, | ||
handleDictSuggestion, | ||
vendorSelected, | ||
}: Props) => { | ||
const dictDisabledTooltip = useMemo( | ||
() => | ||
"You will need to select a vendor for this system before you can use the Fides dictionary. You can do this on System Information tab above.", | ||
[] | ||
); | ||
|
||
return ( | ||
<Stack | ||
backgroundColor="gray.50" | ||
border="1px solid" | ||
borderColor={dictAvailable ? "purple.400" : "blue.500"} | ||
borderRadius="md" | ||
justifyContent="space-between" | ||
py={4} | ||
px={6} | ||
data-testid="empty-state" | ||
> | ||
<HStack> | ||
{dictAvailable ? ( | ||
<SparkleIcon alignSelf="start" color="purple.400" mt={0.5} /> | ||
) : ( | ||
<WarningTwoIcon alignSelf="start" color="blue.400" mt={0.5} /> | ||
)} | ||
const EmptyTableState = ({ title, description, handleAdd }: Props) => ( | ||
<Stack | ||
backgroundColor="gray.50" | ||
border="1px solid" | ||
borderColor="blue.500" | ||
borderRadius="md" | ||
justifyContent="space-between" | ||
py={4} | ||
px={6} | ||
data-testid="empty-state" | ||
> | ||
<HStack> | ||
<WarningTwoIcon alignSelf="start" color="blue.400" mt={0.5} /> | ||
|
||
<Box> | ||
<Text fontWeight="bold" fontSize="sm" mb={1}> | ||
{title} | ||
</Text> | ||
<Box> | ||
<Text fontWeight="bold" fontSize="sm" mb={1}> | ||
{title} | ||
</Text> | ||
|
||
<Text fontSize="sm" color="gray.600" lineHeight="5"> | ||
{description} | ||
</Text> | ||
<HStack mt={4}> | ||
{dictAvailable ? ( | ||
<> | ||
<Tooltip | ||
hasArrow | ||
placement="top" | ||
label={dictDisabledTooltip} | ||
isDisabled={vendorSelected} | ||
shouldWrapChildren | ||
> | ||
<Button | ||
size="xs" | ||
colorScheme="purple" | ||
fontWeight="semibold" | ||
data-testid="dict-btn" | ||
onClick={handleDictSuggestion} | ||
rightIcon={<SparkleIcon />} | ||
disabled={!vendorSelected} | ||
> | ||
Generate data uses automatically | ||
</Button> | ||
</Tooltip> | ||
<Text size="sm">or</Text> | ||
</> | ||
) : null} | ||
<Button | ||
size="xs" | ||
colorScheme="black" | ||
backgroundColor="primary.800" | ||
fontWeight="semibold" | ||
data-testid="add-btn" | ||
onClick={handleAdd} | ||
rightIcon={<AddIcon boxSize={2} />} | ||
> | ||
Add data use | ||
</Button> | ||
</HStack> | ||
</Box> | ||
</HStack> | ||
</Stack> | ||
); | ||
}; | ||
<Text fontSize="sm" color="gray.600" lineHeight="5"> | ||
{description} | ||
</Text> | ||
<HStack mt={4}> | ||
<Button | ||
size="xs" | ||
colorScheme="black" | ||
backgroundColor="primary.800" | ||
fontWeight="semibold" | ||
data-testid="add-btn" | ||
onClick={handleAdd} | ||
rightIcon={<AddIcon boxSize={2} />} | ||
> | ||
Add data use | ||
</Button> | ||
</HStack> | ||
</Box> | ||
</HStack> | ||
</Stack> | ||
); | ||
|
||
export default EmptyTableState; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters