Skip to content

Commit 01e7d78

Browse files
committed
🔨 Switch Header to use useOvermind
1 parent 729d375 commit 01e7d78

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

‎packages/app/src/app/pages/Sandbox/Editor/Header/Header.tsx‎

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { dashboardUrl } from '@codesandbox/common/lib/utils/url-generator';
2-
import { useOvermind } from 'app/overmind';
3-
import React from 'react';
2+
import React, { ComponentProps, FunctionComponent } from 'react';
43

4+
import { useOvermind } from 'app/overmind';
55
import { UserMenu } from 'app/pages/common/UserMenu';
66

77
import {
@@ -29,18 +29,18 @@ import {
2929
import { Logo } from './Logo';
3030
import { MenuBar } from './MenuBar';
3131
import { SandboxName } from './SandboxName';
32-
import { IHeaderProps } from './types';
3332

34-
export const Header: React.FC<IHeaderProps> = ({ zenMode }) => {
33+
type Props = Pick<ComponentProps<typeof Container>, 'zenMode'>;
34+
export const Header: FunctionComponent<Props> = ({ zenMode }) => {
3535
const {
3636
state: {
37+
hasLogIn,
38+
isLoggedIn,
39+
isPatron,
3740
preferences: {
3841
settings: { experimentVSCode: vscode },
3942
},
40-
isPatron,
4143
updateStatus,
42-
hasLogIn,
43-
isLoggedIn,
4444
user,
4545
},
4646
} = useOvermind();
@@ -65,13 +65,21 @@ export const Header: React.FC<IHeaderProps> = ({ zenMode }) => {
6565

6666
<Right>
6767
{updateStatus === 'available' && <RefreshButton />}
68-
{!isLoggedIn || (!isPatron && <PatronButton />)}
68+
69+
{!(isLoggedIn && isPatron) && <PatronButton />}
70+
6971
{!isLoggedIn && <PreferencesButton />}
72+
7073
<NewSandboxButton />
74+
7175
{isLoggedIn && <LikeButton />}
76+
7277
{user && user.curatorAt && <PickButton />}
78+
7379
<ShareButton />
80+
7481
<ForkButton />
82+
7583
<AccountContainer>
7684
{isLoggedIn ? (
7785
<UserMenuContainer>

‎packages/app/src/app/pages/Sandbox/Editor/Header/types.ts‎

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)