hensei-web/components/toasts/RemixedToast/index.tsx
Justin Edmund a77be2b068 Fix remix toasts and alerts from both locations
The remix toast and alert was barely hooked up and not showing up when invoked from PartyHeader.

It now shows up whether you remix your own team (from PartyDropdown) or if you remix another person's team (from PartyHeader).
2023-06-21 03:38:48 -07:00

49 lines
1 KiB
TypeScript

import React, { useEffect } from 'react'
import Toast from '~components/common/Toast'
import { Trans, useTranslation } from 'next-i18next'
interface Props {
partyName: string
open: boolean
onActionClick?: () => void
onOpenChange: (open: boolean) => void
onCloseClick: () => void
}
const RemixedToast = ({
partyName,
open,
onOpenChange,
onCloseClick,
}: Props) => {
const { t } = useTranslation('common')
useEffect(() => {
console.log(partyName)
}, [])
// Methods: Event handlers
function handleOpenChange() {
onOpenChange(open)
}
function handleCloseClick() {
onCloseClick()
}
return (
<Toast
altText={t('toasts.remixed', { title: partyName })}
open={open}
duration={2400}
type="foreground"
content={
<Trans i18nKey="toasts.remixed">
You remixed <strong>{{ title: partyName }}</strong>
</Trans>
}
onOpenChange={handleOpenChange}
onCloseClick={handleCloseClick}
/>
)
}
export default RemixedToast