/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/
import React, {cloneElement} from 'react';
import {styled} from '../ui';
import {Modal, Button, Image, Checkbox, Space, Typography, Tooltip} from 'antd';
import {
RocketOutlined,
AppstoreAddOutlined,
CodeOutlined,
BugOutlined,
HistoryOutlined,
} from '@ant-design/icons';
import {Layout, NUX, theme, Tracked, TrackingScope} from 'flipper-plugin';
const {Text, Title} = Typography;
import constants from '../fb-stubs/constants';
import config from '../fb-stubs/config';
import isProduction from '../utils/isProduction';
import {getAppVersion} from '../utils/info';
import {getFlipperLib} from 'flipper-plugin';
import {ReleaseChannel} from 'flipper-common';
import {showChangelog} from '../chrome/ChangelogSheet';
const RowContainer = styled(Layout.Horizontal)({
alignItems: 'flex-start',
padding: `${theme.space.small}px`,
cursor: 'pointer',
'&:hover, &:focus, &:active': {
backgroundColor: theme.backgroundTransparentHover,
borderRadius: theme.borderRadius,
textDecoration: 'none',
},
});
function Row(props: {
icon: React.ReactElement;
title: string;
subtitle: string;
onClick?: () => void;
}) {
return (
{cloneElement(props.icon, {
style: {fontSize: 36, color: theme.primaryColor},
})}
{props.title}
{props.subtitle}
);
}
const FooterContainer = styled(Layout.Horizontal)({
justifyContent: 'space-between',
alignItems: 'center',
});
function WelcomeFooter({
onClose,
checked,
onCheck,
}: {
onClose: () => void;
checked: boolean;
onCheck: (value: boolean) => void;
}) {
return (
onCheck(e.target.checked)}>
Show this when app opens (or use ? icon on left)
);
}
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 (
}
onCancel={onClose}>
);
}
export function WelcomeScreenStaticView() {
return (
);
}
function WelcomeScreenContent() {
const isInsidersChannel =
config.getReleaseChannel() === ReleaseChannel.INSIDERS;
return (
Welcome to Flipper
Using release channel{' '}
{config.getReleaseChannel()}
{isProduction() ? `Version ${getAppVersion()}` : 'Development Mode'}
}
title="Changelog"
onClick={() => {
showChangelog(false);
}}
/>
}
title="Using Flipper"
subtitle="Learn how Flipper can help you debug your App"
onClick={openExternal('https://fbflipper.com/docs/features')}
/>
}
title="Create Your Own Plugin"
subtitle="Get started with these pointers"
onClick={openExternal('https://fbflipper.com/docs/tutorial/intro')}
/>
}
title="Add Flipper Support to Your App"
subtitle="Get started with these pointers"
onClick={openExternal('https://fbflipper.com/docs/getting-started')}
/>
}
title="Contributing and Feedback"
subtitle="Report issues and help us improve Flipper"
onClick={openExternal(constants.FEEDBACK_GROUP_LINK)}
/>
);
}