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
b851dc8d
Commit
b851dc8d
authored
Jul 10, 2024
by
Max Alekseenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "show popover instead of tooltip on mobile"
This reverts commit
8703e808
.
parent
3cd87590
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
31 deletions
+12
-31
PopoverContent.tsx
ui/marketplace/Rating/PopoverContent.tsx
+1
-14
Rating.tsx
ui/marketplace/Rating/Rating.tsx
+0
-1
TriggerButton.tsx
ui/marketplace/Rating/TriggerButton.tsx
+11
-5
utils.tsx
ui/marketplace/Rating/utils.tsx
+0
-11
No files found.
ui/marketplace/Rating/PopoverContent.tsx
View file @
b851dc8d
import
{
Text
,
Flex
,
Spinner
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
import
IconSvg
from
'
ui/shared/IconSvg
'
;
import
Stars
from
'
./Stars
'
;
import
{
getTooltipText
}
from
'
./utils
'
;
const
ratingDescriptions
=
[
'
Terrible
'
,
'
Poor
'
,
'
Average
'
,
'
Very good
'
,
'
Outstanding
'
];
...
...
@@ -15,12 +13,9 @@ type Props = {
isRatedByUser
?:
boolean
;
rate
:
(
appId
:
string
,
recordId
:
string
|
undefined
,
rating
:
number
)
=>
void
;
isSending
?:
boolean
;
canRate
:
boolean
|
undefined
;
};
const
PopoverContent
=
({
appId
,
recordId
,
isRatedByUser
,
rate
,
isSending
,
canRate
}:
Props
)
=>
{
const
isMobile
=
useIsMobile
();
const
PopoverContent
=
({
appId
,
recordId
,
isRatedByUser
,
rate
,
isSending
}:
Props
)
=>
{
const
[
hovered
,
setHovered
]
=
React
.
useState
(
-
1
);
const
handleMouseOverFactory
=
React
.
useCallback
((
index
:
number
)
=>
()
=>
{
...
...
@@ -35,14 +30,6 @@ const PopoverContent = ({ appId, recordId, isRatedByUser, rate, isSending, canRa
rate
(
appId
,
recordId
,
index
+
1
);
},
[
appId
,
recordId
,
rate
]);
if
(
isMobile
&&
!
canRate
)
{
return
(
<
Text
fontSize=
"md"
textAlign=
"center"
>
{
getTooltipText
(
canRate
)
}
</
Text
>
);
}
if
(
isRatedByUser
)
{
return
(
<
Flex
alignItems=
"center"
>
...
...
ui/marketplace/Rating/Rating.tsx
View file @
b851dc8d
...
...
@@ -56,7 +56,6 @@ const Rating = ({
isRatedByUser=
{
isRatedByUser
}
rate=
{
rate
}
isSending=
{
isSending
}
canRate=
{
canRate
}
/>
</
PopoverBody
>
</
PopoverContent
>
...
...
ui/marketplace/Rating/TriggerButton.tsx
View file @
b851dc8d
import
{
Button
,
chakra
,
useColorModeValue
,
Tooltip
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
import
usePreventFocusAfterModalClosing
from
'
lib/hooks/usePreventFocusAfterModalClosing
'
;
import
IconSvg
from
'
ui/shared/IconSvg
'
;
import
{
getTooltipText
}
from
'
./utils
'
;
type
Props
=
{
rating
?:
number
;
fullView
?:
boolean
;
...
...
@@ -15,13 +12,22 @@ type Props = {
canRate
:
boolean
|
undefined
;
};
const
getTooltipText
=
(
canRate
:
boolean
|
undefined
)
=>
{
if
(
canRate
===
undefined
)
{
return
<>
You need a connected wallet to leave your rating.
<
br
/>
Link your wallet to Blockscout first
</>;
}
if
(
!
canRate
)
{
return
<>
New wallet users are not eligible to leave ratings.
<
br
/>
Please connect a different wallet
</>;
}
return
<>
Ratings are derived from reviews by trusted users.
<
br
/>
Click here to rate!
</>;
};
const
TriggerButton
=
(
{
rating
,
fullView
,
isActive
,
onClick
,
canRate
}:
Props
,
ref
:
React
.
ForwardedRef
<
HTMLButtonElement
>
,
)
=>
{
const
textColor
=
useColorModeValue
(
'
blackAlpha.800
'
,
'
whiteAlpha.800
'
);
const
onFocusCapture
=
usePreventFocusAfterModalClosing
();
const
isMobile
=
useIsMobile
();
return
(
<
Tooltip
...
...
@@ -36,7 +42,7 @@ const TriggerButton = (
variant=
"outline"
border=
{
0
}
p=
{
0
}
onClick=
{
(
canRate
||
isMobile
)
?
onClick
:
undefined
}
onClick=
{
canRate
?
onClick
:
undefined
}
fontSize=
{
fullView
?
'
md
'
:
'
sm
'
}
fontWeight=
{
fullView
?
'
400
'
:
'
500
'
}
lineHeight=
"21px"
...
...
ui/marketplace/Rating/utils.tsx
deleted
100644 → 0
View file @
3cd87590
import
React
from
'
react
'
;
export
const
getTooltipText
=
(
canRate
:
boolean
|
undefined
)
=>
{
if
(
canRate
===
undefined
)
{
return
<>
You need a connected wallet to leave your rating.
<
br
/>
Link your wallet to Blockscout first
</>;
}
if
(
!
canRate
)
{
return
<>
New wallet users are not eligible to leave ratings.
<
br
/>
Please connect a different wallet
</>;
}
return
<>
Ratings are derived from reviews by trusted users.
<
br
/>
Click here to rate!
</>;
};
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