Skip to content

Conversation

@nvs119
Copy link
Contributor

@nvs119 nvs119 commented Feb 11, 2025

Description

Adding header back for Compass Web with a preview badge for private preview users
COMPASS-8904

Screenshot 2025-02-12 at 10 22 31 AM

Motivation and Context

  • Bugfix
  • New feature
  • Dependency update
  • Misc

Open Questions

Getting a type error on line 206 of compass-web/src/entrypoint.tsx, which I can't figure out why for the life of me. Help appreciated!!

Dependents

Types of changes

  • Backport Needed
  • Patch (non-breaking change which fixes an issue)
  • Minor (non-breaking change which adds functionality)
  • Major (fix or feature that would cause existing functionality to change)

@nvs119 nvs119 changed the title (feat)sidebar: show header for Data Explorer COMPASS-8904 feat(sidebar): show header for Data Explorer COMPASS-8904 Feb 11, 2025
@github-actions github-actions bot added the feat label Feb 11, 2025
<CompassSidebarPlugin
showSidebarHeader={false}
onOpenConnectViaModal={onOpenConnectViaModal}
isCompassWeb={true}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

can't figure out why this is giving me type error:
Type '{ onOpenConnectViaModal: ((atlasMetadata: AtlasClusterMetadata | undefined) => void) | undefined; isCompassWeb: boolean; }' is not assignable to type 'IntrinsicAttributes & SidebarPluginProps & { children?: ReactNode; }'. Property 'isCompassWeb' does not exist on type 'IntrinsicAttributes & SidebarPluginProps & { children?: ReactNode; }'.ts(2322)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

just kidding! running npm run bootstrap fixed this - was there a less heavyweight command i could run to reload types?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah, sorry, we didn't touch on that, for context: types are pulled from compiled files, so if you change one package, you need to rebuild it so that you get correct highlight in the other. You can manually rebuild just one package by running something like npm run bootstrap -w packages/<package dir>, this will avoid rebuilding everything like bootstrap does

@nvs119 nvs119 requested a review from gribnoysup February 11, 2025 20:36
@nvs119 nvs119 added the no release notes Fix or feature not for release notes label Feb 11, 2025
paddingRight: spacing[400],
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center',
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 kept it with justifyContent: 'space-between' because I want to keep the settings icon all the way to the right when it exists, so there's a slight difference between the design in the ticket (badge is closer to the Subtitle) vs how it'll actually be rendered (all the way to the right of the header). Is that okay?

Copy link
Collaborator

@gribnoysup gribnoysup Feb 12, 2025

Choose a reason for hiding this comment

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

You can just move the badge inside the subtitle and add some styling to position it to make it aligned with the designs, something like:

const badgeStyles = css({
  vertical-align: super;
  margin-left: spacing[100];
});

// ...

<Subtitle className={sidebarHeaderTextStyles}>
  {isCompassWeb ? 'Data Explorer' : 'Compass'}
  {isCompassWeb && (
    <Badge
      variant={BadgeVariant.Blue}
      className={badgeStyles}
      data-testid="sidebar-header-badge"
    >
      Preview
    </Badge>
  )}
</Subtitle>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thank you! Changed now

isCompassWeb,
}: {
onAction(actionName: Action): void;
isCompassWeb?: boolean;
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 a bit hesitant about adding a property like that to the component in the same spirit of not making it too easy to differenciate by environment like that as this goes against the architectural goals of the project. I would sugggest to either change the prop to be more aligned with the actual behavior that we want to allow to configure (like making a sidebarTitle prop with a default value that would allow compass-web to override it with its own component + some prop to hide settings button explicitly) or to use AtlasClusterConnectionsOnly context that Dan added recently to drive this behavior because the use-cases for it and this change that we want to do are exactly the same.

This is sort of splitting hair, so you tell me if changing this makes sense to you

Copy link
Contributor Author

Choose a reason for hiding this comment

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

discussed offline, leaving as is for now

@nvs119 nvs119 requested a review from gribnoysup February 12, 2025 15:23
Copy link
Collaborator

@gribnoysup gribnoysup left a comment

Choose a reason for hiding this comment

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

Looks good!

@nvs119 nvs119 merged commit ee413a9 into main Feb 12, 2025
36 checks passed
@nvs119 nvs119 deleted the COMPASS-8904 branch February 12, 2025 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat no release notes Fix or feature not for release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants