Compare commits
No commits in common. "ed8e71694f4bb99d6da52e7d651bbf5c9bc8563c" and "d1c69c9c157cfd90a104708d66175df086f64e04" have entirely different histories.
ed8e71694f
...
d1c69c9c15
|
@ -1,3 +0,0 @@
|
||||||
export function letterCase(str: String) {
|
|
||||||
return str.charAt(0).toUpperCase() + str.slice(1)
|
|
||||||
}
|
|
|
@ -1,5 +1,4 @@
|
||||||
// "use server"
|
import prisma from "../../lib/db.mjs"
|
||||||
import prisma from "app/lib/db"
|
|
||||||
|
|
||||||
async function getStory(id: string) {
|
async function getStory(id: string) {
|
||||||
const story = await prisma.story.findFirst({ where: { id: Number(id) } })
|
const story = await prisma.story.findFirst({ where: { id: Number(id) } })
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
import StoryForm from "app/ui/forms/story";
|
|
||||||
|
|
||||||
export default function Page() {
|
|
||||||
return <StoryForm />
|
|
||||||
}
|
|
|
@ -1,21 +0,0 @@
|
||||||
import prisma from "app/lib/db"
|
|
||||||
import React from "react"
|
|
||||||
import { letterCase } from "app/lib/functions"
|
|
||||||
export default async function GenreCheckboxes() {
|
|
||||||
async function getGenres() {
|
|
||||||
"use server"
|
|
||||||
const genres = await prisma.genre.findMany()
|
|
||||||
return genres
|
|
||||||
}
|
|
||||||
const genres = await getGenres()
|
|
||||||
const genreCheckboxes = genres.map(e => {
|
|
||||||
const label = letterCase(e.name)
|
|
||||||
return (<React.Fragment key={`fragment${e.name}`}>
|
|
||||||
<input type="checkbox" id={e.name} key={`genreCheckboxInput${e.id}`} />
|
|
||||||
<label htmlFor={e.name} key={`genreCheckboxLabel${e.id}`}>{label}</label>
|
|
||||||
</React.Fragment>
|
|
||||||
)
|
|
||||||
})
|
|
||||||
return <>{genreCheckboxes}</>
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,10 +0,0 @@
|
||||||
import GenreCheckboxes from "./genreCheckboxes"
|
|
||||||
export default async function StoryForm() {
|
|
||||||
return <form>
|
|
||||||
<label htmlFor="title">Title:</label>
|
|
||||||
<input type="text" id="title" />
|
|
||||||
<label htmlFor="word-count">Word Count:</label>
|
|
||||||
<input type="text" id="word-count" />
|
|
||||||
<GenreCheckboxes />
|
|
||||||
</form>
|
|
||||||
}
|
|
|
@ -1,6 +1,5 @@
|
||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"baseUrl": "src/",
|
|
||||||
"lib": [
|
"lib": [
|
||||||
"dom",
|
"dom",
|
||||||
"dom.iterable",
|
"dom.iterable",
|
||||||
|
@ -27,8 +26,7 @@
|
||||||
"next-env.d.ts",
|
"next-env.d.ts",
|
||||||
".next/types/**/*.ts",
|
".next/types/**/*.ts",
|
||||||
"**/*.ts",
|
"**/*.ts",
|
||||||
"**/*.tsx",
|
"**/*.tsx"
|
||||||
"src/app/lib/db.ts"
|
|
||||||
],
|
],
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"node_modules"
|
"node_modules"
|
||||||
|
|
Loading…
Reference in New Issue