import { Accordion, InputGroup, Modal } from 'react-bootstrap' import React, { useState, useCallback, useContext, useRef, useEffect } from 'react' import * as Yup from 'yup' import { Form, Input, SubmitButton } from './form' import ArrowRight from '../svgs/arrow-right-s-fill.svg' import ArrowDown from '../svgs/arrow-down-s-fill.svg' export const ItemActContext = React.createContext({ item: null, setItem: () => {} }) export function ItemActProvider ({ children }) { const [item, setItem] = useState(null) const contextValue = { item, setItem: useCallback(i => setItem(i), []) } return ( {children} ) } export function useItemAct () { const { item, setItem } = useContext(ItemActContext) return { item, setItem } } export const ActSchema = Yup.object({ amount: Yup.number().typeError('must be a number').required('required') .positive('must be positive').integer('must be whole') }) export function ItemActModal () { const { item, setItem } = useItemAct() const [open, setOpen] = useState(false) const inputRef = useRef(null) useEffect(() => { inputRef.current?.focus() }, [item]) return ( { setItem(null) setOpen(false) }} >
{ await item.act({ variables: { id: item.itemId, act: submit, sats: Number(amount) } }) await item.strike() setOpen(false) setItem(null) }} > sats} />
boost tip
} eventKey='0' style={{ cursor: 'pointer', display: 'flex', justifyContent: 'center', alignItems: 'center' }} onClick={() => setOpen(!open)} > {open ? : } I'm confused Tips go directly to the poster or commenter. Boosts boost the rank of the post or comment for a limited time, and the sats go to the site. ) }