unauthorized check

pull/480/head
Tim Pechersky 2021-12-06 17:46:03 +00:00
rodzic 86c5849a4a
commit e6251367be
1 zmienionych plików z 18 dodań i 11 usunięć

Wyświetl plik

@ -1,11 +1,14 @@
import React from "react"; import React, { useContext } from "react";
import { useStatus } from "../../src/core/hooks"; import { useStatus } from "../../src/core/hooks";
import { Heading, Text, Flex, Spacer, chakra, Spinner } from "@chakra-ui/react"; import { Heading, Text, Flex, Spacer, chakra, Spinner } from "@chakra-ui/react";
import { getLayout, getLayoutProps } from "../../src/layouts/InfoPageLayout"; import { getLayout, getLayoutProps } from "../../src/layouts/InfoPageLayout";
import UserContext from "../../src/core/providers/UserProvider/context";
const Status = () => { const Status = () => {
const user = useContext(UserContext);
const healthyStatusText = "Available"; const healthyStatusText = "Available";
const downStatusText = "Unavailable"; const downStatusText = "Unavailable";
const unauthorizedText = "Please login";
const healthyStatusColor = "green.900"; const healthyStatusColor = "green.900";
const downStatusColor = "red.600"; const downStatusColor = "red.600";
@ -106,11 +109,13 @@ const Status = () => {
</StatusRow> </StatusRow>
<StatusRow title="Txpool latest record ts" cache={crawlersStatusCache}> <StatusRow title="Txpool latest record ts" cache={crawlersStatusCache}>
<Text> <Text>
{crawlersStatusCache?.data?.ethereum_txpool_timestamp {!user
? shortTimestamp( ? crawlersStatusCache?.data?.ethereum_txpool_timestamp
crawlersStatusCache?.data?.ethereum_txpool_timestamp ? shortTimestamp(
) crawlersStatusCache?.data?.ethereum_txpool_timestamp
: downStatusText} )
: downStatusText
: unauthorizedText}
</Text> </Text>
</StatusRow> </StatusRow>
<StatusRow <StatusRow
@ -118,11 +123,13 @@ const Status = () => {
cache={crawlersStatusCache} cache={crawlersStatusCache}
> >
<Text> <Text>
{crawlersStatusCache?.data?.ethereum_trending_timestamp {!user
? shortTimestamp( ? crawlersStatusCache?.data?.ethereum_trending_timestamp
crawlersStatusCache?.data?.ethereum_trending_timestamp ? shortTimestamp(
) crawlersStatusCache?.data?.ethereum_trending_timestamp
: downStatusText} )
: downStatusText
: unauthorizedText}
</Text> </Text>
</StatusRow> </StatusRow>