import React from 'react'
import { useAsyncCallback, useOnline } from '@dawnlabs/tacklebox'
import Button from './Button'
import { useAuth } from './AuthContext'
import Toolbar from './Toolbar'
function ConfirmButton(props) {
const [confirmed, setConfirmed] = React.useState(false)
return (
)
}
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