Skip to content

Commit

Permalink
fix: url to inner transaction when viewing groups (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrickDinh authored May 1, 2024
1 parent a6b4e94 commit b36918d
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@
>
<a
class="text-primary underline"
href="/explore/transaction/VE767RE4HGQM7GFC7MUVY3J67KOR5TV34OBTDDEQTDET2UFM7KTQ/inner/1"
href="/explore/transaction/INDQXWQXHF22SO45EZY7V6FFNI6WUD5FHRVDV6NCU6HD424BJGGA/inner/1"
>
Inner 1
</a>
Expand Down Expand Up @@ -419,7 +419,7 @@
>
<a
class="text-primary underline"
href="/explore/transaction/VE767RE4HGQM7GFC7MUVY3J67KOR5TV34OBTDDEQTDET2UFM7KTQ/inner/2"
href="/explore/transaction/INDQXWQXHF22SO45EZY7V6FFNI6WUD5FHRVDV6NCU6HD424BJGGA/inner/2"
>
Inner 2
</a>
Expand Down Expand Up @@ -532,7 +532,7 @@
>
<a
class="text-primary underline"
href="/explore/transaction/VE767RE4HGQM7GFC7MUVY3J67KOR5TV34OBTDDEQTDET2UFM7KTQ/inner/2-1"
href="/explore/transaction/INDQXWQXHF22SO45EZY7V6FFNI6WUD5FHRVDV6NCU6HD424BJGGA/inner/2-1"
>
Inner 2-1
</a>
Expand Down Expand Up @@ -641,7 +641,7 @@
>
<a
class="text-primary underline"
href="/explore/transaction/VE767RE4HGQM7GFC7MUVY3J67KOR5TV34OBTDDEQTDET2UFM7KTQ/inner/3"
href="/explore/transaction/INDQXWQXHF22SO45EZY7V6FFNI6WUD5FHRVDV6NCU6HD424BJGGA/inner/3"
>
Inner 3
</a>
Expand Down Expand Up @@ -752,7 +752,7 @@
>
<a
class="text-primary underline"
href="/explore/transaction/VE767RE4HGQM7GFC7MUVY3J67KOR5TV34OBTDDEQTDET2UFM7KTQ/inner/4"
href="/explore/transaction/INDQXWQXHF22SO45EZY7V6FFNI6WUD5FHRVDV6NCU6HD424BJGGA/inner/4"
>
Inner 4
</a>
Expand Down Expand Up @@ -865,7 +865,7 @@
>
<a
class="text-primary underline"
href="/explore/transaction/VE767RE4HGQM7GFC7MUVY3J67KOR5TV34OBTDDEQTDET2UFM7KTQ/inner/4-1"
href="/explore/transaction/INDQXWQXHF22SO45EZY7V6FFNI6WUD5FHRVDV6NCU6HD424BJGGA/inner/4-1"
>
Inner 4-1
</a>
Expand Down Expand Up @@ -972,7 +972,7 @@
>
<a
class="text-primary underline"
href="/explore/transaction/VE767RE4HGQM7GFC7MUVY3J67KOR5TV34OBTDDEQTDET2UFM7KTQ/inner/5"
href="/explore/transaction/INDQXWQXHF22SO45EZY7V6FFNI6WUD5FHRVDV6NCU6HD424BJGGA/inner/5"
>
Inner 5
</a>
Expand Down Expand Up @@ -1082,7 +1082,7 @@
>
<a
class="text-primary underline"
href="/explore/transaction/VE767RE4HGQM7GFC7MUVY3J67KOR5TV34OBTDDEQTDET2UFM7KTQ/inner/6"
href="/explore/transaction/INDQXWQXHF22SO45EZY7V6FFNI6WUD5FHRVDV6NCU6HD424BJGGA/inner/6"
>
Inner 6
</a>
Expand Down Expand Up @@ -1195,7 +1195,7 @@
>
<a
class="text-primary underline"
href="/explore/transaction/VE767RE4HGQM7GFC7MUVY3J67KOR5TV34OBTDDEQTDET2UFM7KTQ/inner/6-1"
href="/explore/transaction/INDQXWQXHF22SO45EZY7V6FFNI6WUD5FHRVDV6NCU6HD424BJGGA/inner/6-1"
>
Inner 6-1
</a>
Expand Down Expand Up @@ -1301,7 +1301,7 @@
>
<a
class="text-primary underline"
href="/explore/transaction/VE767RE4HGQM7GFC7MUVY3J67KOR5TV34OBTDDEQTDET2UFM7KTQ/inner/7"
href="/explore/transaction/INDQXWQXHF22SO45EZY7V6FFNI6WUD5FHRVDV6NCU6HD424BJGGA/inner/7"
>
Inner 7
</a>
Expand Down Expand Up @@ -1410,7 +1410,7 @@
>
<a
class="text-primary underline"
href="/explore/transaction/VE767RE4HGQM7GFC7MUVY3J67KOR5TV34OBTDDEQTDET2UFM7KTQ/inner/8"
href="/explore/transaction/INDQXWQXHF22SO45EZY7V6FFNI6WUD5FHRVDV6NCU6HD424BJGGA/inner/8"
>
Inner 8
</a>
Expand Down Expand Up @@ -1519,7 +1519,7 @@
>
<a
class="text-primary underline"
href="/explore/transaction/VE767RE4HGQM7GFC7MUVY3J67KOR5TV34OBTDDEQTDET2UFM7KTQ/inner/8-1"
href="/explore/transaction/INDQXWQXHF22SO45EZY7V6FFNI6WUD5FHRVDV6NCU6HD424BJGGA/inner/8-1"
>
Inner 8-1
</a>
Expand Down Expand Up @@ -1642,7 +1642,7 @@
>
<a
class="text-primary underline"
href="/explore/transaction/VE767RE4HGQM7GFC7MUVY3J67KOR5TV34OBTDDEQTDET2UFM7KTQ/inner/9"
href="/explore/transaction/INDQXWQXHF22SO45EZY7V6FFNI6WUD5FHRVDV6NCU6HD424BJGGA/inner/9"
>
Inner 9
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,20 @@ import { Urls } from '@/routes/urls'
import { PropsWithChildren } from 'react'

type Props = PropsWithChildren<{
transactionId: string
innerTransactionId: string
className?: string
}>

export function InnerTransactionLink({ innerTransactionId, className, children }: Props) {
export function InnerTransactionLink({ transactionId, innerTransactionId, className, children }: Props) {
return (
<TemplatedNavLink
className={cn(!children && 'text-primary underline', className)}
urlTemplate={Urls.Explore.Transaction.ById.Inner.ById}
urlParams={{ innerTransactionId: innerTransactionId }}
urlParams={{
transactionId: transactionId,
innerTransactionId: innerTransactionId,
}}
>
{children ? children : `Inner ${innerTransactionId}`}
</TemplatedNavLink>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ function ConnectionToParent() {
function TransactionId({ hasParent, transaction }: { hasParent: boolean; transaction: Transaction | InnerTransaction }) {
const component = useMemo(() => {
if ('innerId' in transaction) {
return <InnerTransactionLink innerTransactionId={transaction.innerId} />
return <InnerTransactionLink transactionId={transaction.networkTransactionId} innerTransactionId={transaction.innerId} />
}
return <TransactionLink transactionId={transaction.id} short={true} />
}, [transaction])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const transactionsTableColumns: ColumnDef<FlattenedTransaction>[] = [
}}
>
{'innerId' in transaction ? (
<InnerTransactionLink innerTransactionId={transaction.innerId} />
<InnerTransactionLink transactionId={transaction.networkTransactionId} innerTransactionId={transaction.innerId} />
) : (
<TransactionLink transactionId={transaction.id} short={true} />
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ const asJson = (transactionResult: TransactionResult) =>

export const asInnerTransactionId = (networkTransactionId: string, index: string): InnerTransactionId => {
return {
networkTransactionId: networkTransactionId,
id: `${networkTransactionId}-${index}`,
innerId: index,
}
Expand Down
1 change: 1 addition & 0 deletions src/features/transactions/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ export enum AppCallOnComplete {
}

export type InnerTransactionId = {
networkTransactionId: string
id: string
innerId: string
}
Expand Down

0 comments on commit b36918d

Please sign in to comment.