File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,13 +15,11 @@ export default async function ThoughtsPage() {
1515 </ Card >
1616
1717 < section className = "flex flex-col gap-2" >
18- { thoughts . map ( ( { id , content , author } ) => (
18+ { thoughts . map ( thought => (
1919 < ThoughtCard
20- key = { id }
21- id = { id }
22- content = { content }
23- author = { author }
20+ key = { thought . id }
2421 currentUserId = { currentUser . id }
22+ { ...thought }
2523 />
2624 ) ) }
2725 </ section >
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ import type { Thought } from '~/server/types/thoughts'
77
88namespace ThoughtCard {
99 export type Props = Readonly <
10- Pick < Thought , 'content' | 'author' | 'id' > & {
10+ Thought & {
1111 currentUserId : string
1212 }
1313 >
@@ -17,6 +17,8 @@ function ThoughtCard({
1717 id,
1818 content,
1919 author,
20+ updatedAt,
21+ createdAt,
2022 currentUserId,
2123} : ThoughtCard . Props ) {
2224 return (
@@ -39,14 +41,16 @@ function ThoughtCard({
3941 < User className = "place-self-center" />
4042
4143 < CardHeader className = "flex flex-row items-center justify-between" >
42- < div className = "flex flex-row items-center gap-2" >
43- < div >
44- < p className = "font-semibold leading-5" > { author . name } </ p >
45- < p className = "text-muted-foreground text-xs" >
46- { new Date ( author . createdAt ) . toLocaleDateString ( ) }
47- </ p >
48- </ div >
44+ < div >
45+ < p className = "font-semibold leading-5" > { author . name } </ p >
46+ < p className = "text-muted-foreground text-xs" >
47+ { new Date ( author . createdAt ) . toLocaleDateString ( ) }
48+ </ p >
4949 </ div >
50+
51+ { createdAt !== updatedAt && (
52+ < p className = "pr-2 text-xs text-neutral-400" > (edited)</ p >
53+ ) }
5054 </ CardHeader >
5155
5256 < div />
You can’t perform that action at this time.
0 commit comments