Skip to content

Conversation

@avocawo
Copy link

@avocawo avocawo commented Apr 28, 2025

  • Moved DelegateSelector and DelegateConnectivity from apps/design-system/src/subjects/views/delegates to packages/ui/src/views/delegates.
  • Delegates sticky header + footer.
  • Data table refactoring:
    • Make the table fit to the entire width
    • Aligns Selected cell to the center.
    • Color cells row on hover.
#347 Screenshot@2025-04-28 #346 Screenshot@2025-04-28

@vercel
Copy link

vercel bot commented Apr 28, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
canary ❌ Failed (Inspect) May 2, 2025 1:19pm

<Table.Root
className={isLoading ? '[mask-image:linear-gradient(to_bottom,black_30%,transparent_100%)]' : ''}
className={cn(
isLoading ? '[mask-image:linear-gradient(to_bottom,black_30%,transparent_100%)]' : '',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove this entire line because, if isLoading is true, we're already rendering SkeletonList above

className={isLoading ? '[mask-image:linear-gradient(to_bottom,black_30%,transparent_100%)]' : ''}
className={cn(
isLoading ? '[mask-image:linear-gradient(to_bottom,black_30%,transparent_100%)]' : '',
'overflow-visible',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This class isn’t needed

className={cn(
isLoading ? '[mask-image:linear-gradient(to_bottom,black_30%,transparent_100%)]' : '',
'overflow-visible',
'pt-[0.3125rem]'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This class isn’t needed

<Table.Header>
<Table.Row>
<Table.Head className="w-96">Delegate</Table.Head>
<Table.Head className="w-60">Delegate</Table.Head>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All widths should be set using % because this table can potentially be rendered in full-screen mode at any time.

<Table.Head className="w-44 text-center">Selected</Table.Head>
</Table.Row>
</Table.Header>
{isLoading ? (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove this conditional part of the code because, if isLoading is true, we're already rendering SkeletonList above.

return (
<Table.Row key={groupId}>
<Table.Cell className="max-w-80 content-center truncate">
<Table.Row key={groupId} className="hover:bg-cn-borders-2">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don’t need this class — we already have the hasHighlightOnHover prop set on Table.Body

<Table.Row key={groupId}>
<Table.Cell className="max-w-80 content-center truncate">
<Table.Row key={groupId} className="hover:bg-cn-borders-2">
<Table.Cell className="max-w-40 content-center truncate">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don’t need max-width on the body cells because the widths are already defined in Table.Head

<Table.Cell className="relative min-w-6 text-right">
{isDelegateSelected(
[...defaultTo(groupImplicitSelectors, []), ...defaultTo(groupCustomSelectors, [])],
selectedTags || []
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let’s set a default value of [] for selectedTags prop and remove this condition here

selectedTags || []
) && <Icon name="tick" size={12} className="text-icons-success" />}
) && (
<div className="absolute inset-0 flex w-full items-center justify-center">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure you should be using absolute positioning here — it feels overly complex just to display an icon


return (
<SandboxLayout.Content className="h-full px-0 pt-0">
<SandboxLayout.Content className="h-[calc(100%-theme('spacing.28'))] py-0">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should avoid using custom styles here — it looks like we don’t actually need them anyway

)}

<div className="absolute inset-x-0 bottom-0 bg-cn-background-2 p-4 shadow-md">
<div className="bg-cn-background-2 b-0 sticky inset-x-0 bottom-0 -ml-5 mt-auto w-[calc(100%+theme('spacing.10'))] border-t p-4 shadow-md">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can leave this part as absolute

<div className="flex p-5 pb-0">
Haven&apos;t installed a delegate yet?
<StyledLink className="ml-1 flex flex-row items-center" variant="accent" to="#">
Install delegate <Icon name="attachment-link" className="ml-1" size={12} />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can add a class with gap-x-1 to StyledLink and remove the ml-1 from the Icon

Color table items on hover.
Fixes scroll behavior for empty data list.
Changes data table to take all available space.
Sticky header and footer segments.
Moved delegate-selector and delegate-connectivity under ui package folder. Reuse them in apps/subjects/views.
 - Adds ScrollArea element to enable custom scroll.
 - Fixes UI to match design screens.
 - Passes RadioButton to control.
 - Fixes gaps between sections.
 - Fixes rows height shift on icon appearance.
 - Fixes radio select component according to design.
 - Refactors Option and RadioSelect components.
 - Reverts previous components movements. Moved Drawer to packages/ui only.
@avocawo avocawo force-pushed the delegate-selector-drawer-review branch from ec45fea to 0c2c7b8 Compare May 2, 2025 07:21
import mockDelegatesList from '@subjects/views/delegates/mock-delegates-list.json'
import { defaultTo } from 'lodash-es'

export const useDelegateData = () =>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this hook

export const Option: FC<OptionProps> = ({ control, id, label, description, ariaSelected, className }) => {
const hasLabel = !!label
const hasDescription = !!description
const hasLabelOrDescription = hasLabel || hasDescription
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to add these constants — the same conditions below would’ve been enough

 - Resolves console errors.
 - Fixes Install delegate link margins.
 - Fixes select arrow component alignment.
 - Makes data table fixed.
 - Adds button hover.
 - Fixes RadioSelect component styles when content is really big.
@avocawo avocawo force-pushed the delegate-selector-drawer-review branch from 8719aee to 21f0210 Compare May 2, 2025 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants