-
Notifications
You must be signed in to change notification settings - Fork 3.7k
fix(landing): align author-page UI with the site shell and link bylines to it #5655
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
f58766d
fix(landing): align author-page UI with the site shell and link bylin…
waleedlatif1 0f096e6
fix(landing): address review findings on author-page UI rebuild
waleedlatif1 807a7a8
fix(landing): make author Person.image an absolute URL in JSON-LD
waleedlatif1 760a77f
fix(landing): align author not-found fallback width with the site con…
waleedlatif1 b593e88
fix(landing): encode author id consistently in every author URL builder
waleedlatif1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
143 changes: 102 additions & 41 deletions
143
apps/sim/app/(landing)/components/content-author-page/content-author-page.tsx
This file contains hidden or 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 |
|---|---|---|
| @@ -1,76 +1,137 @@ | ||
| import { ChipLink } from '@sim/emcn' | ||
| import Image from 'next/image' | ||
| import Link from 'next/link' | ||
| import type { ContentMeta } from '@/lib/content/schema' | ||
| import { BackLink } from '@/app/(landing)/components/back-link' | ||
| import { Cta } from '@/app/(landing)/components/cta/cta' | ||
| import { JsonLd } from '@/app/(landing)/components/json-ld' | ||
|
|
||
| interface ContentAuthorPageProps { | ||
| /** Route base path, e.g. `/blog` or `/library`. */ | ||
| basePath: string | ||
| /** Section label used in the not-found fallback, e.g. "Blog" or "Library". */ | ||
| sectionName: string | ||
| authorName?: string | ||
| authorAvatarUrl?: string | ||
| /** Posts already filtered down to this author. */ | ||
| posts: ContentMeta[] | ||
| graphJsonLd?: Record<string, unknown> | ||
| } | ||
|
|
||
| /** Shared author-profile layout for a content section. */ | ||
| /** | ||
| * Shared author-profile layout for a content section: standard page-shell | ||
| * header (matching `ContentIndexPage`/`ContentPostPage`) with avatar + name, | ||
| * followed by the author's posts in the same framed-list card style used | ||
| * everywhere else on the site. | ||
| */ | ||
| export function ContentAuthorPage({ | ||
| basePath, | ||
| sectionName, | ||
| authorName, | ||
| authorAvatarUrl, | ||
| posts, | ||
| graphJsonLd, | ||
| }: ContentAuthorPageProps) { | ||
| if (!authorName) { | ||
| return ( | ||
| <main className='mx-auto max-w-[900px] px-6 py-10 sm:px-8 md:px-12'> | ||
| <h1 className='text-[32px] text-[var(--text-primary)]'>Author not found</h1> | ||
| </main> | ||
| <section className='mx-auto flex min-h-[60vh] w-full max-w-[1460px] flex-col items-center justify-center gap-3 px-20 py-24 text-center max-sm:px-5 max-lg:px-8'> | ||
| <h1 className='text-balance text-[40px] text-[var(--text-primary)] leading-[110%] tracking-[-0.02em]'> | ||
| Author not found | ||
| </h1> | ||
| <p className='text-[var(--text-muted)] text-lg'> | ||
| The author you're looking for doesn't exist or has been moved. | ||
| </p> | ||
| <ChipLink variant='primary' href={basePath} className='mt-3'> | ||
| Browse {sectionName} | ||
| </ChipLink> | ||
| </section> | ||
| ) | ||
| } | ||
|
|
||
| return ( | ||
| <main className='mx-auto max-w-[900px] px-6 py-10 sm:px-8 md:px-12'> | ||
| {graphJsonLd && <JsonLd data={graphJsonLd} />} | ||
| <div className='mb-6 flex items-center gap-3'> | ||
| {authorAvatarUrl ? ( | ||
| <Image | ||
| src={authorAvatarUrl} | ||
| alt={authorName} | ||
| width={40} | ||
| height={40} | ||
| className='rounded-full' | ||
| unoptimized | ||
| /> | ||
| ) : null} | ||
| <h1 className='text-[32px] text-[var(--text-primary)] leading-tight'>{authorName}</h1> | ||
| </div> | ||
| <div className='grid grid-cols-1 gap-8 sm:grid-cols-2'> | ||
| {posts.map((p) => ( | ||
| <Link key={p.slug} href={`${basePath}/${p.slug}`} className='group'> | ||
| <div className='overflow-hidden rounded-lg border border-[var(--border)]'> | ||
| <> | ||
| <section className='bg-[var(--bg)]'> | ||
| {graphJsonLd && <JsonLd data={graphJsonLd} />} | ||
|
|
||
| <div className='mx-auto w-full max-w-[1460px] px-20 pt-[112px] max-sm:px-5 max-sm:pt-20 max-lg:px-8'> | ||
| <div className='mb-6'> | ||
| <BackLink href={basePath} label={`Back to ${sectionName}`} /> | ||
| </div> | ||
|
|
||
| <div className='flex items-center gap-4'> | ||
| {authorAvatarUrl ? ( | ||
| <Image | ||
| src={p.ogImage} | ||
| alt={p.title} | ||
| width={600} | ||
| height={315} | ||
| className='h-[160px] w-full object-cover transition-transform group-hover:scale-[1.02]' | ||
| src={authorAvatarUrl} | ||
| alt={authorName} | ||
| width={64} | ||
| height={64} | ||
| className='rounded-full' | ||
| unoptimized | ||
| /> | ||
| <div className='p-3'> | ||
| <div className='mb-1 text-[var(--text-muted)] text-xs'> | ||
| {new Date(p.date).toLocaleDateString('en-US', { | ||
| month: 'short', | ||
| day: 'numeric', | ||
| year: 'numeric', | ||
| })} | ||
| </div> | ||
| <div className='text-[var(--text-primary)] text-sm leading-tight'>{p.title}</div> | ||
| ) : null} | ||
| <h1 className='text-balance text-[28px] text-[var(--text-primary)] leading-[100%] tracking-[-0.02em] lg:text-[40px]'> | ||
| {authorName} | ||
| </h1> | ||
| </div> | ||
| </div> | ||
|
|
||
| <div className='mt-8 h-px w-full bg-[var(--border)]' /> | ||
|
|
||
| <div className='mx-auto w-full max-w-[1460px] px-20 max-sm:px-5 max-lg:px-8'> | ||
| <div className='border-[var(--border)] border-x'> | ||
| {posts.map((p) => ( | ||
| <div key={p.slug}> | ||
| <Link | ||
| href={`${basePath}/${p.slug}`} | ||
| className='group flex items-start gap-6 p-6 transition-colors hover:bg-[var(--surface-hover)] md:items-center' | ||
| > | ||
| <span className='hidden w-[120px] shrink-0 pt-1 text-[var(--text-muted)] text-xs uppercase tracking-[0.1em] md:block'> | ||
| {new Date(p.date).toLocaleDateString('en-US', { | ||
| month: 'short', | ||
| day: 'numeric', | ||
| year: 'numeric', | ||
| })} | ||
| </span> | ||
|
|
||
| <div className='flex min-w-0 flex-1 flex-col gap-1'> | ||
| <span className='text-[var(--text-muted)] text-xs uppercase tracking-[0.1em] md:hidden'> | ||
| {new Date(p.date).toLocaleDateString('en-US', { | ||
| month: 'short', | ||
| day: 'numeric', | ||
| year: 'numeric', | ||
| })} | ||
| </span> | ||
| <h3 className='text-[var(--text-primary)] text-base leading-tight tracking-[-0.01em] lg:text-lg'> | ||
| {p.title} | ||
| </h3> | ||
| <p className='line-clamp-2 text-[var(--text-muted)] text-sm leading-[150%]'> | ||
| {p.description} | ||
| </p> | ||
| </div> | ||
|
|
||
| <div className='relative hidden h-[80px] w-[140px] shrink-0 overflow-hidden rounded-[5px] sm:block'> | ||
| <Image | ||
| src={p.ogImage} | ||
| alt={p.title} | ||
| fill | ||
| sizes='140px' | ||
| className='object-cover' | ||
| unoptimized | ||
| /> | ||
| </div> | ||
| </Link> | ||
| <div className='h-px w-full bg-[var(--border)]' /> | ||
| </div> | ||
| </div> | ||
| </Link> | ||
| ))} | ||
| ))} | ||
| </div> | ||
| </div> | ||
|
|
||
| <div className='-mt-px h-px w-full bg-[var(--border)]' /> | ||
| </section> | ||
|
|
||
| <div className='mt-[120px] max-sm:mt-16 max-lg:mt-[88px]'> | ||
| <Cta /> | ||
| </div> | ||
| </main> | ||
| </> | ||
| ) | ||
| } | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.