Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dashboard tiles layout #1520

Merged
merged 23 commits into from
May 21, 2024
Merged
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
b32a807
feat: Implement tiles
ptbrowne May 16, 2024
d0717a2
fix: Show resize handles
ptbrowne May 17, 2024
43de2c4
feat: Dispatch change of layouts and save chart config with it
ptbrowne May 21, 2024
da8e5c7
refactor: Provide height in ChartObserver context
ptbrowne May 21, 2024
436dc59
feat: Change grid rows max h / min h
ptbrowne May 21, 2024
4eee9bd
feat: Change how aspect ratio is handled for columns
ptbrowne May 21, 2024
9ea3f1d
refactor: Change how aspect ratio is dealt with for columns chart
ptbrowne May 21, 2024
a34ba8f
refactor: Change how aspect ratio is dealt with for all charts
ptbrowne May 21, 2024
f888ca5
refactor: Make clearer the chart container hierarchy through useStyles
ptbrowne May 21, 2024
f156bec
fix: Correctly set provider initial value to undefined so that check …
ptbrowne May 21, 2024
7e53f1b
feat: Chart size observer observes only the part containing the plot …
ptbrowne May 21, 2024
a7e6e2a
feat: Way to set aspect ratio per chart
ptbrowne May 21, 2024
55f2f8b
feat: Performance of resizing in grid
ptbrowne May 21, 2024
d1253e8
chore: Lint
ptbrowne May 21, 2024
45bd129
feat: Initialize correctly tiles layout
ptbrowne May 21, 2024
37c28e5
fix: Correctly pass height
ptbrowne May 21, 2024
48a8bcc
refactor: Extract decoder function not to have io-ts code in the render
ptbrowne May 21, 2024
52b5190
refactor: Extract drag handle
ptbrowne May 21, 2024
510992c
fix: Drag handle accepts additional class name
ptbrowne May 21, 2024
e383ee5
feat: Can move charts only through the drag handle
ptbrowne May 21, 2024
2d11ccd
chore: Lint
ptbrowne May 21, 2024
93141d4
chore: Lint
ptbrowne May 21, 2024
4debb83
fix: Remove old test
ptbrowne May 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions app/charts/shared/use-width.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ export type Bounds = {
aspectRatio: number;
};

const INITIAL_WIDTH = 1;
const INITIAL_HEIGHT = 1;

const useStyles = makeStyles(() => ({
chartObserver: {
display: "flex",
Expand Down Expand Up @@ -59,10 +56,14 @@ export const Observer = ({ children }: { children: ReactNode }) => {
);
};

const ChartObserverContext = createContext({
width: INITIAL_WIDTH,
height: INITIAL_HEIGHT,
});
const ChartObserverContext = createContext(
undefined as
| undefined
| {
width: number;
height: number;
}
);
ptbrowne marked this conversation as resolved.
Show resolved Hide resolved

export const useWidth = () => {
const ctx = useContext(ChartObserverContext);
Expand Down