-
Notifications
You must be signed in to change notification settings - Fork 485
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
148 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 useIsSafeAddress() { | ||
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,47 @@ | ||
import { | ||
Text, | ||
PopoverTrigger, | ||
PopoverBody, | ||
PopoverContent, | ||
chakra, | ||
Box, | ||
VStack, | ||
} from '@chakra-ui/react'; | ||
import React from 'react'; | ||
|
||
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) => { | ||
if (!links || links.length === 0) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<Box position="relative" className={ className } display="inline-flex" alignItems="center" height={ 7 }> | ||
<Popover placement="bottom" isLazy trigger="hover"> | ||
<PopoverTrigger> | ||
<IconSvg name="brands/graph" boxSize={ 5 }/> | ||
</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
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