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
a5d43c78
Commit
a5d43c78
authored
Jul 12, 2024
by
Max Alekseenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hide rating if feature is disabled
parent
91520016
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
18 deletions
+32
-18
MarketplaceAppModal.tsx
ui/marketplace/MarketplaceAppModal.tsx
+24
-18
Rating.tsx
ui/marketplace/Rating/Rating.tsx
+8
-0
No files found.
ui/marketplace/MarketplaceAppModal.tsx
View file @
a5d43c78
...
@@ -7,6 +7,7 @@ import React, { useCallback } from 'react';
...
@@ -7,6 +7,7 @@ import React, { useCallback } from 'react';
import
type
{
MarketplaceAppWithSecurityReport
}
from
'
types/client/marketplace
'
;
import
type
{
MarketplaceAppWithSecurityReport
}
from
'
types/client/marketplace
'
;
import
{
ContractListTypes
}
from
'
types/client/marketplace
'
;
import
{
ContractListTypes
}
from
'
types/client/marketplace
'
;
import
config
from
'
configs/app
'
;
import
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
import
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
import
{
nbsp
}
from
'
lib/html-entities
'
;
import
{
nbsp
}
from
'
lib/html-entities
'
;
import
*
as
mixpanel
from
'
lib/mixpanel/index
'
;
import
*
as
mixpanel
from
'
lib/mixpanel/index
'
;
...
@@ -17,6 +18,9 @@ import AppSecurityReport from './AppSecurityReport';
...
@@ -17,6 +18,9 @@ import AppSecurityReport from './AppSecurityReport';
import
MarketplaceAppModalLink
from
'
./MarketplaceAppModalLink
'
;
import
MarketplaceAppModalLink
from
'
./MarketplaceAppModalLink
'
;
import
Rating
from
'
./Rating/Rating
'
;
import
Rating
from
'
./Rating/Rating
'
;
const
feature
=
config
.
features
.
marketplace
;
const
isRatingEnabled
=
feature
.
isEnabled
&&
feature
.
rating
;
type
Props
=
{
type
Props
=
{
onClose
:
()
=>
void
;
onClose
:
()
=>
void
;
isFavorite
:
boolean
;
isFavorite
:
boolean
;
...
@@ -160,24 +164,26 @@ const MarketplaceAppModal = ({
...
@@ -160,24 +164,26 @@ const MarketplaceAppModal = ({
By
{
nbsp
}{
author
}
By
{
nbsp
}{
author
}
</
Text
>
</
Text
>
<
Box
{
isRatingEnabled
&&
(
gridColumn=
{
{
base
:
'
1 / 3
'
,
md
:
2
}
}
<
Box
marginTop=
{
{
base
:
6
,
md
:
3
}
}
gridColumn=
{
{
base
:
'
1 / 3
'
,
md
:
2
}
}
py=
{
{
base
:
0
,
md
:
1.5
}
}
marginTop=
{
{
base
:
6
,
md
:
3
}
}
width=
"fit-content"
py=
{
{
base
:
0
,
md
:
1.5
}
}
>
width=
"fit-content"
<
Rating
>
appId=
{
id
}
<
Rating
rating=
{
rating
}
appId=
{
id
}
recordId=
{
ratingRecordId
}
rating=
{
rating
}
userRating=
{
userRating
}
recordId=
{
ratingRecordId
}
rate=
{
rateApp
}
userRating=
{
userRating
}
isSending=
{
isSendingRating
}
rate=
{
rateApp
}
isLoading=
{
isRatingLoading
}
isSending=
{
isSendingRating
}
fullView
isLoading=
{
isRatingLoading
}
canRate=
{
canRate
}
fullView
/>
canRate=
{
canRate
}
</
Box
>
/>
</
Box
>
)
}
<
Box
<
Box
gridColumn=
{
{
base
:
'
1 / 3
'
,
md
:
2
}
}
gridColumn=
{
{
base
:
'
1 / 3
'
,
md
:
2
}
}
...
...
ui/marketplace/Rating/Rating.tsx
View file @
a5d43c78
import
{
Text
,
PopoverTrigger
,
PopoverBody
,
PopoverContent
,
useDisclosure
,
Skeleton
,
useOutsideClick
,
Box
}
from
'
@chakra-ui/react
'
;
import
{
Text
,
PopoverTrigger
,
PopoverBody
,
PopoverContent
,
useDisclosure
,
Skeleton
,
useOutsideClick
,
Box
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
config
from
'
configs/app
'
;
import
Popover
from
'
ui/shared/chakra/Popover
'
;
import
Popover
from
'
ui/shared/chakra/Popover
'
;
import
Content
from
'
./PopoverContent
'
;
import
Content
from
'
./PopoverContent
'
;
import
Stars
from
'
./Stars
'
;
import
Stars
from
'
./Stars
'
;
import
TriggerButton
from
'
./TriggerButton
'
;
import
TriggerButton
from
'
./TriggerButton
'
;
const
feature
=
config
.
features
.
marketplace
;
const
isEnabled
=
feature
.
isEnabled
&&
feature
.
rating
;
type
Props
=
{
type
Props
=
{
appId
:
string
;
appId
:
string
;
rating
?:
number
;
rating
?:
number
;
...
@@ -28,6 +32,10 @@ const Rating = ({
...
@@ -28,6 +32,10 @@ const Rating = ({
const
popoverRef
=
React
.
useRef
(
null
);
const
popoverRef
=
React
.
useRef
(
null
);
useOutsideClick
({
ref
:
popoverRef
,
handler
:
onClose
});
useOutsideClick
({
ref
:
popoverRef
,
handler
:
onClose
});
if
(
!
isEnabled
)
{
return
null
;
}
return
(
return
(
<
Skeleton
<
Skeleton
display=
"flex"
display=
"flex"
...
...
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