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
6cb94da4
Commit
6cb94da4
authored
May 04, 2023
by
isstuev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
watchlist txs homepage
parent
ae98d50c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
5 deletions
+64
-5
resources.ts
lib/api/resources.ts
+4
-0
LatestWatchlistTxs.tsx
ui/home/LatestWatchlistTxs.tsx
+44
-0
Transactions.tsx
ui/home/Transactions.tsx
+16
-5
No files found.
lib/api/resources.ts
View file @
6cb94da4
...
@@ -375,6 +375,9 @@ export const RESOURCES = {
...
@@ -375,6 +375,9 @@ export const RESOURCES = {
homepage_txs
:
{
homepage_txs
:
{
path
:
'
/api/v2/main-page/transactions
'
,
path
:
'
/api/v2/main-page/transactions
'
,
},
},
homepage_txs_watchlist
:
{
path
:
'
/api/v2/main-page/transactions/watchlist
'
,
},
homepage_indexing_status
:
{
homepage_indexing_status
:
{
path
:
'
/api/v2/main-page/indexing-status
'
,
path
:
'
/api/v2/main-page/indexing-status
'
,
},
},
...
@@ -523,6 +526,7 @@ Q extends 'homepage_chart_txs' ? ChartTransactionResponse :
...
@@ -523,6 +526,7 @@ Q extends 'homepage_chart_txs' ? ChartTransactionResponse :
Q
extends
'
homepage_chart_market
'
?
ChartMarketResponse
:
Q
extends
'
homepage_chart_market
'
?
ChartMarketResponse
:
Q
extends
'
homepage_blocks
'
?
Array
<
Block
>
:
Q
extends
'
homepage_blocks
'
?
Array
<
Block
>
:
Q
extends
'
homepage_txs
'
?
Array
<
Transaction
>
:
Q
extends
'
homepage_txs
'
?
Array
<
Transaction
>
:
Q
extends
'
homepage_txs_watchlist
'
?
Array
<
Transaction
>
:
Q
extends
'
homepage_deposits
'
?
Array
<
L2DepositsItem
>
:
Q
extends
'
homepage_deposits
'
?
Array
<
L2DepositsItem
>
:
Q
extends
'
homepage_indexing_status
'
?
IndexingStatus
:
Q
extends
'
homepage_indexing_status
'
?
IndexingStatus
:
Q
extends
'
stats_counters
'
?
Counters
:
Q
extends
'
stats_counters
'
?
Counters
:
...
...
ui/home/LatestWatchlistTxs.tsx
0 → 100644
View file @
6cb94da4
import
{
Box
,
Flex
,
Text
}
from
'
@chakra-ui/react
'
;
import
{
route
}
from
'
nextjs-routes
'
;
import
React
from
'
react
'
;
import
useApiQuery
from
'
lib/api/useApiQuery
'
;
import
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
import
useRedirectForInvalidAuthToken
from
'
lib/hooks/useRedirectForInvalidAuthToken
'
;
import
LinkInternal
from
'
ui/shared/LinkInternal
'
;
import
LatestTxsItem
from
'
./LatestTxsItem
'
;
import
LatestTxsItemSkeleton
from
'
./LatestTxsItemSkeleton
'
;
const
LatestWatchlistTxs
=
()
=>
{
useRedirectForInvalidAuthToken
();
const
isMobile
=
useIsMobile
();
const
txsCount
=
isMobile
?
2
:
6
;
const
{
data
,
isLoading
,
isError
}
=
useApiQuery
(
'
homepage_txs_watchlist
'
);
if
(
isLoading
)
{
return
<>
{
Array
.
from
(
Array
(
txsCount
)).
map
((
item
,
index
)
=>
<
LatestTxsItemSkeleton
key=
{
index
}
/>)
}
</>;
}
if
(
isError
)
{
return
<
Text
mt=
{
4
}
>
No data. Please reload page.
</
Text
>;
}
if
(
data
)
{
const
txsUrl
=
route
({
pathname
:
'
/txs
'
,
query
:
{
tab
:
'
watchlist
'
}
});
return
(
<>
<
Box
mb=
{
{
base
:
3
,
lg
:
4
}
}
>
{
data
.
slice
(
0
,
txsCount
).
map
((
tx
=>
<
LatestTxsItem
key=
{
tx
.
hash
}
tx=
{
tx
}
/>))
}
</
Box
>
<
Flex
justifyContent=
"center"
>
<
LinkInternal
fontSize=
"sm"
href=
{
txsUrl
}
>
View all watchlist transactions
</
LinkInternal
>
</
Flex
>
</>
);
}
return
null
;
};
export
default
LatestWatchlistTxs
;
ui/home/Transactions.tsx
View file @
6cb94da4
...
@@ -2,26 +2,37 @@ import { Heading, Tab, Tabs, TabList, TabPanel, TabPanels } from '@chakra-ui/rea
...
@@ -2,26 +2,37 @@ import { Heading, Tab, Tabs, TabList, TabPanel, TabPanels } from '@chakra-ui/rea
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
appConfig
from
'
configs/app/config
'
;
import
appConfig
from
'
configs/app/config
'
;
import
useHasAccount
from
'
lib/hooks/useHasAccount
'
;
import
LatestDeposits
from
'
ui/home/LatestDeposits
'
;
import
LatestDeposits
from
'
ui/home/LatestDeposits
'
;
import
LatestTxs
from
'
ui/home/LatestTxs
'
;
import
LatestTxs
from
'
ui/home/LatestTxs
'
;
import
LatestWatchlistTxs
from
'
ui/home/LatestWatchlistTxs
'
;
const
TransactionsHome
=
()
=>
{
const
TransactionsHome
=
()
=>
{
if
(
appConfig
.
L2
.
isL2Network
)
{
const
hasAccount
=
useHasAccount
();
if
(
appConfig
.
L2
.
isL2Network
||
hasAccount
)
{
return
(
return
(
<>
<>
<
Heading
as=
"h4"
size=
"sm"
mb=
{
4
}
>
Transactions
</
Heading
>
<
Heading
as=
"h4"
size=
"sm"
mb=
{
4
}
>
Transactions
</
Heading
>
<
Tabs
isLazy
lazyBehavior=
"keepMounted"
defaultIndex=
{
0
}
variant=
"soft-rounded"
>
<
Tabs
isLazy
lazyBehavior=
"keepMounted"
defaultIndex=
{
0
}
variant=
"soft-rounded"
>
<
TabList
>
<
TabList
>
<
Tab
key=
"txn"
>
Latest txn
</
Tab
>
<
Tab
key=
"txn"
>
Latest txn
</
Tab
>
<
Tab
key=
"deposits"
>
Deposits (L1→L2 txn)
</
Tab
>
{
appConfig
.
L2
.
isL2Network
&&
<
Tab
key=
"deposits"
>
Deposits (L1→L2 txn)
</
Tab
>
}
{
hasAccount
&&
<
Tab
key=
"deposits"
>
Watch list
</
Tab
>
}
</
TabList
>
</
TabList
>
<
TabPanels
mt=
{
4
}
>
<
TabPanels
mt=
{
4
}
>
<
TabPanel
key=
"txn"
p=
{
0
}
>
<
TabPanel
key=
"txn"
p=
{
0
}
>
<
LatestTxs
/>
<
LatestTxs
/>
</
TabPanel
>
</
TabPanel
>
{
appConfig
.
L2
.
isL2Network
&&
(
<
TabPanel
key=
"deposits"
p=
{
0
}
>
<
TabPanel
key=
"deposits"
p=
{
0
}
>
<
LatestDeposits
/>
<
LatestDeposits
/>
</
TabPanel
>
</
TabPanel
>
)
}
{
hasAccount
&&
(
<
TabPanel
key=
"deposits"
p=
{
0
}
>
<
LatestWatchlistTxs
/>
</
TabPanel
>
)
}
</
TabPanels
>
</
TabPanels
>
</
Tabs
>
</
Tabs
>
</>
</>
...
...
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