Skip to content

Conversation

@tstirrat15
Copy link
Contributor

Description

Something I noticed moving around the repo - these components are defined in terms of generics, but they aren't used generically.

Changes

Will annotate.

Testing

Review. See that the panels still look as expected.

@vercel
Copy link

vercel bot commented Dec 18, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
playground Ready Ready Preview, Comment Dec 19, 2025 4:39pm

Copy link
Contributor Author

@tstirrat15 tstirrat15 left a comment

Choose a reason for hiding this comment

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

See comments.

/**
* Panel defines a single panel found in the panel display component.
*/
export interface Panel<L extends string> {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Most of these changes are un-genericking all of these Ls. We only have a single instance of the ReflexedPanel top-level component, so there's no reason to propagate all of these generics through.

* summary is the React tag to render for displaying the summary of the panel.
*/
summary: (props: PanelSummaryProps<L>) => JSX.Element;
Summary: (props: PanelSummaryProps) => ReactNode;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Capsing here means we don't have to do a rename elsewhere.

import { Services } from "../../../services/services";
import { Panel, useSummaryStyles } from "./common";
import { LocationData, PanelsCoordinator } from "./coordinator";
import { ReflexedPanelLocation } from "../types";
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the non-generic type. I'll call out its definition later.

const currentTabName = coordinator.getActivePanel(props.location)?.id || "";

const handleChangeTab = useCallback(
(_event: React.ChangeEvent<object>, selectedPanelId: string) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unused so why bother

Comment on lines -118 to -125
props: {
location: L;
coordinator: PanelsCoordinator<L>;
datastore: DataStore;
services: Services;
} & {
dimensions?: { width: number; height: number };
},
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I also flattened all of these types for the sake of simplicity.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure why this was here.

Comment on lines -50 to -53
export enum ReflexedPanelLocation {
HORIZONTAL = "h",
VERTICAL = "v",
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the enum that was replaced with literals.

Comment on lines -56 to -57
datastore: DataStore;
services: Services;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I inlined these.

}

interface DimensionsProp {
dimensions?: Dimensions | undefined;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same with these.

panels: props.panels,
locations: {
[ReflexedPanelLocation.HORIZONTAL]: {
horizontal: {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Taking advantage of the literals here.

@tstirrat15 tstirrat15 force-pushed the un-generic-panel-display-components branch from cf53e4d to 9bf7e55 Compare December 19, 2025 16:38
@tstirrat15 tstirrat15 marked this pull request as ready for review December 19, 2025 20:36
@tstirrat15 tstirrat15 merged commit 36eb615 into main Jan 5, 2026
5 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Jan 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants