From 226c5061d8537edca46f1d613aaaa8558529b979 Mon Sep 17 00:00:00 2001 From: Tom Lanser Date: Wed, 4 Jan 2023 13:57:43 +0100 Subject: [PATCH] feat: Changed the color usage of the action buttons and made the status badge generic Signed-off-by: Tom Lanser --- .../src/components/RecordActions.tsx | 6 +++--- .../connections/ConnectionsTable.tsx | 8 +++----- .../credentials/CredentialsTable.tsx | 6 +++--- .../components/generic/buttons/Buttons.tsx | 4 ++++ .../components/generic/table/StatusBadge.tsx | 10 ++++++++++ .../src/components/proofs/ProofsTable.tsx | 6 +++--- .../src/pages/AgentSelectionScreen.tsx | 19 ++++++++++++++++--- 7 files changed, 42 insertions(+), 17 deletions(-) create mode 100644 packages/toolbox-ui/src/components/generic/table/StatusBadge.tsx diff --git a/packages/toolbox-ui/src/components/RecordActions.tsx b/packages/toolbox-ui/src/components/RecordActions.tsx index bcb60fd..0dc6f5f 100644 --- a/packages/toolbox-ui/src/components/RecordActions.tsx +++ b/packages/toolbox-ui/src/components/RecordActions.tsx @@ -2,7 +2,7 @@ import { ActionIcon, Group, Loader } from '@mantine/core' import { IconTrash } from '@tabler/icons' import React from 'react' -import { DangerButton, PrimaryButton } from './generic' +import { PrimaryButton, SecondaryButton } from './generic' interface RecordActionsProps { onDelete?: () => void @@ -20,9 +20,9 @@ export const RecordActions = ({ onAccept, onDecline, onDelete, isLoading }: Reco ), onDecline && ( - + Decline - + ), onDelete && ( diff --git a/packages/toolbox-ui/src/components/connections/ConnectionsTable.tsx b/packages/toolbox-ui/src/components/connections/ConnectionsTable.tsx index b50119f..38e01b5 100644 --- a/packages/toolbox-ui/src/components/connections/ConnectionsTable.tsx +++ b/packages/toolbox-ui/src/components/connections/ConnectionsTable.tsx @@ -1,11 +1,12 @@ import type { ConnectionRecord } from '@aries-framework/core' import { ConnectionsUtil } from '@animo/toolbox-core/src/utils/records/ConnectionsUtil' -import { Badge, createStyles, Group, ScrollArea, Table, Text, useMantineTheme } from '@mantine/core' +import { createStyles, Group, ScrollArea, Table, Text } from '@mantine/core' import React from 'react' import { RecordActions } from '../RecordActions' import { SmartAvatar } from '../SmartAvatar' +import { StatusBadge } from '../generic/table/StatusBadge' interface ConnectionsTableProps { records: ConnectionRecord[] @@ -35,7 +36,6 @@ const useStyles = createStyles(() => ({ export const ConnectionsTable = ({ records, onDelete, onAccept }: ConnectionsTableProps) => { const { classes } = useStyles() - const theme = useMantineTheme() return ( @@ -71,9 +71,7 @@ export const ConnectionsTable = ({ records, onDelete, onAccept }: ConnectionsTab - - {record.state} - + {record.state} ({ export const CredentialsTable = ({ records, connections, onDelete, onAccept, onDecline }: CredentialsTableProps) => { const { classes } = useStyles() - const theme = useMantineTheme() const { formattedData } = useCredentialsFormatData() return ( @@ -70,7 +70,7 @@ export const CredentialsTable = ({ records, connections, onDelete, onAccept, onD - {record.state} + {record.state} ({ secondary: { backgroundColor: theme.colorScheme === 'dark' ? theme.colors.animoBlack[0] : theme.colors.animoWhite[0], color: theme.colorScheme === 'dark' ? theme.colors.animoWhite[0] : theme.colors.animoBlack[0], + + '&:hover': { + backgroundColor: theme.colorScheme === 'dark' ? theme.colors.animoBlack[1] : theme.colors.animoWhite[1], + }, }, })) diff --git a/packages/toolbox-ui/src/components/generic/table/StatusBadge.tsx b/packages/toolbox-ui/src/components/generic/table/StatusBadge.tsx new file mode 100644 index 0000000..fb27c35 --- /dev/null +++ b/packages/toolbox-ui/src/components/generic/table/StatusBadge.tsx @@ -0,0 +1,10 @@ +import type { BadgeProps } from '@mantine/core' + +import { Badge, useMantineTheme } from '@mantine/core' +import React from 'react' + +export const StatusBadge = (props: BadgeProps) => { + const { colorScheme } = useMantineTheme() + + return +} diff --git a/packages/toolbox-ui/src/components/proofs/ProofsTable.tsx b/packages/toolbox-ui/src/components/proofs/ProofsTable.tsx index 6e76fbb..708395f 100644 --- a/packages/toolbox-ui/src/components/proofs/ProofsTable.tsx +++ b/packages/toolbox-ui/src/components/proofs/ProofsTable.tsx @@ -1,12 +1,13 @@ import type { ConnectionRecord, ProofExchangeRecord } from '@aries-framework/core' import { ProofsUtil } from '@animo/toolbox-core/src/utils/records/ProofsUtil' -import { Badge, createStyles, Group, ScrollArea, Table, Text, useMantineTheme } from '@mantine/core' +import { createStyles, Group, ScrollArea, Table, Text } from '@mantine/core' import React from 'react' import { useProofsFormatData } from '../../contexts/ProofsFormatDataProvider' import { RecordActions } from '../RecordActions' import { SmartAvatar } from '../SmartAvatar' +import { StatusBadge } from '../generic/table/StatusBadge' interface ProofsTableProps { records: ProofExchangeRecord[] @@ -38,7 +39,6 @@ const useStyles = createStyles(() => ({ export const ProofsTable = ({ records, connections, onDelete, onAccept, onDecline }: ProofsTableProps) => { const { classes } = useStyles() - const theme = useMantineTheme() const { formattedData } = useProofsFormatData() return ( @@ -80,7 +80,7 @@ export const ProofsTable = ({ records, connections, onDelete, onAccept, onDeclin - {record.state} + {record.state} ({ + card: { + backgroundColor: theme.colorScheme === 'dark' ? theme.colors.dark[6] : theme.colors.gray[0], + boxShadow: theme.shadows.xs, + transition: 'background-color 0.2s ease', + + '&:hover': { + backgroundColor: theme.colorScheme === 'dark' ? theme.colors.dark[5] : theme.colors.gray[1], + }, + }, +})) + export const AgentSelectionScreen = () => { + const { classes } = useStyles() const navigation = useNavigation() const { agents, setCurrentAgentId, loading } = useAgentManager() @@ -22,12 +35,12 @@ export const AgentSelectionScreen = () => { return ( - Agents + Agents {agents.map((agent) => ( switchToAgent(agent.id)}> - + {agent.agentConfig.label}