This repository has been archived by the owner on Nov 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 362
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: Add featured apps widget to dashboard * refactor: Extract getSafeAppUrl * fix: Filter apps by tags * fix: Update gateway sdk package and remove old type * fix: Update gateway sdk package and remove old type * refactor: Extract featured apps const * fix: Check for tags if they exist
- Loading branch information
1 parent
f004ed7
commit 2686fa6
Showing
7 changed files
with
82 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { useAppList } from 'src/routes/safe/components/Apps/hooks/appList/useAppList' | ||
import { Text } from '@gnosis.pm/safe-react-components' | ||
import { Link } from 'react-router-dom' | ||
import { getSafeAppUrl, SafeRouteParams } from 'src/routes/routes' | ||
import { useSelector } from 'react-redux' | ||
import { currentSafe } from 'src/logic/safe/store/selectors' | ||
import { getShortName } from 'src/config' | ||
import { ReactElement, useMemo } from 'react' | ||
import Row from 'src/components/layout/Row' | ||
import Col from 'src/components/layout/Col' | ||
import styled from 'styled-components' | ||
|
||
const FEATURED_APPS_TAGS = 'dashboard-widgets' | ||
|
||
const StyledImage = styled.img` | ||
max-width: 64px; | ||
max-height: 64px; | ||
` | ||
|
||
const StyledLink = styled(Link)` | ||
margin-top: 10px; | ||
text-decoration: none; | ||
` | ||
|
||
const StyledRow = styled(Row)` | ||
gap: 24px; | ||
flex-wrap: inherit; | ||
` | ||
|
||
export const FeaturedApps = (): ReactElement => { | ||
const { allApps } = useAppList() | ||
const { address } = useSelector(currentSafe) ?? {} | ||
const featuredApps = useMemo(() => allApps.filter((app) => app.tags?.includes(FEATURED_APPS_TAGS)), [allApps]) | ||
|
||
const routesSlug: SafeRouteParams = { | ||
shortName: getShortName(), | ||
safeAddress: address, | ||
} | ||
|
||
return ( | ||
<> | ||
{featuredApps.map((app) => { | ||
const appRoute = getSafeAppUrl(app.url, routesSlug) | ||
return ( | ||
<StyledRow key={app.id} margin="lg"> | ||
<Col xs={2}> | ||
<StyledImage src={app.iconUrl} alt={app.name} /> | ||
</Col> | ||
<Col xs={10} layout="column"> | ||
<Text size="lg" strong> | ||
{app.description} | ||
</Text> | ||
<StyledLink to={appRoute}> | ||
<Text color="primary" size="lg" strong> | ||
Use {app.name} | ||
</Text> | ||
</StyledLink> | ||
</Col> | ||
</StyledRow> | ||
) | ||
})} | ||
</> | ||
) | ||
} |
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