All files / Bandstand/src/components SetlistPdfButton.tsx

0% Statements 0/29
100% Branches 1/1
100% Functions 1/1
0% Lines 0/29

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39                                                                             
'use client'
 
import {useState} from 'react'
import PdfDialog from '@/components/PdfDialog'
 
export default function SetlistPdfButton({
  id,
  name,
  count,
}: {
  id: string
  name: string
  count: number
}) {
  const [open, setOpen] = useState(false)
  return (
    <>
      <button
        type="button"
        onClick={() => setOpen(true)}
        className="min-h-11 rounded-lg border border-line-2 px-4"
      >
        PDF of the set
      </button>
      {open && (
        <PdfDialog
          title={`${name} — ${count} charts in set order, each in its set key`}
          baseUrl={`/api/setlists/${id}/pdf`}
          shownKey={null}
          originalKey={null}
          hasCues
          sheet
          onClose={() => setOpen(false)}
        />
      )}
    </>
  )
}