26 lines
710 B
TypeScript
26 lines
710 B
TypeScript
'use server'
|
|
|
|
import { getBasePath, getCards, getPath, MarkCardI } from '@/lib/markcard/card'
|
|
import React from 'react'
|
|
import { notFound } from 'next/navigation'
|
|
import MarkCardGrid from './MarkCardGrid'
|
|
|
|
interface CardProps {
|
|
canEdit: boolean
|
|
onEdit?: (id: string, origin: MarkCardI) => void
|
|
userId?: string
|
|
fileUrl?: string[]
|
|
filePath?: string
|
|
}
|
|
|
|
export default async function MarkCards({ userId, fileUrl, canEdit, onEdit, filePath } : CardProps) {
|
|
const cards = await getCards(filePath ?? await getPath(userId, fileUrl) ?? notFound())
|
|
if (cards === undefined) {
|
|
return notFound()
|
|
}
|
|
|
|
return (
|
|
<MarkCardGrid cards={cards} canEdit={false} baseUrl={await getBasePath(userId)}/>
|
|
)
|
|
}
|