Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
frontend
Commits
9f012489
Commit
9f012489
authored
Feb 12, 2024
by
Max Alekseenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move complex title to Marketplace component
parent
065bb126
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
74 deletions
+62
-74
index.tsx
pages/apps/index.tsx
+5
-72
Marketplace.tsx
ui/pages/Marketplace.tsx
+57
-2
No files found.
pages/apps/index.tsx
View file @
9f012489
import
{
IconButton
,
Menu
,
MenuButton
,
MenuItem
,
MenuList
,
Flex
}
from
'
@chakra-ui/react
'
;
import
type
{
NextPage
}
from
'
next
'
;
import
dynamic
from
'
next/dynamic
'
;
import
React
from
'
react
'
;
import
PageNextJs
from
'
nextjs/PageNextJs
'
;
import
config
from
'
configs/app
'
;
import
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
import
type
{
IconName
}
from
'
ui/shared/IconSvg
'
;
import
IconSvg
from
'
ui/shared/IconSvg
'
;
import
LinkExternal
from
'
ui/shared/LinkExternal
'
;
import
PageTitle
from
'
ui/shared/Page/PageTitle
'
;
const
feature
=
config
.
features
.
marketplace
;
const
Marketplace
=
dynamic
(()
=>
import
(
'
ui/pages/Marketplace
'
),
{
ssr
:
false
});
const
Page
:
NextPage
=
()
=>
{
const
isMobile
=
useIsMobile
();
const
links
=
[];
if
(
feature
.
isEnabled
)
{
if
(
feature
.
submitFormUrl
)
{
links
.
push
({
label
:
'
Submit app
'
,
href
:
feature
.
submitFormUrl
,
icon
:
'
plus
'
as
IconName
,
});
}
if
(
feature
.
suggestIdeasFormUrl
)
{
links
.
push
({
label
:
'
Suggest ideas
'
,
href
:
feature
.
suggestIdeasFormUrl
,
icon
:
'
edit
'
as
IconName
,
});
}
}
return
(
<
PageNextJs
pathname=
"/apps"
>
<>
<
PageTitle
title=
"DAppscout"
contentAfter=
{
(
isMobile
&&
links
.
length
>
1
)
?
(
<
Menu
>
<
MenuButton
as=
{
IconButton
}
size=
"sm"
variant=
"outline"
colorScheme=
"gray"
px=
"9px"
ml=
"auto"
icon=
{
<
IconSvg
name=
"dots"
boxSize=
"18px"
/>
}
/>
<
MenuList
minW=
"max-content"
>
{
links
.
map
(({
label
,
href
,
icon
})
=>
(
<
MenuItem
key=
{
label
}
as=
"a"
href=
{
href
}
target=
"_blank"
py=
{
2
}
px=
{
4
}
>
<
IconSvg
name=
{
icon
}
boxSize=
{
4
}
mr=
{
2.5
}
/>
{
label
}
<
IconSvg
name=
"arrows/north-east"
boxSize=
{
4
}
color=
"gray.400"
ml=
{
2
}
/>
</
MenuItem
>
))
}
</
MenuList
>
</
Menu
>
)
:
(
<
Flex
ml=
"auto"
>
{
links
.
map
(({
label
,
href
})
=>
(
<
LinkExternal
key=
{
label
}
href=
{
href
}
variant=
"subtle"
fontSize=
"sm"
lineHeight=
{
5
}
ml=
{
2
}
>
{
label
}
</
LinkExternal
>
))
}
</
Flex
>
)
}
/>
<
Marketplace
/>
</>
</
PageNextJs
>
);
};
const
Page
:
NextPage
=
()
=>
(
<
PageNextJs
pathname=
"/apps"
>
<
Marketplace
/>
</
PageNextJs
>
);
export
default
Page
;
...
...
ui/pages/Marketplace.tsx
View file @
9f012489
import
{
Box
}
from
'
@chakra-ui/react
'
;
import
{
Box
,
Menu
,
MenuButton
,
MenuItem
,
MenuList
,
Flex
,
IconButton
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
{
MarketplaceCategory
}
from
'
types/client/marketplace
'
;
...
...
@@ -7,18 +7,40 @@ import type { TabItem } from 'ui/shared/Tabs/types';
import
config
from
'
configs/app
'
;
import
throwOnResourceLoadError
from
'
lib/errors/throwOnResourceLoadError
'
;
import
useFeatureValue
from
'
lib/growthbook/useFeatureValue
'
;
import
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
import
MarketplaceAppModal
from
'
ui/marketplace/MarketplaceAppModal
'
;
import
MarketplaceCategoriesMenu
from
'
ui/marketplace/MarketplaceCategoriesMenu
'
;
import
MarketplaceDisclaimerModal
from
'
ui/marketplace/MarketplaceDisclaimerModal
'
;
import
MarketplaceList
from
'
ui/marketplace/MarketplaceList
'
;
import
FilterInput
from
'
ui/shared/filters/FilterInput
'
;
import
IconSvg
from
'
ui/shared/IconSvg
'
;
import
type
{
IconName
}
from
'
ui/shared/IconSvg
'
;
import
LinkExternal
from
'
ui/shared/LinkExternal
'
;
import
PageTitle
from
'
ui/shared/Page/PageTitle
'
;
import
TabsSkeleton
from
'
ui/shared/Tabs/TabsSkeleton
'
;
import
TabsWithScroll
from
'
ui/shared/Tabs/TabsWithScroll
'
;
import
useMarketplace
from
'
../marketplace/useMarketplace
'
;
const
feature
=
config
.
features
.
marketplace
;
const
links
:
Array
<
{
label
:
string
;
href
:
string
;
icon
:
IconName
}
>
=
[];
if
(
feature
.
isEnabled
)
{
if
(
feature
.
submitFormUrl
)
{
links
.
push
({
label
:
'
Submit app
'
,
href
:
feature
.
submitFormUrl
,
icon
:
'
plus
'
as
IconName
,
});
}
if
(
feature
.
suggestIdeasFormUrl
)
{
links
.
push
({
label
:
'
Suggest ideas
'
,
href
:
feature
.
suggestIdeasFormUrl
,
icon
:
'
edit
'
as
IconName
,
});
}
}
const
Marketplace
=
()
=>
{
const
{
isPlaceholderData
,
...
...
@@ -41,7 +63,7 @@ const Marketplace = () => {
appsTotal
,
isCategoriesPlaceholderData
,
}
=
useMarketplace
();
const
isMobile
=
useIsMobile
();
const
{
value
:
isExperiment
}
=
useFeatureValue
(
'
marketplace_exp
'
,
false
);
const
categoryTabs
=
React
.
useMemo
(()
=>
{
...
...
@@ -88,6 +110,39 @@ const Marketplace = () => {
return
(
<>
<
PageTitle
title=
"DAppscout"
contentAfter=
{
(
isMobile
&&
links
.
length
>
1
)
?
(
<
Menu
>
<
MenuButton
as=
{
IconButton
}
size=
"sm"
variant=
"outline"
colorScheme=
"gray"
px=
"9px"
ml=
"auto"
icon=
{
<
IconSvg
name=
"dots"
boxSize=
"18px"
/>
}
/>
<
MenuList
minW=
"max-content"
>
{
links
.
map
(({
label
,
href
,
icon
})
=>
(
<
MenuItem
key=
{
label
}
as=
"a"
href=
{
href
}
target=
"_blank"
py=
{
2
}
px=
{
4
}
>
<
IconSvg
name=
{
icon
}
boxSize=
{
4
}
mr=
{
2.5
}
/>
{
label
}
<
IconSvg
name=
"arrows/north-east"
boxSize=
{
4
}
color=
"gray.400"
ml=
{
2
}
/>
</
MenuItem
>
))
}
</
MenuList
>
</
Menu
>
)
:
(
<
Flex
ml=
"auto"
>
{
links
.
map
(({
label
,
href
})
=>
(
<
LinkExternal
key=
{
label
}
href=
{
href
}
variant=
"subtle"
fontSize=
"sm"
lineHeight=
{
5
}
ml=
{
2
}
>
{
label
}
</
LinkExternal
>
))
}
</
Flex
>
)
}
/>
{
isExperiment
&&
(
<
Box
marginTop=
{
{
base
:
0
,
lg
:
8
}
}
>
{
(
isCategoriesPlaceholderData
)
?
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment