Skip to content

Commit

Permalink
feat: Changed the color usage of the action buttons and made the stat…
Browse files Browse the repository at this point in the history
…us badge generic

Signed-off-by: Tom Lanser <[email protected]>
  • Loading branch information
Tommylans committed Jan 4, 2023
1 parent 3644dab commit 3cf309b
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 11 deletions.
6 changes: 3 additions & 3 deletions packages/toolbox-ui/src/components/RecordActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -20,9 +20,9 @@ export const RecordActions = ({ onAccept, onDecline, onDelete, isLoading }: Reco
),

onDecline && (
<DangerButton key="reject" size="xs" variant="light" onClick={onDecline}>
<SecondaryButton key="reject" size="xs" onClick={onDecline}>
Decline
</DangerButton>
</SecondaryButton>
),

onDelete && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import React from 'react'

import { RecordActions } from '../RecordActions'
import { SmartAvatar } from '../SmartAvatar'
import { StatusBadge } from '../generic/table/StatusBadge'

interface ConnectionsTableProps {
records: ConnectionRecord[]
Expand Down Expand Up @@ -71,9 +72,7 @@ export const ConnectionsTable = ({ records, onDelete, onAccept }: ConnectionsTab
</Text>
</td>
<td className={classes.stateSize}>
<Badge variant={theme.colorScheme === 'dark' ? 'light' : 'outline'} color="blue">
{record.state}
</Badge>
<StatusBadge>{record.state}</StatusBadge>
</td>
<td className={classes.actionsSize}>
<RecordActions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import React from 'react'
import { useCredentialsFormatData } from '../../contexts/CredentialFormatDataProvider'
import { RecordActions } from '../RecordActions'
import { SmartAvatar } from '../SmartAvatar'
import { StatusBadge } from "../generic/table/StatusBadge";

interface CredentialsTableProps {
records: CredentialExchangeRecord[]
Expand Down Expand Up @@ -70,7 +71,9 @@ export const CredentialsTable = ({ records, connections, onDelete, onAccept, onD
</Group>
</td>
<td className={classes.stateSize}>
<Badge variant={theme.colorScheme === 'dark' ? 'light' : 'outline'}>{record.state}</Badge>
<StatusBadge>
{record.state}
</StatusBadge>
</td>
<td className={classes.actionsSize}>
<RecordActions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ const useStyles = createStyles((theme) => ({
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],
},
},
}))

Expand Down
10 changes: 10 additions & 0 deletions packages/toolbox-ui/src/components/generic/table/StatusBadge.tsx
Original file line number Diff line number Diff line change
@@ -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 <Badge variant={colorScheme === 'dark' ? 'light' : 'outline'} color="blue" {...props} />
}
3 changes: 2 additions & 1 deletion packages/toolbox-ui/src/components/proofs/ProofsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ 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[]
Expand Down Expand Up @@ -80,7 +81,7 @@ export const ProofsTable = ({ records, connections, onDelete, onAccept, onDeclin
</Text>
</td>
<td className={classes.stateSize}>
<Badge variant={theme.colorScheme === 'dark' ? 'light' : 'outline'}>{record.state}</Badge>
<StatusBadge>{record.state}</StatusBadge>
</td>
<td className={classes.actionsSize}>
<RecordActions
Expand Down
19 changes: 16 additions & 3 deletions packages/toolbox-ui/src/pages/AgentSelectionScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Card, Container, Flex, Group, Space, Text, Title, UnstyledButton } from '@mantine/core'
import { Card, Container, createStyles, Flex, Group, Space, Text, Title, UnstyledButton } from '@mantine/core'
import { IconPlus } from '@tabler/icons'
import React from 'react'

Expand All @@ -7,7 +7,20 @@ import { SmartAvatar } from '../components/SmartAvatar'
import { useAgentManager } from '../contexts/AgentManagerContext'
import { useNavigation } from '../hooks/useNavigation'

const useStyles = createStyles((theme) => ({
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()

Expand All @@ -22,12 +35,12 @@ export const AgentSelectionScreen = () => {

return (
<Container mt={20}>
<Title size="h3">Agents</Title>
<Title size="h2">Agents</Title>
<Space h="md" />
<Flex gap="md" wrap="wrap">
{agents.map((agent) => (
<UnstyledButton key={agent.id} onClick={() => switchToAgent(agent.id)}>
<Card h={100} w={220}>
<Card h={100} w={220} className={classes.card}>
<Group noWrap>
<SmartAvatar src={agent.agentConfig.connectionImageUrl} size={64} radius="md">
{agent.agentConfig.label}
Expand Down

0 comments on commit 3cf309b

Please sign in to comment.