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

Lock marketplace action bar at the top of the page #2106

Merged
merged 5 commits into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion icons/star_filled.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion ui/marketplace/Banner/FeaturedApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ const FeaturedApp = ({
height="136px"
padding={ 5 }
background={ backgroundColor }
mb={ 6 }
mb={ 2 }
mt={ 6 }
>
<Skeleton
isLoaded={ !isLoading }
Expand Down
2 changes: 1 addition & 1 deletion ui/marketplace/Banner/FeaturedAppMobile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const FeaturedAppMobile = ({
padding={{ base: 3, sm: '20px' }}
role="group"
background={ useColorModeValue('purple.50', 'whiteAlpha.100') }
mb={ 4 }
mt={ 6 }
>
<Flex
flexDirection="row"
Expand Down
3 changes: 2 additions & 1 deletion ui/marketplace/Banner/IframeBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ const IframeBanner = ({ contentUrl, linkUrl }: { contentUrl: string; linkUrl: st
h="136px"
w="100%"
borderRadius="md"
mb={{ base: 4, sm: 6 }}
mb={{ base: 0, sm: 2 }}
mt={ 6 }
overflow="hidden"
>
<Link
Expand Down
1 change: 1 addition & 0 deletions ui/marketplace/MarketplaceList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ const MarketplaceList = ({
}}
autoRows="1fr"
gap={{ base: '16px', md: '24px' }}
marginTop={{ base: 0, lg: 3 }}
>
{ apps.slice(0, renderedItemsNum).map((app, index) => (
<MarketplaceAppCard
Expand Down
11 changes: 10 additions & 1 deletion ui/pages/Marketplace.pw.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Box } from '@chakra-ui/react';
import React from 'react';

import { apps as appsMock } from 'mocks/apps/apps';
Expand Down Expand Up @@ -62,7 +63,15 @@ test.describe('mobile', () => {
test.use({ viewport: devices['iPhone 13 Pro'].viewport });

test('base view', async({ render }) => {
const component = await render(<Marketplace/>);
const component = await render(
<Box>
{ /* Added a fake header because without the ActionBar works incorrectly without it */ }
<Box h="100px" backgroundColor="#dbdbdb" p={ 1 }>
Header
</Box>
<Marketplace/>
</Box>,
);

await expect(component).toHaveScreenshot();
});
Expand Down
48 changes: 29 additions & 19 deletions ui/pages/Marketplace.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Box, MenuButton, MenuItem, MenuList, Flex, IconButton } from '@chakra-ui/react';
import { MenuButton, MenuItem, MenuList, Flex, IconButton } from '@chakra-ui/react';
import React from 'react';
import type { MouseEvent } from 'react';

Expand All @@ -14,6 +14,7 @@ import MarketplaceAppModal from 'ui/marketplace/MarketplaceAppModal';
import MarketplaceDisclaimerModal from 'ui/marketplace/MarketplaceDisclaimerModal';
import MarketplaceList from 'ui/marketplace/MarketplaceList';
import { SORT_OPTIONS } from 'ui/marketplace/utils';
import ActionBar from 'ui/shared/ActionBar';
import Menu from 'ui/shared/chakra/Menu';
import FilterInput from 'ui/shared/filters/FilterInput';
import IconSvg from 'ui/shared/IconSvg';
Expand Down Expand Up @@ -140,6 +141,7 @@ const Marketplace = () => {
<>
<PageTitle
title="DAppscout"
mb={ 2 }
contentAfter={ (isMobile && links.length > 1) ? (
<Menu>
<MenuButton
Expand Down Expand Up @@ -181,34 +183,42 @@ const Marketplace = () => {
onAppClick={ handleAppClick }
/>

<Box marginTop={{ base: 0, lg: 8 }}>
<ActionBar
showShadow
display="flex"
flexDirection="column"
mx={{ base: -3, lg: -12 }}
px={{ base: 3, lg: 12 }}
pt={{ base: 4, lg: 6 }}
pb={{ base: 4, lg: 3 }}
>
<TabsWithScroll
tabs={ categoryTabs }
onTabChange={ handleCategoryChange }
defaultTabIndex={ selectedCategoryIndex }
marginBottom={ -2 }
isLoading={ isCategoriesPlaceholderData }
/>
</Box>

<Flex mb={{ base: 4, lg: 6 }} gap={{ base: 2, lg: 3 }}>
{ feature.securityReportsUrl && (
<Sort
name="dapps_sorting"
options={ SORT_OPTIONS }
onChange={ setSorting }
<Flex gap={{ base: 2, lg: 3 }}>
{ feature.securityReportsUrl && (
<Sort
name="dapps_sorting"
options={ SORT_OPTIONS }
onChange={ setSorting }
isLoading={ isPlaceholderData }
/>
) }
<FilterInput
initialValue={ filterQuery }
onChange={ onSearchInputChange }
placeholder="Find app by name or keyword..."
isLoading={ isPlaceholderData }
size={ feature.securityReportsUrl ? 'xs' : 'sm' }
w={{ base: '100%', lg: '350px' }}
/>
) }
<FilterInput
initialValue={ filterQuery }
onChange={ onSearchInputChange }
placeholder="Find app by name or keyword..."
isLoading={ isPlaceholderData }
size={ feature.securityReportsUrl ? 'xs' : 'sm' }
w={{ base: '100%', lg: '350px' }}
/>
</Flex>
</Flex>
</ActionBar>

<MarketplaceList
apps={ displayedApps }
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading