import prisma from "app/lib/db"

export default async function PubsDropdown() {
	async function getPubs() {
		"use server"
		return prisma.pub.findMany()
	}
	const pubs = await getPubs()
	const pubsDropdown = pubs.map(e => {
		return <option value={e.id} key={e.title}>{e.title}</option>
	})
	return (<>
		<label htmlFor="pubdDropdown">Publication:</label>
		<select key="pubsDropdown" id="pubsDropdown">
			{pubsDropdown}
		</select>
	</>
	)

}
