Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cf2021
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vojtech.pikal
cf2021
Commits
e3d9b0aa
Commit
e3d9b0aa
authored
4 years ago
by
xaralis
Browse files
Options
Downloads
Patches
Plain Diff
feat: improve score highlighting
parent
a55ca24f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/components/posts/Post.jsx
+2
-2
2 additions, 2 deletions
src/components/posts/Post.jsx
src/components/posts/PostScore.jsx
+15
-18
15 additions, 18 deletions
src/components/posts/PostScore.jsx
with
17 additions
and
20 deletions
src/components/posts/Post.jsx
+
2
−
2
View file @
e3d9b0aa
...
...
@@ -240,8 +240,8 @@ const Post = ({
)
}
<
PostScore
className
=
"ml-2"
score
=
{
ranking
.
scor
e
}
hasDislikes
=
{
ranking
.
dislikes
>
0
}
postType
=
{
typ
e
}
ranking
=
{
ranking
}
rankingReadonly
=
{
!
thumbsVisible
}
supportThreshold
=
{
supportThreshold
}
/>
...
...
This diff is collapsed.
Click to expand it.
src/components/posts/PostScore.jsx
+
15
−
18
View file @
e3d9b0aa
...
...
@@ -2,27 +2,31 @@ import React from "react";
import
classNames
from
"
classnames
"
;
const
PostScore
=
({
scor
e
,
hasDislikes
,
postTyp
e
,
ranking
,
supportThreshold
,
rankingReadonly
,
className
,
})
=>
{
const
coloring
=
rankingReadonly
?
"
bg-grey-125 text-grey-200
"
:
{
const
{
score
,
dislikes
}
=
ranking
;
const
highlight
=
postType
===
"
procedure-proposal
"
&&
!
rankingReadonly
;
const
coloring
=
highlight
?
{
"
bg-red-600 text-white
"
:
score
<
0
,
"
bg-grey-125 text-grey-200
"
:
score
===
0
&&
score
<
supportThreshold
,
"
bg-yellow-400 text-grey-300
"
:
score
>
0
&&
hasD
islikes
&&
score
<
supportThreshold
,
score
>
0
&&
d
islikes
>
0
&&
score
<
supportThreshold
,
"
bg-green-400 text-white
"
:
score
>=
supportThreshold
||
(
score
>
0
&&
!
hasDislikes
),
};
score
>=
supportThreshold
||
(
score
>
0
&&
dislikes
<=
0
),
}
:
"
bg-grey-125 text-grey-200
"
;
let
title
;
if
(
!
rankingReadonly
)
{
if
(
hasDislikes
)
{
if
(
postType
===
"
procedure-proposal
"
)
{
if
(
rankingReadonly
)
{
title
=
`Návrh postupu získal podporu
${
score
}
hlasů.`
;
}
else
if
(
dislikes
>
0
)
{
if
(
score
<
supportThreshold
)
{
title
=
`Aktuální podpora je
${
score
}
hlasů, pro získání podpory skupiny členů chybí ještě
${
supportThreshold
-
score
...
...
@@ -48,14 +52,7 @@ const PostScore = ({
title
=
{
title
}
>
<
i
className
=
"ico--power"
/>
<
span
className
=
"font-bold"
>
{
!
rankingReadonly
&&
hasDislikes
&&
(
<
span
>
{
score
}
z
{
supportThreshold
}
</
span
>
)
}
{
!
(
!
rankingReadonly
&&
hasDislikes
)
&&
score
.
toString
()
}
</
span
>
<
span
className
=
"font-bold"
>
{
score
}
</
span
>
</
span
>
);
};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment