-
Notifications
You must be signed in to change notification settings - Fork 479
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2284 from blockscout/fe-2245
Graph integration
- Loading branch information
Showing
27 changed files
with
143 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { useQuery } from '@tanstack/react-query'; | ||
|
||
import config from 'configs/app'; | ||
import type { ResourceError } from 'lib/api/resources'; | ||
import useFetch from 'lib/hooks/useFetch'; | ||
|
||
const feature = config.features.marketplace; | ||
|
||
export default function useGraphLinks() { | ||
const fetch = useFetch(); | ||
|
||
return useQuery<unknown, ResourceError<unknown>, Record<string, Array<{text: string; url: string}>>>({ | ||
queryKey: [ 'graph-links' ], | ||
queryFn: async() => fetch((feature.isEnabled && feature.graphLinksUrl) ? feature.graphLinksUrl : '', undefined, { resource: 'graph-links' }), | ||
enabled: feature.isEnabled && Boolean(feature.graphLinksUrl), | ||
staleTime: Infinity, | ||
placeholderData: {}, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { | ||
Text, | ||
PopoverTrigger, | ||
PopoverBody, | ||
PopoverContent, | ||
chakra, | ||
Box, | ||
VStack, | ||
} from '@chakra-ui/react'; | ||
import React from 'react'; | ||
|
||
import useIsMobile from 'lib/hooks/useIsMobile'; | ||
import Popover from 'ui/shared/chakra/Popover'; | ||
import IconSvg from 'ui/shared/IconSvg'; | ||
import LinkExternal from 'ui/shared/links/LinkExternal'; | ||
|
||
interface Props { | ||
className?: string; | ||
links?: Array<{ title: string; url: string }>; | ||
} | ||
|
||
const MarketplaceAppGraphLinks = ({ className, links }: Props) => { | ||
const isMobile = useIsMobile(); | ||
|
||
const handleButtonClick = React.useCallback((e: React.MouseEvent<HTMLDivElement>) => { | ||
e.stopPropagation(); | ||
}, []); | ||
|
||
if (!links || links.length === 0) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<Box position="relative" className={ className } display="inline-flex" alignItems="center" height={ 7 } onClick={ handleButtonClick }> | ||
<Popover | ||
placement={ isMobile ? 'bottom-end' : 'bottom' } | ||
isLazy | ||
trigger="hover" | ||
> | ||
<PopoverTrigger> | ||
<IconSvg name="brands/graph" boxSize={ 5 } onClick={ handleButtonClick }/> | ||
</PopoverTrigger> | ||
<PopoverContent w="260px"> | ||
<PopoverBody fontSize="sm"> | ||
<VStack gap={ 4 } align="start"> | ||
<Text>{ `This dapp uses ${ links.length > 1 ? 'several subgraphs' : 'a subgraph' } provided by The Graph` }</Text> | ||
{ links.map(link => ( | ||
<LinkExternal key={ link.url } href={ link.url }>{ link.title }</LinkExternal> | ||
)) } | ||
</VStack> | ||
</PopoverBody> | ||
</PopoverContent> | ||
</Popover> | ||
</Box> | ||
); | ||
}; | ||
|
||
export default React.memo(chakra(MarketplaceAppGraphLinks)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
-6.86 KB
(90%)
...eenshots__/MarketplaceAppModal.pw.tsx_dark-color-mode_base-view-dark-mode-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-6.66 KB
(90%)
...ce/__screenshots__/MarketplaceAppModal.pw.tsx_default_base-view-dark-mode-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-7.93 KB
(82%)
...place/__screenshots__/MarketplaceAppModal.pw.tsx_default_mobile-base-view-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
-7.86 KB
(87%)
...es/__screenshots__/Marketplace.pw.tsx_dark-color-mode_base-view-dark-mode-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-7.81 KB
(88%)
.../__screenshots__/Marketplace.pw.tsx_dark-color-mode_with-banner-dark-mode-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-9.37 KB
(89%)
...eenshots__/Marketplace.pw.tsx_dark-color-mode_with-featured-app-dark-mode-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-8.01 KB
(87%)
ui/pages/__screenshots__/Marketplace.pw.tsx_default_base-view-dark-mode-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-4.96 KB
(91%)
ui/pages/__screenshots__/Marketplace.pw.tsx_default_mobile-base-view-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-5.08 KB
(91%)
ui/pages/__screenshots__/Marketplace.pw.tsx_default_mobile-with-banner-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-6.25 KB
(90%)
ui/pages/__screenshots__/Marketplace.pw.tsx_default_mobile-with-featured-app-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-8.22 KB
(87%)
ui/pages/__screenshots__/Marketplace.pw.tsx_default_with-banner-dark-mode-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-9.82 KB
(89%)
...es/__screenshots__/Marketplace.pw.tsx_default_with-featured-app-dark-mode-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.