-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: create a sharable investor update page (#211)
* feat: add loading effect to profile update * feat: update loading icon to logo icon * feat: rendering investor updates public page * feat: update placeholder image * feat: minor cleanups * chore: stopping point before render experiments, current render is broken because of existing tailwind, trying webcomponent * feat: complete rendering investor update on a public page
- Loading branch information
Showing
20 changed files
with
260 additions
and
31 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
prisma/migrations/20240323033041_add_company_logo/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
-- AlterTable | ||
ALTER TABLE "Company" ADD COLUMN "logo" TEXT; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
"use server"; | ||
|
||
import Link from "next/link"; | ||
import { db } from "@/server/db"; | ||
import { render } from "jsx-email"; | ||
import { dayjsExt } from "@/common/dayjs"; | ||
import { Card } from "@/components/ui/card"; | ||
import UpdateRenderer from "@/components/update/renderer"; | ||
import { Avatar, AvatarImage } from "@/components/ui/avatar"; | ||
|
||
const PublicUpdatePage = async ({ | ||
params: { publicId }, | ||
}: { | ||
params: { publicId: string }; | ||
}) => { | ||
const update = await db.update.findFirst({ | ||
where: { | ||
publicId, | ||
}, | ||
|
||
include: { | ||
company: { | ||
select: { | ||
name: true, | ||
logo: true, | ||
}, | ||
}, | ||
|
||
author: { | ||
select: { | ||
title: true, | ||
user: { | ||
select: { | ||
name: true, | ||
email: true, | ||
image: true, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}); | ||
|
||
if (!update) { | ||
return { | ||
status: 404, | ||
redirect: "/404", | ||
}; | ||
} | ||
|
||
const company = update?.company; | ||
const author = update?.author; | ||
const html = await render(<UpdateRenderer html={update.html} />); | ||
|
||
return ( | ||
<div className="flex min-h-screen justify-center bg-gradient-to-br from-indigo-50 via-white to-cyan-100 px-5 pb-5 pt-12"> | ||
<div className="flex flex-col"> | ||
<div className="mb-16 flex items-center gap-3"> | ||
<Avatar className="h-12 w-12 rounded"> | ||
<AvatarImage | ||
src={ | ||
"https://pbs.twimg.com/profile_images/1686033387482464257/Dk2qBvtc_400x400.jpg" || | ||
"/placeholders/company.svg" | ||
} | ||
/> | ||
|
||
{/* <AvatarImage src={company.logo || "/placeholders/company.svg"} /> */} | ||
</Avatar> | ||
|
||
<span className="text-lg font-semibold">{company.name}</span> | ||
</div> | ||
|
||
<div className="mb-5"> | ||
<h1 className="text-2xl font-semibold tracking-tight"> | ||
{update.title} | ||
</h1> | ||
<p className="text-sm text-muted-foreground"> | ||
Last updated {dayjsExt().to(update.updatedAt)} | ||
</p> | ||
</div> | ||
|
||
<Card className="max-w-4xl p-10"> | ||
<div className="flex items-center gap-3"> | ||
<Avatar className="h-10 w-10 rounded-full"> | ||
<AvatarImage | ||
src={author.user.image || "/placeholders/user.svg"} | ||
/> | ||
</Avatar> | ||
|
||
<div> | ||
<p className="text-lg font-semibold">{author.user.name}</p> | ||
<p className="text-sm text-muted-foreground">{author.title}</p> | ||
</div> | ||
</div> | ||
|
||
<div className="mt-5"> | ||
<article | ||
className="prose" | ||
dangerouslySetInnerHTML={{ __html: html }} | ||
/> | ||
</div> | ||
</Card> | ||
|
||
<div className="my-10 text-center text-sm text-muted-foreground"> | ||
<p> | ||
Powered by{" "} | ||
<Link | ||
href={`https://opencap.co?utm_source=${company.name}&utm_medium=updates&utm_campaign=powered_by`} | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
className="text-bold text-teal-500 hover:underline" | ||
> | ||
OpenCap | ||
</Link> | ||
</p> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default PublicUpdatePage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.