Skip to content
Snippets Groups Projects
Commit 947610d8 authored by xaralis's avatar xaralis
Browse files

feat: display score requirements captions and titles

parent b70ae7d6
Branches
No related tags found
No related merge requests found
...@@ -19,6 +19,24 @@ const PostScore = ({ ...@@ -19,6 +19,24 @@ const PostScore = ({
score >= supportThreshold || (score > 0 && !hasDislikes), score >= supportThreshold || (score > 0 && !hasDislikes),
}; };
let title;
if (!rankingReadonly) {
if (hasDislikes) {
if (score < supportThreshold) {
title = `Aktuální podpora je ${score} hlasů, pro získání podpory skupiny členů chybí ještě ${
supportThreshold - score
}.`;
} else {
title = `Aktuální podpora je ${score} hlasů, což je dostatek pro získání podpory skupiny členů (vyžaduje alespoň ${supportThreshold} hlasů).`;
}
} else {
title = `Příspěvek získal ${score} hlasů bez jakýchkoliv hlasů proti a má tedy konkludentní podporu.`;
}
} else {
title = `Příspěvek získal podporu ${score} hlasů.`;
}
return ( return (
<span <span
className={classNames( className={classNames(
...@@ -26,10 +44,18 @@ const PostScore = ({ ...@@ -26,10 +44,18 @@ const PostScore = ({
coloring, coloring,
className className
)} )}
title={`Míra podpory je ${score}.`} style={{ cursor: "help" }}
title={title}
> >
<i className="ico--power" /> <i className="ico--power" />
<span className="font-bold">{score}</span> <span className="font-bold">
{!rankingReadonly && hasDislikes && (
<span>
{score} z {supportThreshold}
</span>
)}
{!(!rankingReadonly && hasDislikes) && score.toString()}
</span>
</span> </span>
); );
}; };
......
import React from "react"; import React from "react";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import { format, isToday } from "date-fns"; import { format, isToday } from "date-fns";
import pick from "lodash/pick";
import { GlobalInfoStore, ProgramStore } from "stores"; import { GlobalInfoStore, ProgramStore } from "stores";
const GlobalStats = () => { const GlobalStats = () => {
const { onlineUsers, onlineMembers } = GlobalInfoStore.useState(); const { onlineUsers, onlineMembers } = GlobalInfoStore.useState((state) =>
const { currentId, scheduleIds, items } = ProgramStore.useState(); pick(state, ["onlineUsers", "onlineMembers"])
);
const { currentId, scheduleIds, items } = ProgramStore.useState((state) =>
pick(state, ["currentId", "scheduleIds", "items"])
);
const nextProgramEntryId = scheduleIds const nextProgramEntryId = scheduleIds
? scheduleIds[currentId ? scheduleIds.indexOf(currentId) + 1 : 0] ? scheduleIds[currentId ? scheduleIds.indexOf(currentId) + 1 : 0]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment