Skip to content

feat: Adjustable grid density#2151

Merged
mattrunyon merged 8 commits intodeephaven:mainfrom
mattrunyon:iris-grid-density
Jul 22, 2024
Merged

feat: Adjustable grid density#2151
mattrunyon merged 8 commits intodeephaven:mainfrom
mattrunyon:iris-grid-density

Conversation

@mattrunyon
Copy link
Copy Markdown
Collaborator

@mattrunyon mattrunyon commented Jul 17, 2024

Fixes #885

This adds a user setting for grid density in the theme section which applies to all grids without an explicit density prop. A separate dh.ui PR will allow setting the density per table and is not influenced by the global density setting.

@dsmmcken
Copy link
Copy Markdown
Contributor

What about "Default table density"?

Implying ui.table() density overrides default density, similar to "Default formatting"

Comment thread packages/app-utils/src/components/ThemeBootstrap.tsx Outdated
Comment thread packages/redux/src/store.ts Outdated
};
webgl: boolean;
webglEditable: boolean;
gridDensity?: 'compact' | 'normal' | 'spacious';
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This should always be set. Also we may as well match the Spectrum density props, which use regular instead of normal (though not every component has a spacious option).

Suggested change
gridDensity?: 'compact' | 'normal' | 'spacious';
gridDensity: 'compact' | 'regular' | 'spacious';

Then define what the default value is in LocalWorkspaceStorage.
In the updateWorkspaceData action, we map the users CustomizableWorkspaceSettings on top of the default settings. That way the default values are always set in the WorkspaceSettings we get from redux, and there's no ambiguity on what the "default" value is.

Side note, we should probably allow this to be set via a prop as well (for a default value). Can be a separate ticket.

Copy link
Copy Markdown
Collaborator Author

@mattrunyon mattrunyon Jul 17, 2024

Choose a reason for hiding this comment

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

Ya I initially made it optional since it wouldn't be set in enterprise right away, but shouldn't matter until we add the settings menu in enterprise

Should the server prop be DHC or just DHE?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Would be nice to add to both but no urgency for DHC

Comment thread packages/iris-grid/src/IrisGridThemeProvider.tsx Outdated
Comment thread packages/iris-grid/src/IrisGridTheme.ts Outdated
Comment thread packages/code-studio/src/settings/ThemeSectionContent.tsx Outdated
const settings = useSelector<RootState, ReturnType<typeof getSettings>>(
getSettings
);
const dispatch = useDispatch();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

useAppDispatch

Copy link
Copy Markdown
Collaborator Author

@mattrunyon mattrunyon Jul 17, 2024

Choose a reason for hiding this comment

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

This doesn't seem to work with the thunk action I'm dispatching. Throws a TS error about the argument not being the right type

Copy link
Copy Markdown
Collaborator Author

@mattrunyon mattrunyon Jul 17, 2024

Choose a reason for hiding this comment

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

I think this might be because we aren't using configureStore with redux and are using the old, deprecated createStore. Or how we register thunks, but that action is created in our redux package so the root store should know about it

<>
<ThemePicker />
<Picker
label="Choose grid density"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe a question for @dsmmcken, but should this density apply to other Spectrum components such as ListView by default as well? https://react-spectrum.adobe.com/react-spectrum/ListView.html#density
Though some items (like Tabs) don't have a spacious option.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

One vote for no is users of dh.ui should already be able to specify density on those components.

In our UI, we would then need to test anywhere we use list or tabs (or others w/ density) looks ok w/ all density options

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That's a good point, but I would limit this ticket to just applying to grid. Maybe lists, not sure if much else has a density prop.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yup limit the scope of this ticket, but could be interesting to do later.

Comment thread packages/code-studio/src/settings/ThemeSectionContent.tsx Outdated
Comment thread packages/code-studio/src/settings/ThemeSectionContent.tsx
Comment thread packages/iris-grid/src/IrisGrid.tsx Outdated
@codecov
Copy link
Copy Markdown

codecov Bot commented Jul 17, 2024

Codecov Report

Attention: Patch coverage is 40.00000% with 30 lines in your changes missing coverage. Please review.

Project coverage is 46.67%. Comparing base (58ee88d) to head (6ba4057).
Report is 8 commits behind head on main.

Files Patch % Lines
...s/code-studio/src/settings/ThemeSectionContent.tsx 0.00% 15 Missing ⚠️
packages/iris-grid/src/IrisGridThemeProvider.tsx 16.66% 5 Missing ⚠️
packages/grid/src/GridMetricCalculator.ts 0.00% 4 Missing ⚠️
packages/iris-grid/src/IrisGrid.tsx 81.25% 3 Missing ⚠️
...ges/app-utils/src/storage/LocalWorkspaceStorage.ts 0.00% 1 Missing ⚠️
packages/code-studio/src/AppRoot.tsx 0.00% 1 Missing ⚠️
packages/iris-grid/src/IrisGridRenderer.ts 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2151      +/-   ##
==========================================
+ Coverage   46.62%   46.67%   +0.05%     
==========================================
  Files         685      692       +7     
  Lines       38493    38622     +129     
  Branches     9589     9628      +39     
==========================================
+ Hits        17948    18028      +80     
- Misses      20535    20583      +48     
- Partials       10       11       +1     
Flag Coverage Δ
unit 46.67% <40.00%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Copy Markdown
Member

@mofojed mofojed left a comment

Choose a reason for hiding this comment

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

Lookin good!

Comment thread packages/app-utils/src/storage/LocalWorkspaceStorage.ts
Comment thread packages/iris-grid/src/IrisGridTheme.ts Outdated
Comment thread packages/iris-grid/src/IrisGridTheme.ts
Comment thread packages/iris-grid/src/IrisGrid.tsx Outdated
@mofojed
Copy link
Copy Markdown
Member

mofojed commented Jul 18, 2024

We should have a follow up ticket to read the default density from the server.

@mattrunyon mattrunyon requested a review from mofojed July 18, 2024 21:03
mofojed
mofojed previously approved these changes Jul 19, 2024
Comment thread packages/iris-grid/src/IrisGrid.tsx Outdated
Comment thread packages/iris-grid/src/IrisGrid.tsx
@mattrunyon
Copy link
Copy Markdown
Collaborator Author

#2162 and DH-17459 for setting via server and adding the setting to DHE

@mattrunyon mattrunyon merged commit 6bb11f9 into deephaven:main Jul 22, 2024
@mattrunyon mattrunyon deleted the iris-grid-density branch July 22, 2024 18:07
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 22, 2024
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.

Option to increase information density

3 participants