-
Notifications
You must be signed in to change notification settings - Fork 118
[bounty-to-hire]: create ui for newsletter #162
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
Open
ad1tyayadav
wants to merge
3
commits into
apsinghdev:main
Choose a base branch
from
ad1tyayadav:feat/create-ui-for-newsletter
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
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
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
135 changes: 135 additions & 0 deletions
135
apps/web/src/app/(main)/dashboard/newsletters/[slug]/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 |
|---|---|---|
| @@ -0,0 +1,135 @@ | ||
| "use client"; | ||
|
|
||
| import { NEWSLETTERS } from "@/data/newsletters"; | ||
| import NewsletterContent from "@/components/newsletters/NewsletterContent"; | ||
| import { CalendarIcon, ArrowLeftIcon, ClockIcon, BookmarkIcon } from "@heroicons/react/24/outline"; | ||
| import { BookmarkIcon as BookmarkSolid } from "@heroicons/react/24/solid"; | ||
| import Link from "next/link"; | ||
| import { useState } from "react"; | ||
|
|
||
| export default function Page({ params }: { params: { slug: string } }) { | ||
| const n = NEWSLETTERS.find((x) => x.slug === params.slug); | ||
| const [isSaved, setIsSaved] = useState(false); | ||
|
|
||
| if (!n) { | ||
| return ( | ||
| <div className="w-full min-h-screen bg-black flex items-center justify-center"> | ||
| <div className="text-center"> | ||
| <h1 className="text-xl font-light text-white mb-8">Newsletter not found</h1> | ||
| <Link | ||
| href="/dashboard/newsletters" | ||
| className="inline-flex items-center gap-2 text-zinc-400 hover:text-white transition-colors text-sm font-light" | ||
| > | ||
| <ArrowLeftIcon className="w-3 h-3" /> | ||
| Back to newsletters | ||
| </Link> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| const wordCount = n.body.split(/\s+/).length; | ||
| const readingTime = Math.ceil(wordCount / 200); | ||
|
|
||
| return ( | ||
| <main className="min-h-screen bg-black"> | ||
|
|
||
| {/* Back Navigation */} | ||
| <div className="border-b border-zinc-900 sticky top-0 bg-black/80 backdrop-blur-xl z-40"> | ||
| <div className="max-w-3xl mx-auto px-6 py-6"> | ||
| <Link | ||
| href="/dashboard/newsletters" | ||
| className="inline-flex items-center gap-3 text-zinc-500 hover:text-white transition-colors text-sm font-light" | ||
| > | ||
| <ArrowLeftIcon className="w-3 h-3" /> | ||
| Newsletters | ||
| </Link> | ||
| </div> | ||
| </div> | ||
|
|
||
| {/* Article Content */} | ||
| <article className="max-w-3xl mx-auto px-6 py-16"> | ||
|
|
||
| {/* Article Header */} | ||
| <header className="mb-20"> | ||
| {n.featured && ( | ||
| <div className="mb-8"> | ||
| <span className="text-xs tracking-[0.2em] uppercase text-zinc-600 font-light"> | ||
| Featured | ||
| </span> | ||
| </div> | ||
| )} | ||
|
|
||
| <h1 className="text-4xl lg:text-5xl font-light tracking-tight text-white mb-8 leading-[1.1]"> | ||
| {n.title} | ||
| </h1> | ||
|
|
||
| <p className="text-lg text-zinc-400 mb-12 leading-relaxed font-light"> | ||
| {n.excerpt} | ||
| </p> | ||
|
|
||
| {/* Meta Information */} | ||
| <div className="flex items-center justify-between py-6 border-y border-zinc-900"> | ||
| <div className="flex items-center gap-8 text-zinc-500 text-sm font-light"> | ||
| <div className="flex items-center gap-2"> | ||
| <CalendarIcon className="w-3.5 h-3.5" /> | ||
| <span>{new Date(n.date).toLocaleDateString('en-US', { | ||
| year: 'numeric', | ||
| month: 'short', | ||
| day: 'numeric' | ||
| })}</span> | ||
| </div> | ||
|
|
||
| <div className="flex items-center gap-2"> | ||
| <ClockIcon className="w-3.5 h-3.5" /> | ||
| <span>{readingTime} min</span> | ||
| </div> | ||
| </div> | ||
|
|
||
| {/* Save Button */} | ||
| <button | ||
| onClick={() => setIsSaved(!isSaved)} | ||
| className={` | ||
| flex items-center gap-2 transition-all duration-300 text-sm font-light | ||
| ${isSaved | ||
| ? 'text-white' | ||
| : 'text-zinc-500 hover:text-white' | ||
| } | ||
| `} | ||
| > | ||
| {isSaved ? ( | ||
| <BookmarkSolid className="w-4 h-4" /> | ||
| ) : ( | ||
| <BookmarkIcon className="w-4 h-4" /> | ||
| )} | ||
| <span>{isSaved ? 'Saved' : 'Save'}</span> | ||
| </button> | ||
| </div> | ||
| </header> | ||
|
|
||
| {/* Article Body */} | ||
| <div className="prose prose-invert max-w-none"> | ||
| <div className="text-zinc-300 leading-[1.8] text-base font-light"> | ||
| <NewsletterContent body={n.body} /> | ||
| </div> | ||
| </div> | ||
|
|
||
| {/* Article Footer */} | ||
| <footer className="mt-32 pt-12 border-t border-zinc-900"> | ||
| <div className="flex items-center justify-between"> | ||
| <div className="text-zinc-600 text-sm font-light"> | ||
| OpenSox Team | ||
| </div> | ||
|
|
||
| <Link | ||
| href="/dashboard/newsletters" | ||
| className="text-zinc-400 hover:text-white text-sm font-light transition-colors" | ||
| > | ||
| More newsletters → | ||
| </Link> | ||
| </div> | ||
| </footer> | ||
| </article> | ||
| </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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| import NewsletterContainer from '@/components/newsletters/NewsletterContainer' | ||
|
|
||
| export default function Page() { | ||
| return ( | ||
| <div className="min-h-screen bg-[#101010]"> | ||
| <NewsletterContainer /> | ||
| </div> | ||
| ) | ||
| } |
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
129 changes: 129 additions & 0 deletions
129
apps/web/src/components/newsletters/NewsletterContainer.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 |
|---|---|---|
| @@ -0,0 +1,129 @@ | ||
| "use client"; | ||
|
|
||
| import { useState, useMemo } from "react"; | ||
| import NewsletterList from "./NewsletterList"; | ||
| import { MagnifyingGlassIcon, CalendarIcon, ChevronDownIcon } from "@heroicons/react/24/outline"; | ||
|
|
||
| export default function NewsletterContainer() { | ||
| const [q, setQ] = useState(""); | ||
| const [selectedMonth, setSelectedMonth] = useState<string>("all"); | ||
| const [isDropdownOpen, setIsDropdownOpen] = useState(false); | ||
|
|
||
| const monthFilters = useMemo(() => { | ||
| const months = [ | ||
| { value: "all", label: "All months" }, | ||
| { value: "2025-11", label: "November 2025" }, | ||
| { value: "2025-10", label: "October 2025" }, | ||
| { value: "2025-09", label: "September 2025" }, | ||
| ]; | ||
| return months; | ||
| }, []); | ||
|
|
||
| const selectedFilterLabel = monthFilters.find(filter => filter.value === selectedMonth)?.label || "All months"; | ||
|
|
||
| return ( | ||
| <div className="w-full min-h-screen bg-black"> | ||
| <div className="max-w-5xl mx-auto px-6 py-20"> | ||
|
|
||
| {/* Header */} | ||
| <div className="mb-4"> | ||
| <div className="inline-block mb-6"> | ||
| <span className="text-xs tracking-[0.2em] uppercase text-zinc-500 font-light"> | ||
| Pro Access | ||
| </span> | ||
| </div> | ||
|
|
||
| <h1 className="text-6xl lg:text-7xl font-light tracking-tight text-white mb-8 leading-[0.95]"> | ||
| Newsletters | ||
| </h1> | ||
|
|
||
| <p className="text-lg text-zinc-400 max-w-xl font-light leading-relaxed"> | ||
| Curated insights and platform updates | ||
| </p> | ||
| </div> | ||
|
|
||
| {/* Controls */} | ||
| <div className="flex flex-col lg:flex-row gap-3 mb-16"> | ||
|
|
||
| {/* Search */} | ||
| <div className="relative flex-1"> | ||
| <MagnifyingGlassIcon className="absolute left-0 top-1/2 -translate-y-1/2 w-4 h-4 text-zinc-600" /> | ||
| <input | ||
| value={q} | ||
| onChange={(e) => setQ(e.target.value)} | ||
| placeholder="Search" | ||
| className="w-full pl-7 pr-4 py-3 bg-transparent border-b border-zinc-800 text-white placeholder:text-zinc-600 focus:outline-none focus:border-zinc-600 transition-colors text-sm font-light" | ||
| /> | ||
| </div> | ||
|
|
||
| {/* Filter */} | ||
| <div className="relative lg:w-48"> | ||
| <button | ||
| onClick={() => setIsDropdownOpen(!isDropdownOpen)} | ||
| className="w-full flex items-center justify-between pl-7 pr-4 py-3 bg-transparent border-b border-zinc-800 text-white hover:border-zinc-600 transition-colors group" | ||
| > | ||
| <CalendarIcon className="absolute left-0 top-1/2 -translate-y-1/2 w-4 h-4 text-zinc-600 group-hover:text-zinc-400 transition-colors" /> | ||
| <span className="text-sm font-light">{selectedFilterLabel}</span> | ||
| <ChevronDownIcon | ||
| className={`w-3 h-3 text-zinc-600 transition-all duration-300 ${ | ||
| isDropdownOpen ? 'rotate-180' : '' | ||
| }`} | ||
| /> | ||
| </button> | ||
|
|
||
| {isDropdownOpen && ( | ||
| <> | ||
| <div | ||
| className="fixed inset-0 z-10" | ||
| onClick={() => setIsDropdownOpen(false)} | ||
| /> | ||
|
|
||
| <div className="absolute top-full right-0 mt-3 w-64 bg-zinc-950 border border-zinc-800 z-20 overflow-hidden"> | ||
| {monthFilters.map((filter) => ( | ||
| <button | ||
| key={filter.value} | ||
| onClick={() => { | ||
| setSelectedMonth(filter.value); | ||
| setIsDropdownOpen(false); | ||
| }} | ||
| className={`w-full text-left px-6 py-4 text-sm transition-all font-light ${ | ||
| selectedMonth === filter.value | ||
| ? 'text-white bg-zinc-900' | ||
| : 'text-zinc-400 hover:text-white hover:bg-zinc-900/50' | ||
| }`} | ||
| > | ||
| {filter.label} | ||
| </button> | ||
| ))} | ||
| </div> | ||
| </> | ||
| )} | ||
| </div> | ||
| </div> | ||
|
|
||
| {/* Active Filter */} | ||
| {selectedMonth !== "all" && ( | ||
| <div className="flex items-center gap-4 mb-12 pb-12 border-b border-zinc-900"> | ||
| <span className="text-xs text-zinc-600 font-light tracking-wider">FILTERED BY</span> | ||
| <button | ||
| onClick={() => setSelectedMonth("all")} | ||
| className="text-sm text-zinc-400 hover:text-white transition-colors font-light" | ||
| > | ||
| {selectedFilterLabel} × | ||
| </button> | ||
| </div> | ||
| )} | ||
|
|
||
| {/* Newsletter List */} | ||
| <NewsletterList query={q} monthFilter={selectedMonth} /> | ||
|
|
||
| {/* Footer */} | ||
| <div className="text-center pt-12 mt-12 border-t border-zinc-900"> | ||
| <p className="text-sm text-zinc-600 font-light tracking-wide"> | ||
| More insights coming soon | ||
| </p> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix the inconsistent route path for Newsletters.
The href
"newsletters"uses a relative path, while other sidebar items use absolute paths like"/dashboard/home"and"/dashboard/projects"(lines 30, 35). This inconsistency can cause navigation issues and breaks the established pattern.Apply this diff to use an absolute path:
Also update the className computation to use the full path:
<Link href="/dashboard/newsletters" - className={getSidebarLinkClassName(pathname, "/newsletters")} + className={getSidebarLinkClassName(pathname, "/dashboard/newsletters")} >📝 Committable suggestion
🤖 Prompt for AI Agents