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
b2264707
Commit
b2264707
authored
Aug 15, 2022
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add delay for data fetching (for demo purposes only)
parent
ebe14f97
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
5 deletions
+16
-5
private-tags.tsx
pages/[network_type]/[network_sub_type]/private-tags.tsx
+9
-2
ApiKeys.tsx
ui/pages/ApiKeys.tsx
+5
-1
PrivateAddressTags.tsx
ui/privateTags/PrivateAddressTags.tsx
+1
-1
PrivateTransactionTags.tsx
ui/privateTags/PrivateTransactionTags.tsx
+1
-1
No files found.
pages/[network_type]/[network_sub_type]/private-tags.tsx
View file @
b2264707
...
@@ -6,6 +6,7 @@ import React, { useCallback, useState } from 'react';
...
@@ -6,6 +6,7 @@ import React, { useCallback, useState } from 'react';
import
PrivateTags
from
'
ui/pages/PrivateTags
'
;
import
PrivateTags
from
'
ui/pages/PrivateTags
'
;
const
TABS
=
[
'
address
'
,
'
transaction
'
];
const
TABS
=
[
'
address
'
,
'
transaction
'
];
const
artificialDelay
=
new
Promise
((
resolve
)
=>
window
.
setTimeout
(
resolve
,
5000
));
const
PrivateTagsPage
:
NextPage
=
()
=>
{
const
PrivateTagsPage
:
NextPage
=
()
=>
{
const
[
activeTab
,
setActiveTab
]
=
useState
(
TABS
[
0
]);
const
[
activeTab
,
setActiveTab
]
=
useState
(
TABS
[
0
]);
...
@@ -19,7 +20,10 @@ const PrivateTagsPage: NextPage = () => {
...
@@ -19,7 +20,10 @@ const PrivateTagsPage: NextPage = () => {
// FIXME: request data only for active tab and only once
// FIXME: request data only for active tab and only once
// don't refetch after tab change
// don't refetch after tab change
useQuery
([
'
address
'
],
async
()
=>
{
useQuery
([
'
address
'
],
async
()
=>
{
const
response
=
await
fetch
(
'
/api/account/private-tags/address
'
);
const
[
response
]
=
await
Promise
.
all
([
fetch
(
'
/api/account/private-tags/address
'
),
artificialDelay
,
]);
if
(
!
response
.
ok
)
{
if
(
!
response
.
ok
)
{
throw
new
Error
(
'
Network response was not ok
'
);
throw
new
Error
(
'
Network response was not ok
'
);
}
}
...
@@ -27,7 +31,10 @@ const PrivateTagsPage: NextPage = () => {
...
@@ -27,7 +31,10 @@ const PrivateTagsPage: NextPage = () => {
});
});
useQuery
([
'
transaction
'
],
async
()
=>
{
useQuery
([
'
transaction
'
],
async
()
=>
{
const
response
=
await
fetch
(
'
/api/account/private-tags/transaction
'
);
const
[
response
]
=
await
Promise
.
all
([
fetch
(
'
/api/account/private-tags/transaction
'
),
artificialDelay
,
]);
if
(
!
response
.
ok
)
{
if
(
!
response
.
ok
)
{
throw
new
Error
(
'
Network response was not ok
'
);
throw
new
Error
(
'
Network response was not ok
'
);
}
}
...
...
ui/pages/ApiKeys.tsx
View file @
b2264707
...
@@ -13,6 +13,7 @@ import Page from 'ui/shared/Page/Page';
...
@@ -13,6 +13,7 @@ import Page from 'ui/shared/Page/Page';
import
SkeletonTable
from
'
ui/shared/SkeletonTable
'
;
import
SkeletonTable
from
'
ui/shared/SkeletonTable
'
;
const
DATA_LIMIT
=
3
;
const
DATA_LIMIT
=
3
;
const
artificialDelay
=
new
Promise
((
resolve
)
=>
window
.
setTimeout
(
resolve
,
5000
));
const
ApiKeysPage
:
React
.
FC
=
()
=>
{
const
ApiKeysPage
:
React
.
FC
=
()
=>
{
const
apiKeyModalProps
=
useDisclosure
();
const
apiKeyModalProps
=
useDisclosure
();
...
@@ -22,7 +23,10 @@ const ApiKeysPage: React.FC = () => {
...
@@ -22,7 +23,10 @@ const ApiKeysPage: React.FC = () => {
const
[
deleteModalData
,
setDeleteModalData
]
=
useState
<
ApiKey
>
();
const
[
deleteModalData
,
setDeleteModalData
]
=
useState
<
ApiKey
>
();
const
{
data
,
isLoading
,
isError
}
=
useQuery
<
unknown
,
unknown
,
ApiKeys
>
([
'
api-keys
'
],
async
()
=>
{
const
{
data
,
isLoading
,
isError
}
=
useQuery
<
unknown
,
unknown
,
ApiKeys
>
([
'
api-keys
'
],
async
()
=>
{
const
response
=
await
fetch
(
'
/api/account/api-keys
'
);
const
[
response
]
=
await
Promise
.
all
([
fetch
(
'
/api/account/api-keys
'
),
artificialDelay
,
]);
if
(
!
response
.
ok
)
{
if
(
!
response
.
ok
)
{
throw
new
Error
(
'
Network response was not ok
'
);
throw
new
Error
(
'
Network response was not ok
'
);
}
}
...
...
ui/privateTags/PrivateAddressTags.tsx
View file @
b2264707
...
@@ -44,7 +44,7 @@ const PrivateAddressTags = ({ addressTags }: Props) => {
...
@@ -44,7 +44,7 @@ const PrivateAddressTags = ({ addressTags }: Props) => {
return
(
return
(
<>
<>
<
Skeleton
height=
{
6
}
width=
"250px"
borderRadius=
"full"
marginBottom=
{
12
}
/>
<
Skeleton
height=
{
6
}
width=
"250px"
borderRadius=
"full"
marginBottom=
{
12
}
/>
<
SkeletonTable
columns=
{
[
'
auto
'
,
'
40%
'
,
'
108px
'
]
}
/>
<
SkeletonTable
columns=
{
[
'
60%
'
,
'
40%
'
,
'
108px
'
]
}
/>
<
Skeleton
height=
"44px"
width=
"156px"
marginTop=
{
8
}
/>
<
Skeleton
height=
"44px"
width=
"156px"
marginTop=
{
8
}
/>
</>
</>
);
);
...
...
ui/privateTags/PrivateTransactionTags.tsx
View file @
b2264707
...
@@ -44,7 +44,7 @@ const PrivateTransactionTags = ({ transactionTags }: Props) => {
...
@@ -44,7 +44,7 @@ const PrivateTransactionTags = ({ transactionTags }: Props) => {
return
(
return
(
<>
<>
<
Skeleton
height=
{
6
}
width=
"250px"
borderRadius=
"full"
marginBottom=
{
12
}
/>
<
Skeleton
height=
{
6
}
width=
"250px"
borderRadius=
"full"
marginBottom=
{
12
}
/>
<
SkeletonTable
columns=
{
[
'
auto
'
,
'
25%
'
,
'
108px
'
]
}
/>
<
SkeletonTable
columns=
{
[
'
75%
'
,
'
25%
'
,
'
108px
'
]
}
/>
<
Skeleton
height=
"44px"
width=
"156px"
marginTop=
{
8
}
/>
<
Skeleton
height=
"44px"
width=
"156px"
marginTop=
{
8
}
/>
</>
</>
);
);
...
...
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