Remove non-Sandy UI

Summary:
This removes the Non-Sandy UI from the Flipper codebase. It is a pretty rough scan for unused components, over time when converting more advanced components to Ant design probably even more code can be removed.

Partially used `npx ts-purge` to reveal never imported source files.

Changelog: It is no longer possible to opt out of the new Sandy UI

Reviewed By: jknoxville

Differential Revision: D25825282

fbshipit-source-id: 9041dbc7e03bce0760c9a0a34f1877851b5f06cf
This commit is contained in:
Michel Weststrate
2021-01-25 04:45:28 -08:00
committed by Facebook GitHub Bot
parent ba74b074c2
commit 12e59afdc6
44 changed files with 343 additions and 3386 deletions

View File

@@ -8,53 +8,14 @@
*/
import React, {useCallback, useEffect, useState} from 'react';
import {Button, ButtonGroup, colors} from '../ui';
import MetroDevice, {MetroReportableEvent} from '../devices/MetroDevice';
import styled from '@emotion/styled';
import {useStore} from '../utils/useStore';
import {Button as AntButton} from 'antd';
import {MenuOutlined, ReloadOutlined} from '@ant-design/icons';
type LogEntry = {};
export type PersistedState = {
logs: LogEntry[];
};
function ProgressBar({
progress,
width,
color,
}: {
progress: number;
width: number;
color: string;
}) {
return (
<ProgressBarContainer width={width} color={color}>
<ProgressBarBar progress={progress} color={color} />
</ProgressBarContainer>
);
}
const ProgressBarContainer = styled.div<{width: number; color: string}>(
({width, color}) => ({
border: `1px solid ${color}`,
borderRadius: 4,
height: 6,
width: width,
}),
);
const ProgressBarBar = styled.div<{progress: number; color: string}>(
({progress, color}) => ({
background: color,
width: `${Math.min(100, Math.round(progress * 100))}%`,
height: 4,
}),
);
export default function MetroButton({useSandy}: {useSandy?: boolean}) {
export default function MetroButton() {
const device = useStore((state) =>
state.connections.devices.find(
(device) => device.os === 'Metro' && !device.isArchived,
@@ -68,7 +29,7 @@ export default function MetroButton({useSandy}: {useSandy?: boolean}) {
[device],
);
const [progress, setProgress] = useState(1);
const [hasBuildError, setHasBuildError] = useState(false);
const [_hasBuildError, setHasBuildError] = useState(false);
useEffect(() => {
if (!device) {
@@ -98,7 +59,7 @@ export default function MetroButton({useSandy}: {useSandy?: boolean}) {
return null;
}
return useSandy ? (
return (
<>
<AntButton
icon={<ReloadOutlined />}
@@ -118,31 +79,5 @@ export default function MetroButton({useSandy}: {useSandy?: boolean}) {
}}
/>
</>
) : (
<ButtonGroup>
<Button
title="Reload React Native App"
icon="arrows-circle"
compact
onClick={() => {
sendCommand('reload');
}}>
{progress < 1 ? (
<ProgressBar
progress={100 * progress}
color={hasBuildError ? colors.red : colors.cyan}
width={20}
/>
) : null}
</Button>
<Button
title="Open the React Native Dev Menu on the device"
icon="navicon"
compact
onClick={() => {
sendCommand('devMenu');
}}
/>
</ButtonGroup>
);
}