fix: type errors, shared page avatars and project icons

This commit is contained in:
Akhileshrangani4
2024-11-11 13:05:51 -05:00
parent e9f03d52fd
commit f2f394d245
4 changed files with 12 additions and 7 deletions

View File

@ -25,6 +25,7 @@ export default function Dashboard({
type: "react" | "node"
author: string
sharedOn: Date
authorAvatarUrl?: string
}[]
}) {
const [screen, setScreen] = useState<TScreen>("projects")
@ -121,7 +122,12 @@ export default function Dashboard({
) : null}
</>
) : screen === "shared" ? (
<DashboardSharedWithMe shared={shared} />
<DashboardSharedWithMe
shared={shared.map((item) => ({
...item,
authorAvatarUrl: item.authorAvatarUrl || "",
}))}
/>
) : screen === "settings" ? null : null}
</div>
</>

View File

@ -11,6 +11,7 @@ import Image from "next/image"
import Link from "next/link"
import Avatar from "../ui/avatar"
import Button from "../ui/customButton"
import { projectTemplates } from "@/lib/data"
export default function DashboardSharedWithMe({
shared,
@ -18,7 +19,7 @@ export default function DashboardSharedWithMe({
shared: {
id: string
name: string
type: "react" | "node"
type: string
author: string
authorAvatarUrl: string
sharedOn: Date
@ -46,9 +47,7 @@ export default function DashboardSharedWithMe({
<Image
alt=""
src={
sandbox.type === "react"
? "/project-icons/react.svg"
: "/project-icons/node.svg"
projectTemplates.find((p) => p.id === sandbox.type)?.icon ?? "/project-icons/node.svg"
}
width={20}
height={20}