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
|
<Navbar
|
||||||
userData={userData}
|
userData={userData}
|
||||||
sandboxData={sandboxData}
|
sandboxData={sandboxData}
|
||||||
shared={shared}
|
shared={shared as { id: string; name: string; avatarUrl: string }[]}
|
||||||
/>
|
/>
|
||||||
<div className="w-screen flex grow">
|
<div className="w-screen flex grow">
|
||||||
<CodeEditor userData={userData} sandboxData={sandboxData} />
|
<CodeEditor userData={userData} sandboxData={sandboxData} />
|
||||||
|
@ -25,6 +25,7 @@ export default function Dashboard({
|
|||||||
type: "react" | "node"
|
type: "react" | "node"
|
||||||
author: string
|
author: string
|
||||||
sharedOn: Date
|
sharedOn: Date
|
||||||
|
authorAvatarUrl?: string
|
||||||
}[]
|
}[]
|
||||||
}) {
|
}) {
|
||||||
const [screen, setScreen] = useState<TScreen>("projects")
|
const [screen, setScreen] = useState<TScreen>("projects")
|
||||||
@ -121,7 +122,12 @@ export default function Dashboard({
|
|||||||
) : null}
|
) : null}
|
||||||
</>
|
</>
|
||||||
) : screen === "shared" ? (
|
) : screen === "shared" ? (
|
||||||
<DashboardSharedWithMe shared={shared} />
|
<DashboardSharedWithMe
|
||||||
|
shared={shared.map((item) => ({
|
||||||
|
...item,
|
||||||
|
authorAvatarUrl: item.authorAvatarUrl || "",
|
||||||
|
}))}
|
||||||
|
/>
|
||||||
) : screen === "settings" ? null : null}
|
) : screen === "settings" ? null : null}
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
@ -11,6 +11,7 @@ import Image from "next/image"
|
|||||||
import Link from "next/link"
|
import Link from "next/link"
|
||||||
import Avatar from "../ui/avatar"
|
import Avatar from "../ui/avatar"
|
||||||
import Button from "../ui/customButton"
|
import Button from "../ui/customButton"
|
||||||
|
import { projectTemplates } from "@/lib/data"
|
||||||
|
|
||||||
export default function DashboardSharedWithMe({
|
export default function DashboardSharedWithMe({
|
||||||
shared,
|
shared,
|
||||||
@ -18,7 +19,7 @@ export default function DashboardSharedWithMe({
|
|||||||
shared: {
|
shared: {
|
||||||
id: string
|
id: string
|
||||||
name: string
|
name: string
|
||||||
type: "react" | "node"
|
type: string
|
||||||
author: string
|
author: string
|
||||||
authorAvatarUrl: string
|
authorAvatarUrl: string
|
||||||
sharedOn: Date
|
sharedOn: Date
|
||||||
@ -46,9 +47,7 @@ export default function DashboardSharedWithMe({
|
|||||||
<Image
|
<Image
|
||||||
alt=""
|
alt=""
|
||||||
src={
|
src={
|
||||||
sandbox.type === "react"
|
projectTemplates.find((p) => p.id === sandbox.type)?.icon ?? "/project-icons/node.svg"
|
||||||
? "/project-icons/react.svg"
|
|
||||||
: "/project-icons/node.svg"
|
|
||||||
}
|
}
|
||||||
width={20}
|
width={20}
|
||||||
height={20}
|
height={20}
|
||||||
|
@ -16,7 +16,7 @@ export const projectTemplates: {
|
|||||||
id: "vanillajs",
|
id: "vanillajs",
|
||||||
name: "HTML/JS",
|
name: "HTML/JS",
|
||||||
icon: "/project-icons/more.svg",
|
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,
|
disabled: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user