Commit 9da3114b authored by Max Alekseenko's avatar Max Alekseenko

fix marketplace sorting display

parent b53a425d
import type { NextRouter } from 'next/router';
import config from 'configs/app';
import getQueryParamString from 'lib/router/getQueryParamString';
import removeQueryParam from 'lib/router/removeQueryParam';
import type { TOption } from 'ui/shared/sort/Option';
const feature = config.features.marketplace;
export type SortValue = 'rating' | 'security_score';
export const SORT_OPTIONS: Array<TOption<SortValue>> = [
{ title: 'Default', id: undefined },
{ title: 'Rating', id: 'rating' },
{ title: 'Security score', id: 'security_score' },
];
(feature.isEnabled && feature.rating) && { title: 'Rating', id: 'rating' },
(feature.isEnabled && feature.securityReportsUrl) && { title: 'Security score', id: 'security_score' },
].filter(Boolean) as Array<TOption<SortValue>>;
export function getAppUrl(url: string | undefined, router: NextRouter) {
if (!url) {
......
......@@ -137,6 +137,8 @@ const Marketplace = () => {
return null;
}
const showSort = SORT_OPTIONS.length > 1;
return (
<>
<PageTitle
......@@ -201,7 +203,7 @@ const Marketplace = () => {
/>
<Flex gap={{ base: 2, lg: 3 }}>
{ feature.securityReportsUrl && (
{ showSort && (
<Sort
name="dapps_sorting"
options={ SORT_OPTIONS }
......@@ -214,7 +216,7 @@ const Marketplace = () => {
onChange={ onSearchInputChange }
placeholder="Find app by name or keyword..."
isLoading={ isPlaceholderData }
size={ feature.securityReportsUrl ? 'xs' : 'sm' }
size={ showSort ? 'xs' : 'sm' }
w={{ base: '100%', lg: '350px' }}
/>
</Flex>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment