-
Notifications
You must be signed in to change notification settings - Fork 1
User profile and Preferences #561
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
Changes from 40 commits
72f7b77
23e6baf
7de3c6d
1c5c7de
6f0edff
09d01d8
35c2d7f
4bdaf2f
d4cb4b5
0cbf5ec
dd06648
fab64fe
b1eae54
568ec33
2e0fb3f
db14593
f3c17fd
86976eb
6ea5f42
7ca6583
baba461
520fb8e
8383b36
1993d31
2b85da5
635d909
28de615
4ecbabb
20456d9
727308a
5c0a42b
0b7e408
6602eaa
d3ebdca
fd6207f
10a36a0
b6776d8
557ca42
dbdde0d
84c055c
f0c3cc7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,9 @@ | ||
| import BrowseList from '@/components/routes/browse/browse-list' | ||
| import HomePage from '@/components/routes/home/home-page' | ||
AndlerRL marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| import { PAGE_SIZE } from '@/lib/constants/hasura' | ||
| import { getBrowseThreads } from '@/services/hasura' | ||
|
|
||
| export default async function HomePage() { | ||
| export default async function Page() { | ||
| const { threads, count } = await getBrowseThreads({ limit: PAGE_SIZE }) | ||
|
|
||
| return <BrowseList initialThreads={threads} initialCount={count} /> | ||
| return <HomePage initialThreads={threads} initialCount={count} /> | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,8 +1,21 @@ | ||||||||||
| import { authOptions } from '@/auth' | ||||||||||
| import { Preferences } from '@/components/routes/preferences/preferences' | ||||||||||
| import { ErrorComponent } from '@/components/shared/error' | ||||||||||
| import type { PageProps } from '@/types/types' | ||||||||||
| import { getServerSession } from 'next-auth' | ||||||||||
|
|
||||||||||
| export default async function PreferencePage(props: PageProps) { | ||||||||||
| const params = await props.params | ||||||||||
| const userSlug = params.userSlug | ||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion (code-quality): Prefer object destructuring when accessing and using properties. (
Suggested change
ExplanationObject destructuring can often remove an unnecessary temporary reference, as well as making your code more succinct.From the Airbnb Javascript Style Guide |
||||||||||
| const session = await getServerSession(authOptions) | ||||||||||
| if (!userSlug) return <ErrorComponent message="User slug is required" /> | ||||||||||
| if (!session) | ||||||||||
| return <ErrorComponent message="You must be logged in to view this page" /> | ||||||||||
| if (!session || !session.user || session.user.slug !== userSlug) | ||||||||||
| return <ErrorComponent message={`Login as ${userSlug} to view this page`} /> | ||||||||||
|
Comment on lines
+14
to
+15
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Redundant session check Line 14 has the same redundancy issue - - if (!session || !session.user || session.user.slug !== userSlug)
+ if (session.user.slug !== userSlug)📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||
|
|
||||||||||
| export default async function PreferencePage() { | ||||||||||
| return ( | ||||||||||
| <div className="max-w-screen-xl pb-10 mx-auto w-full py-[120px] px-[58px]"> | ||||||||||
| <div className="max-w-screen-xl pb-10 mx-auto w-full lg:py-[120px] lg:px-[58px] py-[70px] px-[50]"> | ||||||||||
sheriffjimoh marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
| <Preferences /> | ||||||||||
| </div> | ||||||||||
| ) | ||||||||||
|
|
||||||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,5 +1,18 @@ | ||||||
| import { authOptions } from '@/auth' | ||||||
| import { SubscriptionPageComponent } from '@/components/routes/subscription/subscription-page' | ||||||
| import { ErrorComponent } from '@/components/shared/error' | ||||||
| import type { PageProps } from '@/types/types' | ||||||
| import { getServerSession } from 'next-auth' | ||||||
|
|
||||||
| export default async function PreferencePage(props: PageProps) { | ||||||
| const params = await props.params | ||||||
| const userSlug = params.userSlug | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion (code-quality): Prefer object destructuring when accessing and using properties. (
Suggested change
ExplanationObject destructuring can often remove an unnecessary temporary reference, as well as making your code more succinct.From the Airbnb Javascript Style Guide |
||||||
| const session = await getServerSession(authOptions) | ||||||
| if (!userSlug) return <ErrorComponent message="User slug is required" /> | ||||||
| if (!session) | ||||||
| return <ErrorComponent message="You must be logged in to view this page" /> | ||||||
| if (!session || !session.user || session.user.slug !== userSlug) | ||||||
| return <ErrorComponent message={`Login as ${userSlug} to view this page`} /> | ||||||
|
|
||||||
| export default async function PreferencePage() { | ||||||
| return <SubscriptionPageComponent /> | ||||||
| } | ||||||
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.
🛠️ Refactor suggestion
Code duplication across web and pro-web signup routes
This entire signup route is nearly identical to
apps/web/app/api/auth/signup/route.tswith minor differences in verification handling. This violates DRY principles.Consider extracting the shared logic into a common service or utility function that both apps can use. Would you like me to help create a shared signup service that both apps can leverage while maintaining their specific configuration differences?
🤖 Prompt for AI Agents