-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix Tx routes params * Extract TxSheet as client component * Use shallow routing for spans
- Loading branch information
Showing
5 changed files
with
81 additions
and
19 deletions.
There are no files selected for viewing
This file contains 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,17 +1,24 @@ | ||
import TxData from "@/components/tx-data"; | ||
import { Sheet, SheetContent } from "@/components/ui/sheet"; | ||
import TxSheet from "@/components/tx-data/tx-sheet"; | ||
|
||
export default function Tx({ params }: { params: { span: string[] } }) { | ||
const [txId, spanId] = params.span; | ||
const traceIdLength = 32; | ||
|
||
export default function Tx({ params }: { params: { span: [string] } }) { | ||
//NOTE - the params are parsed because this catch-all route merges both traceId and spanId | ||
const [txId, spanId] = | ||
params.span[0].length > traceIdLength | ||
? [ | ||
params.span[0].slice(0, traceIdLength), | ||
params.span[0].slice(traceIdLength), | ||
] | ||
: [params.span[0]]; | ||
|
||
return ( | ||
<Sheet defaultOpen> | ||
<SheetContent className="min-w-[80%]"> | ||
<div> | ||
<div>Transaction {txId}</div> | ||
<TxData txId={txId} spanId={spanId} /> | ||
</div> | ||
</SheetContent> | ||
</Sheet> | ||
<TxSheet> | ||
<div> | ||
<div>Transaction {txId}</div> | ||
<TxData txId={txId} spanId={spanId} /> | ||
</div> | ||
</TxSheet> | ||
); | ||
} |
This file contains 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 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 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 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,22 @@ | ||
"use client"; | ||
|
||
import { Sheet, SheetContent } from "@/components/ui/sheet"; | ||
import { useRouter } from "next/navigation"; | ||
import { PropsWithChildren } from "react"; | ||
|
||
export default function TxSheet({ children }: PropsWithChildren) { | ||
const router = useRouter(); | ||
|
||
return ( | ||
<Sheet | ||
defaultOpen | ||
onOpenChange={(open) => { | ||
if (!open) { | ||
router.back(); | ||
} | ||
}} | ||
> | ||
<SheetContent className="min-w-[80%]">{children}</SheetContent> | ||
</Sheet> | ||
); | ||
} |