[Chakra exit · Phase 1 · PR 3/14] frontend: Registry internals for the shared display wrappers, drop Chakra type seams - #2628
Conversation
✅ Clean — no registry drift, off-token colours, or ad-hoc classesApp:
Generated by lookout audit-changes. |
16bc1b0 to
f1b4367
Compare
a3fe072 to
8e31d03
Compare
f1b4367 to
90ba8bd
Compare
8e31d03 to
85b9ef3
Compare
90ba8bd to
0bcd095
Compare
85b9ef3 to
dd5ebb7
Compare
0bcd095 to
044be93
Compare
fad9e0b to
fb58adc
Compare
…akra type seams
Five app-owned wrappers keep their exports and get Registry internals, so
their importers do not change:
- tsx-utils: DefaultSkeleton -> SkeletonText; InfoText -> one Tooltip /
TooltipTrigger / TooltipContent tree (placement narrows to top|bottom|
left|right, no caller passed one); OptionGroup -> RadioGroup +
RadioGroupItem nested in the Registry Label. The file no longer imports
@redpanda-data/ui.
- misc/section: Chakra Section -> Card size="full" kept in block flow with
Section's px-6; props are children, id, className and a grid-area-only
style. The 17 call sites that passed py / my / minWidth / gridArea /
overflowY / borderColor move them to a class, a wrapper or gridArea;
flexDirection on a block Box was a no-op. Overview's <hr> keeps the
margins the Chakra Section injected. LogsTab loses a `variant` no caller
passed.
- misc/tabs: Chakra Tabs items= -> Registry Tabs, uncontrolled with
defaultValue, underline variant, activateOnFocus so arrow keys still
select; panels keep Chakra's 1rem padding; isFitted -> layout="full".
Its six tests pass unchanged.
- misc/statistic: Chakra Stat -> Registry Stat label/value (title, value,
className; hint and SpaceProps had no callers). Spacing moves to the
rows that lay stats out (Flex gap={8} / flex gap-8).
- misc/small-stat: Flex + Text -> a flex div.
Type seams: state/ui.ts takes SortingState from @tanstack/react-table (same
shape as the v8 one Chakra re-exported) and defines ConnectTabKeys itself
instead of importing it from pages/connect/overview. TopicTabId stays an
`import type` from topic-details until the #2588 stream lands.
utils/legacy-data-table.ts is untouched on purpose: it derives its types
from the legacy DataTable because the v9 ColumnDef is the wrong shape for
it, and deletes with the last legacy table.
Importers of @redpanda-data/ui: 95 -> 89.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
`Code` in tsx-utils and nine raw call sites render `.codeBox`, which hardcoded a light grey background with no text colour, so in the dark theme the inherited light foreground sat on a light box and the text was unreadable (seen on the topic-messages "Backend Error" alert). Background and border now come from the surface and border tokens, which resolve in both themes and match the registry's inline code. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
ba59065 to
2a6dbb6
Compare
| export function SmallStat(p: { title: JSX.Element | string; children: JSX.Element | number | string }) { | ||
| return ( | ||
| <Flex color="var(--color-foreground)" fontFamily="Inter" fontWeight="400" gap="2"> | ||
| <Text fontWeight="500">{p.title}: </Text> | ||
| <div className="flex gap-2 text-foreground"> | ||
| <span className="font-medium">{p.title}: </span> | ||
| {p.children} | ||
| </Flex> | ||
| </div> | ||
| ); | ||
| } |
There was a problem hiding this comment.
why not use the registry Stat?
There was a problem hiding this comment.
there is a small size https://ui-playground.netlify.app/stat
There was a problem hiding this comment.
This PR is to remove the usage of Chakra within internal components + change no visuals ideally. The Phase 2 work will be swapping to actual Registry components
| <Section py={4}> | ||
| <Flex> | ||
| <Section className="py-4"> | ||
| <Flex gap={8}> |
There was a problem hiding this comment.
I thought we got rid of Flex since that was chakra, preferring plain divs + tailwind instead
There was a problem hiding this comment.
This PR is just to replace the components usage of Chakra, not at the page level.
Page level is coming in the Phase 2 work
| <Statistic | ||
| className={`status-bar ${clusterStatus.className}`} | ||
| title="Cluster Status" | ||
| value={clusterStatus.displayText} | ||
| /> | ||
| <Statistic title="Cluster Storage Size" value={brokerSize} /> | ||
| <Statistic title="Cluster Version" value={version} /> | ||
| <Statistic title="Brokers Online" value={brokersOnlineText} /> | ||
| <Statistic title="Topics" value={overview.kafka?.topicsCount ?? NOT_AVAILABLE} /> | ||
| <Statistic title="Replicas" value={overview.kafka?.replicasCount ?? NOT_AVAILABLE} /> |
There was a problem hiding this comment.
i feel like we shouldn't have these thing wrappers of registry components... ie: replace Statistic with Stat, Section with Card. otherwise we're just perpetuating more tech debt we'll have to clean up in the future.
| <> | ||
| <Box my="1rem">The logs below are for the last five hours.</Box> | ||
|
|
||
| <Section borderColor={variant === 'ghost' ? 'transparent' : undefined} minWidth="800px" overflowY="auto"> |
There was a problem hiding this comment.
iiutc, the transparent border override is to prevent the global selector that adds a border to every div. I know we're removing that in an upcoming PR, but wanted to call it out in case this was missed
Chakra exit · Phase 1 (wrappers) · PR 3 of 14
Part of the Chakra exit plan and live tracker. Phase 1 re-implements the shared wrappers behind their existing exports, so page code does not change. Branch
chakra-exit/03-display-primitives, stacked on #2627; each PR on the ladder shows only its own diff and re-targetsmasteras its base merges.Five shared wrappers keep their exports and get Registry internals, so their importers do not change.
utils/tsx-utils.tsxno longer imports@redpanda-data/uiat all. The one type seam instate/ui.tsmoves to TanStack v9, and thestate/ui.ts → pages/connect/overviewimport is gone.Wrappers (same export, new internals)
tsx-utilsDefaultSkeletonSkeleton height={4} noOfLines={8}SkeletonText lines={8} width="full", samemotion.div+ 2 rem margintsx-utilsInfoTextTooltip hasArrow label placementTooltip/TooltipTrigger render/TooltipContent side;placementnarrows totop|bottom|left|right(no caller passed one)tsx-utilsOptionGroupRadioGroup options=RadioGroup orientation="horizontal"+RadioGroupItem, each in a<label htmlFor>misc/sectionSectionSection(block<section>, white, border,rounded-lg, shadow,p-6) forwarding allChakraPropsCard size="full" variant="elevated"withgap-0 px-6; props are nowid,className,stylepy=,my=,minWidth=,gridArea=,overflowY=,borderColor=became a class or an inlinegridArea;flexDirection="column"on a block Box was a no-op and is droppedmisc/tabsTabsTabs items=(index-based)Tabs/TabsList variant="underline"/TabsTrigger/TabsContent, value-based;isFitted→layout="full"; inactive panels stay unmounted as beforemisc/statisticStatisticStat+StatNumber/StatLabel,SpacePropspassthroughStat label value; props aretitle,value,className. No caller usedhintor a space propmisc/small-statSmallStatFlex+Textdiv+span; nothing here is a Stat.codeBox(whattsx-utilsCodeand nine raw call sites render)--color-surface-subtle/--color-bordertokens, so it reads in both themesType seams
state/ui.ts:SortingStatenow comes from@tanstack/react-table(v9). The shape is identical to the v8 one Chakra re-exported ({ id: string; desc: boolean }[]), and it was the last file importing it from@redpanda-data/ui.ConnectTabKeysis defined instate/ui.tsand no longer imported from a page component.TopicTabIdstill comes fromtopics/topic-detailsas animport type— erased at build, and that file belongs to the feat: new topic messages page behind enableNewTopicMessagesPage flag #2588 stream, so it moves when that lands.utils/legacy-data-table.tsis deliberately untouched: it derives column/row types from the legacyDataTablebecause the app's v9ColumnDefis the wrong shape for that component. It deletes with the last legacy table (its own comment says so).What a reviewer should look at
The two hunks with judgement in them are
misc/section.tsx(a<section>became aCardkept in block flow with a grid-area-onlystyle) andmisc/tabs/tabs.tsx(uncontrolled Registry Tabs seeded fromselectedTabKey, which the old wrapper also read only once). Visually:Statisticnow renders the RegistryStat, so the stat strips on Overview, Broker details, Kafka Connect cards and Reassign partitions switch from value-above-label to label-above-value — the sameStatthe consumer-group page already uses. The oldstatus-barcolour class on Overview's cluster-status stat is passed through, but its CSS was scoped under a dead.ant-statisticselector and has not painted for some time.Effect
Files importing
@redpanda-data/ui: 95 → 89.Gates
bun run type:check·bun run lint(no dirty tree; every remaining lint finding on touched files is pre-existing on master) · unit suite · integration suite (121 files / 1270 tests), includingmisc/tabs/tabs.test.tsx.Review pass (2026-09-03)
Sectionkeeps block flow. Card is a flex column, which stretched the "Create …" buttons in the security tabs to full width and stopped margins collapsing;blockrestores the old layout. Itsstyleprop is typed togridAreaonly, and Overview's<hr>keeps the margins the Chakra Section used to inject. The Card is adiv, not a<section>— the registry Card has norenderprop; nothing selects on the element.Tabsis uncontrolled (defaultValue), forwardsonValueChange, and passesactivateOnFocusso arrow keys still select a tab as Chakra's did. Function-valued content is rendered through a child component, so it runs only for the active panel. Panels keep Chakra's 1rem padding.Statisticis a plainStat; spacing moved to the rows that lay stats out (Flex gap={8}/flex gap-8) instead of a margin baked into each stat.OptionGroupnests each radio in the registryLabel(implicit association), replacing hand-built ids that could collide.InfoTextbuilds one tooltip tree;LogsTabloses avariantno caller passed; the unit stub drops two dead type exports.Plan (internal): https://claude.ai/code/artifact/1861e21c-624b-4270-98ad-9921b22c2498
🤖 Generated with Claude Code