Skip to content

Commit

Permalink
fix dashboard regression
Browse files Browse the repository at this point in the history
  • Loading branch information
Seroxdesign authored and alalonde committed Oct 23, 2023
1 parent 0d14a6e commit 50ba997
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions packages/web/pages/dashboard.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { Maybe } from '@metafam/utils';
import { ConnectedPage } from 'components/ConnectedPage';
import { PageContainer } from 'components/Container';
import {
ALL_BOXES,
Expand All @@ -11,19 +9,13 @@ import {
Player,
useUpdatePlayerDashboardLayoutMutation as useUpdateLayout,
} from 'graphql/autogen/types';
import { useUser } from 'lib/hooks';
import React, { useCallback, useMemo } from 'react';
import { DisplayOutput, LayoutData } from 'utils/boxTypes';

const ConnectedDashboardPage: React.FC<Props> = () => (
<ConnectedPage page={DashboardPage} pageLabel="Your Dashboard" />
);

export default ConnectedDashboardPage;

type Props = { player: Maybe<Player> };

export const DashboardPage: React.FC<Props> = ({ player }) => {
const DashboardPage: React.FC = () => {
const [{ fetching: persisting }, saveLayoutData] = useUpdateLayout();
const { user: player } = useUser();
const savedLayoutData = useMemo<LayoutData>(
() =>
player?.dashboardLayout
Expand All @@ -46,14 +38,12 @@ export const DashboardPage: React.FC<Props> = ({ player }) => {
[saveLayoutData, player],
);

if (!player) return null;

return (
<PageContainer>
<EditableGridLayout
{...{
player: player as Player,
defaultLayoutData: DEFAULT_DASHBOARD_LAYOUT_DATA,
defaultLayoutData: DEFAULT_DASHBOARD_LAYOUT_DATA as LayoutData,
savedLayoutData,
showEditButton: true,
persistLayoutData,
Expand All @@ -65,3 +55,5 @@ export const DashboardPage: React.FC<Props> = ({ player }) => {
</PageContainer>
);
};

export default DashboardPage;

0 comments on commit 50ba997

Please sign in to comment.