fix: type errors, shared page avatars and project icons
This commit is contained in:
parent
e9f03d52fd
commit
f2f394d245
@ -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} />
|
||||
|
@ -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>
|
||||
</>
|
||||
|
@ -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}
|
||||
|
@ -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,
|
||||
},
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user