Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function SnippetToolbar(props) {
const user = useAuth()
const online = useOnline()
if (!online) {
return null
}
if (!user) {
return null
}
if (!props.snippet) {
return null
}
const sameUser = user.uid === props.snippet.userId
return (
function TweetButton(props) {
const api = useAPI()
const online = useOnlineListener()
const [onClick, { loading }] = useAsyncCallback(props.onClick)
if (!api || !api.tweet) {
return null
}
if (!online) {
return null
}
return (
function ExportMenu({
backgroundImage,
onChange,
exportSize,
isVisible,
toggleVisibility,
exportImage: exp
}) {
const tooLarge = React.useMemo(() => !verifyPayloadSize(backgroundImage), [backgroundImage])
const online = useOnline()
const isSafari = useSafari()
const [exportImage, { loading }] = useAsyncCallback(exp)
useKeyboardListener('⌘-⇧-e', () => exportImage())
const disablePNG = isSafari && (tooLarge || !online)
const input = React.useRef()
const handleExportSizeChange = selectedSize => () => onChange('exportSize', selectedSize)
const handleExport = format => () =>
exportImage(format, {
filename: input.current.value
})