diff --git a/src/app/ideas/[id]/IdeaAnalysisReport.tsx b/src/app/ideas/[id]/IdeaAnalysisReport.tsx index b38fe10..cec6df2 100644 --- a/src/app/ideas/[id]/IdeaAnalysisReport.tsx +++ b/src/app/ideas/[id]/IdeaAnalysisReport.tsx @@ -1,6 +1,5 @@ 'use client' -import Link from 'next/link' import { useRouter } from 'next/navigation' import { usePlausible } from 'next-plausible' import React, { useEffect, useState } from 'react' @@ -9,6 +8,7 @@ import FeedbackForm from '@/components/FeedbackForm' import HorizontalLine from '@/components/HorizontalLine' import MessageBox from '@/components/MessageBox' import { Goals } from '@/lib/goals' +import DownloadPDFButton from './components/DownloadPDFButton' import { NavBar } from './components/NavBar' import SectionActionableNextSteps from './components/SectionActionableNextSteps' import SectionCompetitors from './components/SectionCompetitors' @@ -242,8 +242,8 @@ export const IdeaAnalysisReport = ({ data }: Props) => { {readyForReport ? ( - plausible(Goals.DownloadPDF, { props: { @@ -251,11 +251,7 @@ export const IdeaAnalysisReport = ({ data }: Props) => { }, }) } - target="_blank" - className="rounded bg-blue-600 px-4 py-2 font-semibold text-white hover:bg-blue-700" - > - PDF - + /> ) : ( Loading... @@ -350,8 +346,8 @@ export const IdeaAnalysisReport = ({ data }: Props) => {
{readyForReport ? ( - plausible(Goals.DownloadPDF, { props: { @@ -359,11 +355,7 @@ export const IdeaAnalysisReport = ({ data }: Props) => { }, }) } - target="_blank" - className="rounded bg-blue-600 px-4 py-2 font-semibold text-white hover:bg-blue-700" - > - Download - + /> ) : ( Loading... diff --git a/src/app/ideas/[id]/components/DownloadPDFButton.tsx b/src/app/ideas/[id]/components/DownloadPDFButton.tsx new file mode 100644 index 0000000..d4ac48e --- /dev/null +++ b/src/app/ideas/[id]/components/DownloadPDFButton.tsx @@ -0,0 +1,100 @@ +'use client' +import React, { useState } from 'react' + +interface DownloadPDFButtonProps { + ideaId: string + onClick?: () => void +} + +type DownloadError = string | null + +const DownloadPDFButton: React.FC+ {error} +
+ )} +