add forms+
This commit is contained in:
parent
877fc08bd6
commit
34a18cae54
BIN
prisma/dev.db
BIN
prisma/dev.db
Binary file not shown.
|
@ -0,0 +1,5 @@
|
||||||
|
import PubForm from "app/ui/forms/pub";
|
||||||
|
|
||||||
|
export default function Page() {
|
||||||
|
return <PubForm />
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
import SubmissionForm from "app/ui/forms/sub";
|
||||||
|
|
||||||
|
export default function Page() {
|
||||||
|
return <SubmissionForm />
|
||||||
|
}
|
|
@ -4,8 +4,7 @@ import { letterCase } from "app/lib/functions"
|
||||||
export default async function GenreCheckboxes() {
|
export default async function GenreCheckboxes() {
|
||||||
async function getGenres() {
|
async function getGenres() {
|
||||||
"use server"
|
"use server"
|
||||||
const genres = await prisma.genre.findMany()
|
return prisma.genre.findMany()
|
||||||
return genres
|
|
||||||
}
|
}
|
||||||
const genres = await getGenres()
|
const genres = await getGenres()
|
||||||
const genreCheckboxes = genres.map(e => {
|
const genreCheckboxes = genres.map(e => {
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
export default async function PubForm() {
|
||||||
|
return <form>
|
||||||
|
<label htmlFor="title">Title:</label>
|
||||||
|
<input type="text" id="title" />
|
||||||
|
<label htmlFor="link">Link:</label>
|
||||||
|
<input type="text" id="link" />
|
||||||
|
<label htmlFor="number" id="query-after" >Query after (days):</label>
|
||||||
|
<input type="number" step="30" />
|
||||||
|
<input type="submit" value="Submit" />
|
||||||
|
</form>
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
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>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
import prisma from "app/lib/db"
|
||||||
|
|
||||||
|
export default async function ResponseDropdown() {
|
||||||
|
async function getResponses() {
|
||||||
|
"use server"
|
||||||
|
return prisma.response.findMany()
|
||||||
|
}
|
||||||
|
const responses = await getResponses()
|
||||||
|
const responsesDropdown = responses.map(e => {
|
||||||
|
return <option value={e.id} key={e.response}>{e.response}</option>
|
||||||
|
})
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<label htmlFor="responsesDropdown">
|
||||||
|
Status:
|
||||||
|
</label>
|
||||||
|
<select key="responsesDropdown" id="responsesDropdown">
|
||||||
|
{responsesDropdown}
|
||||||
|
</select>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
|
@ -4,7 +4,7 @@ export default async function StoryForm() {
|
||||||
<label htmlFor="title">Title:</label>
|
<label htmlFor="title">Title:</label>
|
||||||
<input type="text" id="title" />
|
<input type="text" id="title" />
|
||||||
<label htmlFor="word-count">Word Count:</label>
|
<label htmlFor="word-count">Word Count:</label>
|
||||||
<input type="text" id="word-count" />
|
<input type="number" id="word-count" step="500" />
|
||||||
<GenreCheckboxes />
|
<GenreCheckboxes />
|
||||||
<input type="submit" value="Submit" />
|
<input type="submit" value="Submit" />
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
import prisma from "app/lib/db"
|
||||||
|
|
||||||
|
export default async function StoryDropdown() {
|
||||||
|
async function getStories() {
|
||||||
|
"use server"
|
||||||
|
return prisma.story.findMany()
|
||||||
|
}
|
||||||
|
const stories = await getStories()
|
||||||
|
const storiesDrowpdown = stories.map(e => {
|
||||||
|
return <option value={e.id} key={`${e.title}`}>{e.title}</option>
|
||||||
|
})
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<label htmlFor="storyDropdown">Story:</label>
|
||||||
|
<select key="storyDropdown" id="storyDropdown">
|
||||||
|
{storiesDrowpdown}
|
||||||
|
</select>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
import PubsDropdown from "./pubsDropdown";
|
||||||
|
import ResponseDropdown from "./responseDropdown";
|
||||||
|
import StoryDropdown from "./storyDropdown";
|
||||||
|
|
||||||
|
export default async function SubmissionForm() {
|
||||||
|
return <form>
|
||||||
|
<StoryDropdown />
|
||||||
|
<PubsDropdown />
|
||||||
|
<label htmlFor="submitted">Submitted:</label>
|
||||||
|
<input type="date" id="submitted" name="submitted" />
|
||||||
|
<label htmlFor="responded">Responded:</label>
|
||||||
|
<input type="date" id="responded" name="responded" />
|
||||||
|
<ResponseDropdown />
|
||||||
|
</form>
|
||||||
|
}
|
Loading…
Reference in New Issue