feat: show mii images from database
This commit is contained in:
parent
68eed4e5fd
commit
84a732c34d
4 changed files with 16 additions and 7 deletions
|
|
@ -0,0 +1,9 @@
|
|||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `pictures` on the `miis` table. All the data in the column will be lost.
|
||||
|
||||
*/
|
||||
-- AlterTable
|
||||
ALTER TABLE "miis" DROP COLUMN "pictures",
|
||||
ADD COLUMN "images" TEXT[];
|
||||
|
|
@ -61,11 +61,11 @@ model Session {
|
|||
}
|
||||
|
||||
model Mii {
|
||||
id Int @id @default(autoincrement())
|
||||
userId Int
|
||||
name String @db.VarChar(64)
|
||||
pictures String[]
|
||||
tags String[]
|
||||
id Int @id @default(autoincrement())
|
||||
userId Int
|
||||
name String @db.VarChar(64)
|
||||
images String[]
|
||||
tags String[]
|
||||
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ export default async function MiiList({ searchParams, userId, where }: Props) {
|
|||
key={mii.id}
|
||||
className="flex flex-col bg-zinc-50 rounded-3xl border-2 border-zinc-300 shadow-lg p-3 transition hover:scale-105 hover:bg-cyan-100 hover:border-cyan-600"
|
||||
>
|
||||
<Carousel images={["https://placehold.co/600x400", "https://placehold.co/600x400", "https://placehold.co/600x400"]} />
|
||||
<Carousel images={mii.images.length > 0 ? mii.images : ["/missing.webp"]} />
|
||||
|
||||
<div className="p-4 flex flex-col gap-1 h-full">
|
||||
<Link href={`/mii/${mii.id}`} className="font-bold text-2xl overflow-hidden text-ellipsis line-clamp-2" title={mii.name}>
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ export default async function MiiPage({ params }: Props) {
|
|||
|
||||
return (
|
||||
<div className="flex gap-2 max-sm:flex-col">
|
||||
<Carousel images={["https://placehold.co/600x400", "https://placehold.co/600x400", "https://placehold.co/600x400"]} className="shadow-lg" />
|
||||
<Carousel images={mii?.images && mii?.images.length > 0 ? mii?.images : ["/missing.webp"]} className="shadow-lg" />
|
||||
|
||||
<div className="flex flex-col gap-1 p-4">
|
||||
<h1 className="text-5xl font-extrabold break-words">{mii?.name}</h1>
|
||||
|
|
|
|||
Loading…
Reference in a new issue