Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dapps modals #2490

Merged
merged 9 commits into from
Feb 10, 2025
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions ui/marketplace/useMarketplace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,23 @@ export default function useMarketplace() {
// run only when data is loaded
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [ isPlaceholderData ]);
React.useEffect(() => {
const selectedAppId = getQueryParamString(router.query.selectedAppId);
if (selectedAppId) {
setSelectedAppId(selectedAppId);
setIsAppInfoModalOpen(true);
const newQuery = { ...router.query };
isstuev marked this conversation as resolved.
Show resolved Hide resolved
delete newQuery.selectedAppId;
router.replace(
{
pathname: router.pathname,
query: newQuery,
},
undefined,
{ shallow: true },
);
}
}, [ router.query.selectedAppId, router ]);

React.useEffect(() => {
if (isPlaceholderData) {
Expand Down
21 changes: 17 additions & 4 deletions ui/snippets/searchBar/SearchBarSuggest/SearchBarSuggestApp.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Image, Flex, Text, useColorModeValue } from '@chakra-ui/react';
isstuev marked this conversation as resolved.
Show resolved Hide resolved
import NextLink from 'next/link';
import router from 'next/router';
import React from 'react';

import type { MarketplaceAppOverview } from 'types/client/marketplace';
Expand All @@ -8,7 +9,6 @@ import highlightText from 'lib/highlightText';
import IconSvg from 'ui/shared/IconSvg';

import SearchBarSuggestItemLink from './SearchBarSuggestItemLink';

interface Props {
data: MarketplaceAppOverview;
isMobile: boolean | undefined;
Expand Down Expand Up @@ -96,9 +96,22 @@ const SearchBarSuggestApp = ({ data, isMobile, searchTerm, onClick }: Props) =>

if (data.external) {
return (
<SearchBarSuggestItemLink onClick={ onClick } href={ data.url } target="_blank">
{ content }
</SearchBarSuggestItemLink>
<NextLink
href={{
pathname: '/apps',
query: {
selectedAppId: data.id,
},
}}
passHref
shallow={ router.pathname === '/apps' }
tom2drum marked this conversation as resolved.
Show resolved Hide resolved
legacyBehavior
>
<SearchBarSuggestItemLink onClick={ onClick }>
{ content }
</SearchBarSuggestItemLink>
</NextLink>

);
}

Expand Down