import React from 'react'
import { useAsyncCallback, useOnline } from 'actionsack'
import Button from './Button'
import Toolbar from './Toolbar'
import ConfirmButton from './ConfirmButton'
import { useAuth } from './AuthContext'
import { COLORS } from '../lib/constants'
function DeleteButton(props) {
const [onClick, { loading }] = useAsyncCallback(props.onClick)
return (
{loading ? 'Deleting...' : 'Delete'}
)
}
function DuplicateButton(props) {
const [onClick, { loading }] = useAsyncCallback(props.onClick)
return (
)
}
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 (
{sameUser && }
)
}
export default SnippetToolbar