Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
frontend
Commits
0bc1b865
Commit
0bc1b865
authored
Sep 07, 2022
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
common solution for next pages
parent
c86070a2
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
72 additions
and
54 deletions
+72
-54
getNetworkTitle.ts
lib/networks/getNetworkTitle.ts
+1
-1
getStaticProps.ts
lib/next/getStaticProps.ts
+9
-0
TransactionNextPage.tsx
lib/next/tx/TransactionNextPage.tsx
+27
-0
getSeo.ts
lib/next/tx/getSeo.ts
+12
-0
getStaticPaths.ts
lib/next/tx/getStaticPaths.ts
+5
-0
types.ts
lib/next/tx/types.ts
+5
-0
index.tsx
pages/[network_type]/[network_sub_type]/tx/[id]/index.tsx
+6
-25
internal-transactions.tsx
...ype]/[network_sub_type]/tx/[id]/internal-transactions.tsx
+6
-27
Transaction.tsx
ui/pages/Transaction.tsx
+1
-1
No files found.
lib/networks/getNetworkTitle.ts
View file @
0bc1b865
import
NETWORKS
from
'
./availableNetworks
'
;
export
default
function
getNetworkTitle
({
network_type
:
type
,
network_sub_type
:
subType
}:
{
network_type
:
string
;
network_sub_type
:
string
})
{
export
default
function
getNetworkTitle
({
network_type
:
type
,
network_sub_type
:
subType
}:
{
network_type
?:
string
;
network_sub_type
?
:
string
})
{
const
currentNetwork
=
NETWORKS
.
find
(
n
=>
n
.
type
===
type
&&
n
.
subType
===
subType
);
if
(
currentNetwork
)
{
return
currentNetwork
.
name
+
(
currentNetwork
.
shortName
?
` (
${
currentNetwork
.
shortName
}
)`
:
''
)
+
'
Explorer
'
;
...
...
lib/next/getStaticProps.ts
0 → 100644
View file @
0bc1b865
import
type
{
GetStaticProps
,
GetStaticPropsResult
}
from
'
next
'
;
export
const
getStaticProps
:
GetStaticProps
=
async
(
context
):
Promise
<
GetStaticPropsResult
<
{
[
key
:
string
]:
unknown
}
>>
=>
{
return
{
props
:
{
pageParams
:
context
.
params
,
},
};
};
lib/next/tx/TransactionNextPage.tsx
0 → 100644
View file @
0bc1b865
import
type
{
NextPage
}
from
'
next
'
;
import
Head
from
'
next/head
'
;
import
React
from
'
react
'
;
import
type
{
PageParams
}
from
'
./types
'
;
import
type
{
Props
as
TransactionProps
}
from
'
ui/pages/Transaction
'
;
import
Transaction
from
'
ui/pages/Transaction
'
;
import
getSeo
from
'
./getSeo
'
;
type
Props
=
{
pageParams
:
PageParams
;
tab
:
TransactionProps
[
'
tab
'
];
}
const
TransactionNextPage
:
NextPage
<
Props
>
=
({
pageParams
,
tab
}:
Props
)
=>
{
const
{
title
}
=
getSeo
(
pageParams
);
return
(
<>
<
Head
><
title
>
{
title
}
</
title
></
Head
>
<
Transaction
tab=
{
tab
}
/>
</>
);
};
export
default
TransactionNextPage
;
lib/next/tx/getSeo.ts
0 → 100644
View file @
0bc1b865
import
type
{
PageParams
}
from
'
./types
'
;
import
getNetworkTitle
from
'
lib/networks/getNetworkTitle
'
;
export
default
function
getSeo
(
params
?:
PageParams
)
{
const
networkTitle
=
getNetworkTitle
(
params
||
{});
return
{
title
:
params
?
`Transaction
${
params
.
id
}
-
${
networkTitle
}
`
:
''
,
description
:
params
?
`View transaction
${
params
.
id
}
on
${
networkTitle
}
`
:
''
,
};
}
lib/next/tx/getStaticPaths.ts
0 → 100644
View file @
0bc1b865
import
type
{
GetStaticPaths
}
from
'
next
'
;
export
const
getStaticPaths
:
GetStaticPaths
=
async
()
=>
{
return
{
paths
:
[],
fallback
:
true
};
};
lib/next/tx/types.ts
0 → 100644
View file @
0bc1b865
export
type
PageParams
=
{
network_type
:
string
;
network_sub_type
:
string
;
id
:
string
;
}
pages/[network_type]/[network_sub_type]/tx/[id]/index.tsx
View file @
0bc1b865
import
type
{
NextPage
,
GetStaticPaths
,
GetStaticProps
,
GetStaticPropsResult
}
from
'
next
'
;
import
Head
from
'
next/head
'
;
import
type
{
NextPage
}
from
'
next
'
;
import
React
from
'
react
'
;
import
getNetworkTitle
from
'
lib/networks/getNetworkTitle
'
;
import
Transaction
from
'
ui/pages/Transaction
'
;
import
type
{
PageParams
}
from
'
lib/next/tx/types
'
;
type
PageParams
=
{
network_type
:
string
;
network_sub_type
:
string
;
id
:
string
;
}
import
TransactionNextPage
from
'
lib/next/tx/TransactionNextPage
'
;
type
Props
=
{
pageParams
:
PageParams
;
}
const
TransactionPage
:
NextPage
<
Props
>
=
({
pageParams
}:
Props
)
=>
{
const
title
=
getNetworkTitle
(
pageParams
||
{});
return
(
<>
<
Head
><
title
>
{
title
}
</
title
></
Head
>
<
Transaction
tab=
"details"
/>
</>
<
TransactionNextPage
tab=
"details"
pageParams=
{
pageParams
}
/>
);
};
export
default
TransactionPage
;
export
const
getStaticPaths
:
GetStaticPaths
=
async
()
=>
{
return
{
paths
:
[],
fallback
:
true
};
};
export
const
getStaticProps
:
GetStaticProps
=
async
(
context
):
Promise
<
GetStaticPropsResult
<
Props
>>
=>
{
return
{
props
:
{
pageParams
:
context
.
params
as
PageParams
,
},
};
};
export
{
getStaticPaths
}
from
'
lib/next/tx/getStaticPaths
'
;
export
{
getStaticProps
}
from
'
lib/next/getStaticProps
'
;
pages/[network_type]/[network_sub_type]/tx/[id]/internal-transactions.tsx
View file @
0bc1b865
import
type
{
NextPage
,
GetStaticPaths
,
GetStaticProps
,
GetStaticPropsResult
}
from
'
next
'
;
import
Head
from
'
next/head
'
;
import
type
{
NextPage
}
from
'
next
'
;
import
React
from
'
react
'
;
import
getNetworkTitle
from
'
lib/networks/getNetworkTitle
'
;
import
Transaction
from
'
ui/pages/Transaction
'
;
import
type
{
PageParams
}
from
'
lib/next/tx/types
'
;
type
PageParams
=
{
network_type
:
string
;
network_sub_type
:
string
;
id
:
string
;
}
import
TransactionNextPage
from
'
lib/next/tx/TransactionNextPage
'
;
type
Props
=
{
pageParams
:
PageParams
;
}
const
TransactionPage
:
NextPage
<
Props
>
=
({
pageParams
}:
Props
)
=>
{
const
title
=
getNetworkTitle
(
pageParams
||
{});
return
(
<>
<
Head
><
title
>
{
title
}
</
title
></
Head
>
<
Transaction
tab=
"internal_txn"
/>
</>
);
return
<
TransactionNextPage
pageParams=
{
pageParams
}
tab=
"internal_txn"
/>;
};
export
default
TransactionPage
;
export
const
getStaticPaths
:
GetStaticPaths
=
async
()
=>
{
return
{
paths
:
[],
fallback
:
true
};
};
export
const
getStaticProps
:
GetStaticProps
=
async
(
context
):
Promise
<
GetStaticPropsResult
<
Props
>>
=>
{
return
{
props
:
{
pageParams
:
context
.
params
as
PageParams
,
},
};
};
export
{
getStaticPaths
}
from
'
lib/next/tx/getStaticPaths
'
;
export
{
getStaticProps
}
from
'
lib/next/getStaticProps
'
;
ui/pages/Transaction.tsx
View file @
0bc1b865
...
...
@@ -22,7 +22,7 @@ const TABS: Array<Tab> = [
{
type
:
'
internal_txn
'
,
path
:
'
/internal-transactions
'
,
name
:
'
Internal txn
'
},
];
interface
Props
{
export
interface
Props
{
tab
:
Tab
[
'
type
'
];
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment