Skip to content
This repository has been archived by the owner on Nov 22, 2024. It is now read-only.

Commit

Permalink
remove duplications of "welcome to flipper" modal
Browse files Browse the repository at this point in the history
Summary: We already have the content on the home screen

Reviewed By: lblasa

Differential Revision: D52164482

fbshipit-source-id: 95b6f5225d45a97dd203309f78a4ebc8b0430c54
  • Loading branch information
antonk52 authored and facebook-github-bot committed Dec 14, 2023
1 parent 8d4623b commit aa2d0fa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 48 deletions.
11 changes: 1 addition & 10 deletions desktop/flipper-ui/src/sandy-chrome/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -625,12 +625,10 @@ function ExtrasMenu() {
[store],
);

const settings = useStore((state) => state.settingsState);
const isSettingModalOpen = useStore(
(state) => state.application.isSettingsModalOpen,
);
const {showWelcomeAtStartup} = settings;
const [welcomeVisible, setWelcomeVisible] = useState(showWelcomeAtStartup);
const [welcomeVisible, setWelcomeVisible] = useState(false);
const loggedIn = useValue(currentUser());

return (
Expand Down Expand Up @@ -721,13 +719,6 @@ function ExtrasMenu() {
<WelcomeScreen
visible={welcomeVisible}
onClose={() => setWelcomeVisible(false)}
showAtStartup={showWelcomeAtStartup}
onCheck={(value) =>
store.dispatch({
type: 'UPDATE_SETTINGS',
payload: {...settings, showWelcomeAtStartup: value},
})
}
/>
</>
);
Expand Down
44 changes: 6 additions & 38 deletions desktop/flipper-ui/src/sandy-chrome/WelcomeScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import React, {cloneElement} from 'react';
import {styled} from '../ui';
import {Modal, Button, Image, Checkbox, Space, Typography, Tooltip} from 'antd';
import {Modal, Button, Image, Space, Typography, Tooltip} from 'antd';
import {
RocketOutlined,
AppstoreAddOutlined,
Expand Down Expand Up @@ -65,58 +65,26 @@ function Row(props: {
);
}

const FooterContainer = styled(Layout.Horizontal)({
justifyContent: 'space-between',
alignItems: 'center',
});

function WelcomeFooter({
onClose,
checked,
onCheck,
}: {
onClose: () => void;
checked: boolean;
onCheck: (value: boolean) => void;
}) {
return (
<FooterContainer>
<Checkbox checked={checked} onChange={(e) => onCheck(e.target.checked)}>
<Text style={{fontSize: theme.fontSize.small}}>
Show this when app opens (or use ? icon on left)
</Text>
</Checkbox>
<Button type="primary" onClick={onClose}>
Close
</Button>
</FooterContainer>
);
}

const openExternal = (url: string) => () => getFlipperLib().openLink(url);

export default function WelcomeScreen({
visible,
onClose,
showAtStartup,
onCheck,
}: {
visible: boolean;
onClose: () => void;
showAtStartup: boolean;
onCheck: (value: boolean) => void;
}) {
return (
<Modal
centered
closable={false}
open={visible}
footer={
<WelcomeFooter
onClose={onClose}
checked={showAtStartup}
onCheck={onCheck}
/>
<div style={{display: 'flex', justifyContent: 'end'}}>
<Button type="primary" onClick={onClose}>
Close
</Button>
</div>
}
onCancel={onClose}>
<WelcomeScreenContent />
Expand Down

0 comments on commit aa2d0fa

Please sign in to comment.