-
Notifications
You must be signed in to change notification settings - Fork 3
feat(positions): add position detail page #368
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 all commits
8b8baff
31274ae
d714f51
21cde57
42944f5
3ddeebf
75bbc2f
17eec47
5aded5e
116c846
86d05f6
d2f7a4b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| import type { Metadata } from 'next'; | ||
| import PositionDetailContent from '@/features/position-detail/position-view'; | ||
|
|
||
| export const metadata: Metadata = { | ||
| title: 'Position Detail | Monarch', | ||
| description: 'View detailed position information on Monarch', | ||
| }; | ||
|
|
||
| export default async function PositionDetailPage({ | ||
| params, | ||
| }: { | ||
| params: Promise<{ chainId: string; loanAssetAddress: string; userAddress: string }>; | ||
| }) { | ||
| const p = await params; | ||
| return ( | ||
| <PositionDetailContent | ||
| chainId={Number(p.chainId)} | ||
| loanAssetAddress={p.loanAssetAddress} | ||
| userAddress={p.userAddress} | ||
| /> | ||
|
Comment on lines
+1
to
+20
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. 🧩 Analysis chain🏁 Script executed: find . -type f -name "page.tsx" | grep -E "position.*chainId.*loanAsset.*userAddress" | head -20Repository: antoncoding/monarch Length of output: 129 🏁 Script executed: fd "page.tsx" app/positionRepository: antoncoding/monarch Length of output: 127 🏁 Script executed: find app -type d -name "\[chainId\]"Repository: antoncoding/monarch Length of output: 130 🏁 Script executed: cat -n app/position/[chainId]/[loanAssetAddress]/[userAddress]/page.tsxRepository: antoncoding/monarch Length of output: 823 🏁 Script executed: rg "PositionDetailContent" --type tsx -A 10 -B 2Repository: antoncoding/monarch Length of output: 90 🏁 Script executed: rg "PositionDetailContent" --type ts -A 10 -B 2Repository: antoncoding/monarch Length of output: 3535 🏁 Script executed: rg "export.*PositionDetailContent" -A 50Repository: antoncoding/monarch Length of output: 4294 🏁 Script executed: find . -name "position-view.*" -type fRepository: antoncoding/monarch Length of output: 111 🏁 Script executed: cat -n src/features/position-detail/position-view.tsx | head -50Repository: antoncoding/monarch Length of output: 2440 🏁 Script executed: rg "SupportedNetworks" -A 2 -B 2 | head -40Repository: antoncoding/monarch Length of output: 2681 🏁 Script executed: rg "\[chainId\]" app/ --type-listRepository: antoncoding/monarch Length of output: 452 🏁 Script executed: grep -r "notFound\(\)" app/ | head -10Repository: antoncoding/monarch Length of output: 45 🏁 Script executed: rg "params.*Promise" app/ -A 5 | head -60Repository: antoncoding/monarch Length of output: 1871 🏁 Script executed: find app -name "page.tsx" -exec grep -l "notFound\|redirect" {} \; | head -10Repository: antoncoding/monarch Length of output: 45 🏁 Script executed: rg "Number\(" app/ --type ts | head -20Repository: antoncoding/monarch Length of output: 248 🏁 Script executed: rg "SupportedNetworks" src/utils/networks.ts -A 10 -B 2Repository: antoncoding/monarch Length of output: 5920 🏁 Script executed: cat -n src/utils/networks.ts | head -40Repository: antoncoding/monarch Length of output: 1772 🏁 Script executed: rg "useUserPositionsSummaryData" src/hooks/ -A 15 | head -50Repository: antoncoding/monarch Length of output: 3458 🏁 Script executed: cat -n src/utils/networks.ts | grep -A 3 "isSupportedChain"Repository: antoncoding/monarch Length of output: 210 🏁 Script executed: rg "isSupportedChain" --type tsRepository: antoncoding/monarch Length of output: 1393 Validate Line 17 casts to number without checking validity. An invalid route param produces Suggested fix import type { Metadata } from 'next';
+import { notFound } from 'next/navigation';
+import { isSupportedChain } from '@/utils/networks';
import PositionDetailContent from '@/features/position-detail/position-view';
@@
}) {
const p = await params;
+ const chainIdNum = Number(p.chainId);
+ if (!isSupportedChain(chainIdNum)) notFound();
return (
<PositionDetailContent
- chainId={Number(p.chainId)}
+ chainId={chainIdNum}
loanAssetAddress={p.loanAssetAddress}
userAddress={p.userAddress}
/>🤖 Prompt for AI Agents |
||
| ); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| import type { ReactNode } from 'react'; | ||
| import Link from 'next/link'; | ||
| import { cn } from '@/utils/components'; | ||
|
|
||
| type BreadcrumbItem = { | ||
| label: ReactNode; | ||
| href?: string; | ||
| isCurrent?: boolean; | ||
| }; | ||
|
|
||
| type BreadcrumbsProps = { | ||
| items: BreadcrumbItem[]; | ||
| className?: string; | ||
| }; | ||
|
|
||
| export function Breadcrumbs({ items, className }: BreadcrumbsProps) { | ||
| return ( | ||
| <nav className={cn('flex items-center gap-2 text-sm text-secondary flex-nowrap overflow-x-auto leading-none py-1 font-zen', className)}> | ||
| {items.map((item, index) => { | ||
| const content = item.href ? ( | ||
| <Link | ||
| href={item.href} | ||
| className={cn('no-underline hover:no-underline text-secondary', item.isCurrent ? 'text-primary' : 'hover:text-primary')} | ||
| > | ||
| {item.label} | ||
| </Link> | ||
| ) : ( | ||
| <span className={cn(item.isCurrent ? 'text-primary' : 'text-secondary')}>{item.label}</span> | ||
| ); | ||
|
|
||
| return ( | ||
| <span | ||
| key={index} | ||
| className="flex items-center gap-2" | ||
| > | ||
| {index > 0 && <span className="text-primary/60">/</span>} | ||
| {content} | ||
| </span> | ||
| ); | ||
| })} | ||
| </nav> | ||
| ); | ||
| } |
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.
🧩 Analysis chain
🏁 Script executed:
Repository: antoncoding/monarch
Length of output: 231
🏁 Script executed:
Repository: antoncoding/monarch
Length of output: 215
🏁 Script executed:
Repository: antoncoding/monarch
Length of output: 223
🏁 Script executed:
Repository: antoncoding/monarch
Length of output: 823
🏁 Script executed:
cat -n app/features/position-detail/position-view.tsx | head -50Repository: antoncoding/monarch
Length of output: 141
🏁 Script executed:
Repository: antoncoding/monarch
Length of output: 90
🏁 Script executed:
rg "Number\(" app/position -A 2 -B 2 --type tsxRepository: antoncoding/monarch
Length of output: 90
🏁 Script executed:
Repository: antoncoding/monarch
Length of output: 178
🏁 Script executed:
Repository: antoncoding/monarch
Length of output: 399
🏁 Script executed:
Repository: antoncoding/monarch
Length of output: 129
🏁 Script executed:
cat -n src/features/position-detail/position-view.tsx | head -80Repository: antoncoding/monarch
Length of output: 3795
🏁 Script executed:
Repository: antoncoding/monarch
Length of output: 633
🏁 Script executed:
Repository: antoncoding/monarch
Length of output: 1055
🏁 Script executed:
Repository: antoncoding/monarch
Length of output: 532
🏁 Script executed:
Repository: antoncoding/monarch
Length of output: 638
🏁 Script executed:
rg "import.*notFound.*from.*next"Repository: antoncoding/monarch
Length of output: 45
🏁 Script executed:
rg "notFound\(\)" --context 2Repository: antoncoding/monarch
Length of output: 45
🏁 Script executed:
Repository: antoncoding/monarch
Length of output: 2750
🏁 Script executed:
Repository: antoncoding/monarch
Length of output: 276
🏁 Script executed:
Repository: antoncoding/monarch
Length of output: 9798
🏁 Script executed:
rg "isSupportedChain" --context 3Repository: antoncoding/monarch
Length of output: 6827
🏁 Script executed:
Repository: antoncoding/monarch
Length of output: 561
🏁 Script executed:
cat -n src/hooks/useUserPositionsSummaryData.ts | head -60Repository: antoncoding/monarch
Length of output: 2890
Add validation for invalid
chainIdin URL segment.Non-numeric URL segments like
/position/abc/...convert toNaNviaNumber(), which bypasses type safety and causes downstream issues. Add a guard before passing to the component.Suggested fix
🤖 Prompt for AI Agents