Files
flipper/desktop/plugins/public/hermesdebuggerrn/Banner.tsx
Michel Weststrate d48f22b8dc Factor out GK fetch logic
Summary:
Removed loadGKs and loadDistilleryGKs from the `flipper` API, as it leaked implementation details of GK that didn't work well with decapitation later in this diff, and refactored it to using `getFlipperLib().GK`.

After that discovered that those APIs are actuallly only used by nt-shared's performGKcheck, which was already removed from all usages in D27736036, so just removed the code altogether. But left loading distillery GKs in place, since that is good infra structure to provide anyway(?), although we don't have active use cases atm

Reviewed By: jknoxville

Differential Revision: D32529600

fbshipit-source-id: a03fb14ada21018d329eea78a59f1b20610b2fd3
2021-12-08 04:30:54 -08:00

74 lines
1.6 KiB
TypeScript

/**
* Copyright (c) Facebook, Inc. and its 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 from 'react';
import {styled, colors, FlexRow, Text} from 'flipper';
import {Typography} from 'antd';
import {getFlipperLib} from 'flipper-plugin';
const BannerContainer = styled(FlexRow)({
height: '30px',
width: '100%',
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#2bb673', // Hermes green.
});
const BannerText = styled(Text)({
color: colors.white,
fontSize: 14,
lineHeight: '20px',
});
const BannerLink = styled(CustomLink)({
color: colors.white,
textDecoration: 'underline',
'&:hover': {
cursor: 'pointer',
color: '#303846',
},
});
function CustomLink(props: {
href: string;
className?: string;
children?: React.ReactNode;
style?: React.CSSProperties;
}) {
return (
<Typography.Link
className={props.className}
href={props.href}
style={props.style}>
{props.children || props.href}
</Typography.Link>
);
}
export const isBannerEnabled: () => boolean = function () {
return getFlipperLib().GK('flipper_plugin_hermes_debugger_survey');
};
export default function Banner() {
if (!getFlipperLib().GK('flipper_plugin_hermes_debugger_survey')) {
return null;
}
return (
<BannerContainer>
<BannerText>
Help us improve your debugging experience with this{' '}
<BannerLink href="https://fburl.com/hermessurvey">
single page survey
</BannerLink>
!
</BannerText>
</BannerContainer>
);
}