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).
57 lines
1.4 KiB
TypeScript
57 lines
1.4 KiB
TypeScript
import React from 'react'
|
|
import { Trans, useTranslation } from 'next-i18next'
|
|
import Alert from '~components/common/Alert'
|
|
|
|
interface Props {
|
|
creator: boolean
|
|
name: string
|
|
open: boolean
|
|
remixCallback: () => void
|
|
onOpenChange: (open: boolean) => void
|
|
}
|
|
|
|
const RemixTeamAlert = ({
|
|
creator,
|
|
name,
|
|
open,
|
|
remixCallback,
|
|
onOpenChange,
|
|
}: Props) => {
|
|
const { t } = useTranslation('common')
|
|
|
|
function remixParty() {
|
|
remixCallback()
|
|
}
|
|
|
|
function close() {
|
|
onOpenChange(false)
|
|
}
|
|
|
|
return (
|
|
<Alert
|
|
open={open}
|
|
primaryAction={remixParty}
|
|
primaryActionText={t('modals.remix_team.buttons.confirm')}
|
|
cancelAction={close}
|
|
cancelActionText={t('modals.remix_team.buttons.cancel')}
|
|
message={
|
|
creator ? (
|
|
<Trans i18nKey="modals.remix_team.description.creator">
|
|
Remixing a team makes a copy of it in your account so you can make
|
|
your own changes.\n\nYou're already the creator of{' '}
|
|
<strong>{{ name: name }}</strong>, are you sure you want to remix
|
|
it?
|
|
</Trans>
|
|
) : (
|
|
<Trans i18nKey="modals.remix_team.description.viewer">
|
|
Remixing a team makes a copy of it in your account so you can make
|
|
your own changes.\n\nWould you like to remix{' '}
|
|
<strong>{{ name: name }}</strong>?
|
|
</Trans>
|
|
)
|
|
}
|
|
/>
|
|
)
|
|
}
|
|
|
|
export default RemixTeamAlert
|