|
|
@ -5,14 +5,13 @@ import { httpPost } from '../../../lib/query-http'; |
|
|
|
import { useStore } from '@nanostores/react'; |
|
|
|
import { useStore } from '@nanostores/react'; |
|
|
|
import { currentRoadmap } from '../../../stores/roadmap'; |
|
|
|
import { currentRoadmap } from '../../../stores/roadmap'; |
|
|
|
import { useToast } from '../../../hooks/use-toast'; |
|
|
|
import { useToast } from '../../../hooks/use-toast'; |
|
|
|
|
|
|
|
import { DateTime } from 'luxon'; |
|
|
|
|
|
|
|
|
|
|
|
type SubmitShowcaseWarningProps = { |
|
|
|
type SubmitShowcaseWarningProps = { |
|
|
|
onClose: () => void; |
|
|
|
onClose: () => void; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
export function SubmitShowcaseWarning( |
|
|
|
export function SubmitShowcaseWarning(props: SubmitShowcaseWarningProps) { |
|
|
|
props: SubmitShowcaseWarningProps, |
|
|
|
|
|
|
|
) { |
|
|
|
|
|
|
|
const { onClose } = props; |
|
|
|
const { onClose } = props; |
|
|
|
|
|
|
|
|
|
|
|
const toast = useToast(); |
|
|
|
const toast = useToast(); |
|
|
@ -40,8 +39,12 @@ export function SubmitShowcaseWarning( |
|
|
|
queryClient, |
|
|
|
queryClient, |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
const { showcaseStatus = 'idle', showcaseRejectedReason } = |
|
|
|
const { |
|
|
|
$currentRoadmap || {}; |
|
|
|
showcaseStatus = 'idle', |
|
|
|
|
|
|
|
showcaseRejectedReason, |
|
|
|
|
|
|
|
showcaseRejectedAt, |
|
|
|
|
|
|
|
updatedAt, |
|
|
|
|
|
|
|
} = $currentRoadmap || {}; |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<Modal onClose={onClose}> |
|
|
|
<Modal onClose={onClose}> |
|
|
@ -52,8 +55,7 @@ export function SubmitShowcaseWarning( |
|
|
|
: 'Featured Listing'} |
|
|
|
: 'Featured Listing'} |
|
|
|
</h2> |
|
|
|
</h2> |
|
|
|
<p className="mt-2 text-sm"> |
|
|
|
<p className="mt-2 text-sm"> |
|
|
|
{showcaseStatus === 'rejected_with_reason' && |
|
|
|
{showcaseStatus === 'rejected_with_reason' && showcaseRejectedReason} |
|
|
|
showcaseRejectedReason} |
|
|
|
|
|
|
|
{showcaseStatus === 'idle' && ( |
|
|
|
{showcaseStatus === 'idle' && ( |
|
|
|
<> |
|
|
|
<> |
|
|
|
Submitting your roadmap for a featured listing will make it |
|
|
|
Submitting your roadmap for a featured listing will make it |
|
|
@ -74,7 +76,26 @@ export function SubmitShowcaseWarning( |
|
|
|
<button |
|
|
|
<button |
|
|
|
className="w-full rounded-lg bg-gray-900 py-2 text-sm text-white hover:bg-gray-800 disabled:cursor-not-allowed disabled:opacity-60" |
|
|
|
className="w-full rounded-lg bg-gray-900 py-2 text-sm text-white hover:bg-gray-800 disabled:cursor-not-allowed disabled:opacity-60" |
|
|
|
disabled={submit.isPending} |
|
|
|
disabled={submit.isPending} |
|
|
|
onClick={() => submit.mutate()} |
|
|
|
onClick={() => { |
|
|
|
|
|
|
|
const updatedAtDate = |
|
|
|
|
|
|
|
updatedAt && DateTime.fromJSDate(new Date(updatedAt)); |
|
|
|
|
|
|
|
const showcaseRejectedAtDate = |
|
|
|
|
|
|
|
showcaseRejectedAt && |
|
|
|
|
|
|
|
DateTime.fromJSDate(new Date(showcaseRejectedAt)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ( |
|
|
|
|
|
|
|
showcaseRejectedAtDate && |
|
|
|
|
|
|
|
updatedAtDate && |
|
|
|
|
|
|
|
updatedAtDate < showcaseRejectedAtDate |
|
|
|
|
|
|
|
) { |
|
|
|
|
|
|
|
toast.error( |
|
|
|
|
|
|
|
'You need to make changes to your roadmap before resubmitting.', |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
submit.mutate(); |
|
|
|
|
|
|
|
}} |
|
|
|
> |
|
|
|
> |
|
|
|
{submit.isPending |
|
|
|
{submit.isPending |
|
|
|
? 'Submitting...' |
|
|
|
? 'Submitting...' |
|
|
|