fix: type errors, shared page avatars and project icons

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

View File

@ -94,7 +94,7 @@ export default async function CodePage({ params }: { params: { id: string } }) {
<Navbar
userData={userData}
sandboxData={sandboxData}
shared={shared}
shared={shared as { id: string; name: string; avatarUrl: string }[]}
/>
<div className="w-screen flex grow">
<CodeEditor userData={userData} sandboxData={sandboxData} />

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}

View File

@ -16,7 +16,7 @@ export const projectTemplates: {
id: "vanillajs",
name: "HTML/JS",
icon: "/project-icons/more.svg",
description: "More coming soon, feel free to contribute on GitHub",
description: "A simple HTML/JS project for building web apps",
disabled: false,
},
{