diff --git a/frontend/src/components/EntriesNavigation.js b/frontend/src/components/EntriesNavigation.js index ce3a5701..2b6a7409 100644 --- a/frontend/src/components/EntriesNavigation.js +++ b/frontend/src/components/EntriesNavigation.js @@ -400,16 +400,14 @@ const EntriesNavigation = () => { className="ScrollableWrapper" w="100%" overflowY="hidden" - // maxH="100%" h="calc(100% - 3rem)" > handleScroll(e)} > diff --git a/frontend/src/components/StreamEntry.js b/frontend/src/components/StreamEntry.js index a3a7ee5e..29caf93e 100644 --- a/frontend/src/components/StreamEntry.js +++ b/frontend/src/components/StreamEntry.js @@ -1,99 +1,350 @@ -import React, { useContext } from "react"; -import { Flex, Text, IconButton, Tag } from "@chakra-ui/react"; +import React, { useContext, useEffect, useState } from "react"; +import { + Flex, + Text, + IconButton, + Stack, + Tooltip, + useClipboard, + Heading, + Image, + useMediaQuery, +} from "@chakra-ui/react"; import moment from "moment"; -import { ViewIcon } from "@chakra-ui/icons"; +import { ArrowRightIcon } from "@chakra-ui/icons"; import { useRouter } from "../core/hooks"; import UIContext from "../core/providers/UIProvider/context"; +import { useToast } from "../core/hooks"; const StreamEntry = ({ entry, filterCallback, filterConstants }) => { const ui = useContext(UIContext); const router = useRouter(); + const [copyString, setCopyString] = useState(false); + const { onCopy, hasCopied } = useClipboard(copyString, 1); + const toast = useToast(); + + useEffect(() => { + if (hasCopied && copyString) { + toast("Copied to clipboard", "success"); + setCopyString(false); + } else if (copyString) { + onCopy(); + } + }, [copyString, onCopy, hasCopied, toast]); const handleViewClicked = (entryId) => { ui.setEntryId(entryId); ui.setEntriesViewMode("entry"); router.push({ - pathname: `/stream/${entry.hash}`, + pathname: `/stream/${entry.id}`, query: router.query, }); }; + + const [showFullView] = useMediaQuery(["(min-width: 420px)"]); + return ( - - - filterCallback({ - direction: filterConstants.DIRECTIONS.SOURCE, - type: filterConstants.FILTER_TYPES.ADDRESS, - value: entry.from_address, - conditon: filterConstants.CONDITION.EQUAL, - }) - } - > - {"From:"} - {`${entry.from_label} - ${entry.from_address}`} - {" "} - - filterCallback({ - direction: filterConstants.DIRECTIONS.DESTINATION, - type: filterConstants.FILTER_TYPES.ADDRESS, - value: entry.to_address, - conditon: filterConstants.CONDITION.EQUAL, - }) - } - > - {"To:"} - {`${entry.to_label} - ${entry.to_address}`} - {" "} - - Gas Price: {entry.gasPrice} - - - Gas: {entry.gas} - - - Value: {entry.value} - - - - - {moment(entry.created_at).format("DD MMM, YYYY, h:mm:ss")}{" "} - - } - onClick={() => handleViewClicked(entry)} - /> + + {true && ( + + + + Ethereum blockhain + + + + + From: + + + setCopyString(entry.from_address)} + > + {entry.from_label ?? entry.from_address} + + + + + + To: + + + setCopyString(entry.to_address)} + > + {entry.to_label ?? entry.to_address} + + + + + + + + Gas Price: + + + setCopyString(entry.gasPrice)} + > + {entry.gasPrice} + + + + + + Gas: + + + setCopyString(entry.gas)} + > + {entry.gas} + + + + + + Value: + + + setCopyString(entry.value)} + > + {entry.value} + + + + {entry.timestamp && ( + + + {moment(entry.timestamp) + // .format("DD MMM, YYYY, h:mm:ss") + .fromNow()}{" "} + + + )} + + + )} + + handleViewClicked(entry)} + h="full" + // minH="24px" + borderLeftRadius={0} + variant="solid" + px={0} + minW="24px" + colorScheme="suggested" + icon={} + /> + + ); };