import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import { VotePanel } from '../components/VotePanel'

const el = document.getElementById('vote-points-app')
if (el) {
  const dEl = document.getElementById('vote-points-data')
  const sites = dEl ? JSON.parse(dEl.textContent || '[]') : []
  createRoot(el).render(
    <StrictMode>
      <VotePanel voteUrl={el.dataset.url || ''} csrfToken={el.dataset.csrf || ''} sites={sites} />
    </StrictMode>,
  )
}
