diff --git a/desktop/app/src/sandy-chrome/LeftSidebar.tsx b/desktop/app/src/sandy-chrome/LeftSidebar.tsx index 41b463d45..326b3874a 100644 --- a/desktop/app/src/sandy-chrome/LeftSidebar.tsx +++ b/desktop/app/src/sandy-chrome/LeftSidebar.tsx @@ -16,7 +16,7 @@ import {InfoCircleOutlined} from '@ant-design/icons'; export const LeftSidebar: React.FC = ({children}) => ( - {children} + {children} ); diff --git a/desktop/app/src/sandy-chrome/SandyApp.tsx b/desktop/app/src/sandy-chrome/SandyApp.tsx index aeee664be..cc73469d2 100644 --- a/desktop/app/src/sandy-chrome/SandyApp.tsx +++ b/desktop/app/src/sandy-chrome/SandyApp.tsx @@ -15,7 +15,6 @@ import {Logger} from '../fb-interfaces/Logger'; import {LeftRail} from './LeftRail'; import {TemporarilyTitlebar} from './TemporarilyTitlebar'; -import SandyDesignSystem from './SandyDesignSystem'; import {registerStartupTime} from '../App'; import {useStore, useDispatch} from '../utils/useStore'; import {SandyContext} from './SandyContext'; @@ -23,6 +22,7 @@ import {ConsoleLogs} from '../chrome/ConsoleLogs'; import {setStaticView} from '../reducers/connections'; import {toggleLeftSidebarVisible} from '../reducers/application'; import {AppInspect} from './appinspect/AppInspect'; +import PluginContainer from '../PluginContainer'; export type ToplevelNavItem = 'appinspect' | 'flipperlogs' | undefined; export type ToplevelProps = { @@ -101,7 +101,7 @@ export function SandyApp({logger}: {logger: Logger}) { logger: logger, }) ) : ( - + )} @@ -56,7 +67,7 @@ export function AppInspect() { - + {selectedDevice ? ( ) : ( @@ -69,9 +80,214 @@ export function AppInspect() { } function PluginList() { + // const {selectedApp, selectedDevice} = useStore((state) => state.connections); + return ( Plugins + + {}} + defaultOpenKeys={['device']} + mode="inline"> + + + Header + + + }> + }> + Option 1 + + }> + Option 2 + + Option 3 + Option 4 + + } + title="Navigation Two"> + Option 5 + Option 6 + Option 7 + Option 8 + + + + Navigation Three + + }> + Option 9 + Option 10 + Option 11 + Option 12 + + + ); } + +function DevicePlugins(props: any) { + const dispatch = useDispatch(); + const {selectedDevice, selectedPlugin} = useStore( + (state) => state.connections, + ); + const devicePlugins = useStore((state) => state.plugins.devicePlugins); + if (selectedDevice?.devicePlugins.length === 0) { + return null; + } + return ( + Device}> + {selectedDevice!.devicePlugins + .map((pluginName) => devicePlugins.get(pluginName)!) + .sort(sortPluginsByName) + .map((plugin) => ( + { + dispatch( + selectPlugin({ + selectedPlugin: plugin.id, + selectedApp: null, + deepLinkPayload: null, + selectedDevice, + }), + ); + }} + plugin={plugin} + /> + ))} + + ); +} + +const Plugin: React.FC<{ + onClick: () => void; + isActive: boolean; + plugin: PluginDefinition; + app?: string | null | undefined; + helpRef?: any; + provided?: any; + onFavorite?: () => void; + starred?: boolean; // undefined means: not starrable +}> = function (props) { + const {isActive, plugin, onFavorite, starred, ...rest} = props; + const domRef = useRef(null); + + useEffect(() => { + const node = domRef.current; + if (isActive && node) { + const rect = node.getBoundingClientRect(); + if (rect.top < 0 || rect.bottom > document.documentElement.clientHeight) { + node.scrollIntoView(); + } + } + }, [isActive]); + + return ( + + + {getPluginTitle(plugin)} ({plugin.version}) + {plugin.details?.description ? ( + <> +
+
+ {plugin.details?.description} + + ) : ( + '' + )} + + } + mouseEnterDelay={1}> + + + + + {getPluginTitle(plugin)} + +
+ {/* {starred !== undefined && (!starred || isActive) && ( + + )} */} +
+ ); +}; + +const iconStyle = { + color: theme.white, + background: theme.primaryColor, + borderRadius: theme.borderRadius, + width: 24, + height: 24, +}; + +// TODO: move this largely to themes/base.less to make it the default? +// Dimensions are hardcoded as they correlate strongly +const PluginMenu = styled(Menu)({ + border: 'none', + '.ant-menu-inline .ant-menu-item, .ant-menu-inline .ant-menu-submenu-title ': { + width: '100%', // reset to remove weird bonus pixel from ANT + }, + '.ant-menu-submenu > .ant-menu-submenu-title, .ant-menu-sub.ant-menu-inline > .ant-menu-item': { + borderRadius: theme.borderRadius, + height: '32px', + lineHeight: '24px', + padding: `4px 32px 4px 8px !important`, + '&:hover': { + color: theme.textColorPrimary, + background: theme.backgroundTransparentHover, + }, + '&.ant-menu-item-selected::after': { + border: 'none', + }, + '&.ant-menu-item-selected': { + color: theme.white, + background: theme.primaryColor, + border: 'none', + }, + }, + '.ant-menu-submenu-inline > .ant-menu-submenu-title .ant-menu-submenu-arrow': { + right: 8, + }, + '.ant-badge-count': { + color: theme.textColorPrimary, + background: theme.backgroundTransparentHover, + fontWeight: 'bold', + padding: `0 10px`, + boxShadow: 'none', + }, + '.ant-menu-item .anticon': { + ...iconStyle, + lineHeight: '28px', // WUT? + }, +}); + +const PluginIconWrapper = styled.div({ + ...iconStyle, + display: 'inline-flex', + alignItems: 'center', + justifyContent: 'center', +}); diff --git a/desktop/app/src/sandy-chrome/appinspect/AppSelector.tsx b/desktop/app/src/sandy-chrome/appinspect/AppSelector.tsx index 4548ee2ff..4eae54db5 100644 --- a/desktop/app/src/sandy-chrome/appinspect/AppSelector.tsx +++ b/desktop/app/src/sandy-chrome/appinspect/AppSelector.tsx @@ -107,6 +107,7 @@ const AppInspectButton = styled(Button)({ }); const AppIcon = styled.div<{appname?: string}>(({appname}) => ({ + borderRadius: 4, width: 36, height: 36, background: appname diff --git a/desktop/app/src/sandy-chrome/appinspect/LaunchEmulator.tsx b/desktop/app/src/sandy-chrome/appinspect/LaunchEmulator.tsx index a7c0379eb..b82ee82c2 100644 --- a/desktop/app/src/sandy-chrome/appinspect/LaunchEmulator.tsx +++ b/desktop/app/src/sandy-chrome/appinspect/LaunchEmulator.tsx @@ -69,7 +69,7 @@ export function LaunchEmulatorDialog({ launchEmulator(name) .catch((e) => { console.error(e); - message.error('Failed to start emulator:' + e); + message.error('Failed to start emulator: ' + e); }) .finally(onClose); }}> @@ -84,7 +84,7 @@ export function LaunchEmulatorDialog({ launchSimulator(device.udid) .catch((e) => { console.error(e); - message.error('Failed to start simulator:' + e); + message.error('Failed to start simulator: ' + e); }) .finally(onClose); }}> diff --git a/desktop/app/src/sandy-chrome/theme.tsx b/desktop/app/src/sandy-chrome/theme.tsx index e256f673a..c808651d5 100644 --- a/desktop/app/src/sandy-chrome/theme.tsx +++ b/desktop/app/src/sandy-chrome/theme.tsx @@ -12,6 +12,7 @@ import {useStore} from '../utils/useStore'; // Exposes all the variables defined in themes/base.less: export const theme = { + white: 'white', // use as counter color for primary primaryColor: 'var(--flipper-primary-color)', successColor: 'var(--flipper-success-color)', errorColor: 'var(--flipper-error-color)', diff --git a/desktop/app/src/ui/components/Layout.tsx b/desktop/app/src/ui/components/Layout.tsx index e33569512..35fe4392c 100644 --- a/desktop/app/src/ui/components/Layout.tsx +++ b/desktop/app/src/ui/components/Layout.tsx @@ -204,12 +204,13 @@ Object.keys(Layout).forEach((key) => { const SandySplitContainer = styled.div<{ flex1: number; flex2: number; + center?: boolean; flexDirection: CSSProperties['flexDirection']; }>((props) => ({ display: 'flex', flex: 1, flexDirection: props.flexDirection, - alignItems: 'stretch', + alignItems: props.center ? 'center' : 'stretch', '> :first-child': { flexGrow: props.flex1, flexShrink: props.flex1, diff --git a/desktop/app/src/ui/components/colors.tsx b/desktop/app/src/ui/components/colors.tsx index b949355cc..c043b568e 100644 --- a/desktop/app/src/ui/components/colors.tsx +++ b/desktop/app/src/ui/components/colors.tsx @@ -7,6 +7,8 @@ * @format */ +import {theme} from '../../sandy-chrome/theme'; + // Last updated: Jan 30 2016 export const colors = { @@ -278,5 +280,5 @@ export const brandColors = { Facebook: '#0D7BED', Messenger: '#0088FA', Instagram: '#E61E68', - Flipper: '#8155cb', + Flipper: theme.primaryColor, }; diff --git a/desktop/static/icons.json b/desktop/static/icons.json index c953937ac..cbe1bab0b 100644 --- a/desktop/static/icons.json +++ b/desktop/static/icons.json @@ -7,13 +7,16 @@ 12 ], "app-react": [ - 12 + 12, + 16 ], "apps": [ - 12 + 12, + 16 ], "arrow-right": [ - 12 + 12, + 16 ], "bell-null-outline": [ 24 @@ -336,7 +339,8 @@ 16 ], "code": [ - 12 + 12, + 16 ], "undo-outline": [ 16 diff --git a/desktop/themes/light.less b/desktop/themes/light.less index ebcabb6ee..6f1107cbb 100644 --- a/desktop/themes/light.less +++ b/desktop/themes/light.less @@ -11,7 +11,7 @@ // Based on: https://www.figma.com/file/4e6BMdm2SuZ1L7FSuOPQVC/Flipper?node-id=620%3A84614 // Link Text & Icon -@primary-color: @purple-7; +@primary-color: #722ED1; // Success @success-color: @green-7; // Negative