From 2dd3c52f51ff25af19aa4fd8594444b21c283d68 Mon Sep 17 00:00:00 2001 From: xaralis <filip.varecha@fragaria.cz> Date: Thu, 31 Dec 2020 20:01:57 +0100 Subject: [PATCH] feat: display member group size, update default filtering --- src/components/posts/PostScore.jsx | 2 +- src/containers/GlobalStats.jsx | 13 ++++++++++--- src/stores.js | 4 ++-- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/components/posts/PostScore.jsx b/src/components/posts/PostScore.jsx index 3cfda92..b5bf19c 100644 --- a/src/components/posts/PostScore.jsx +++ b/src/components/posts/PostScore.jsx @@ -12,7 +12,7 @@ const PostScore = ({ ? "bg-grey-125 text-grey-200" : { "bg-red-600 text-white": score < 0, - "bg-grey-125 text-grey-200": score === 0, + "bg-grey-125 text-grey-200": score === 0 && score < supportThreshold, "bg-yellow-400 text-grey-300": score > 0 && hasDislikes && score < supportThreshold, "bg-green-400 text-white": diff --git a/src/containers/GlobalStats.jsx b/src/containers/GlobalStats.jsx index e5acf60..065962d 100644 --- a/src/containers/GlobalStats.jsx +++ b/src/containers/GlobalStats.jsx @@ -6,8 +6,12 @@ import pick from "lodash/pick"; import { GlobalInfoStore, ProgramStore } from "stores"; const GlobalStats = () => { - const { onlineUsers, onlineMembers } = GlobalInfoStore.useState((state) => - pick(state, ["onlineUsers", "onlineMembers"]) + const { + onlineUsers, + onlineMembers, + groupSizeHalf, + } = GlobalInfoStore.useState((state) => + pick(state, ["onlineUsers", "onlineMembers", "groupSizeHalf"]) ); const { currentId, scheduleIds, items } = ProgramStore.useState((state) => pick(state, ["currentId", "scheduleIds", "items"]) @@ -22,7 +26,7 @@ const GlobalStats = () => { : null; return ( - <div className="bg-grey-50 flex space-x-4 leading-normal px-4 py-2 text-xs md:text-sm text-grey-300"> + <div className="bg-grey-50 flex space-x-4 leading-normal px-4 py-2 text-2xs md:text-xs lg:text-sm text-grey-300"> <div> <strong>{onlineMembers}</strong>{" "} <span> @@ -34,6 +38,9 @@ const GlobalStats = () => { <div> <strong>{onlineUsers}</strong> <span>online celkem</span> </div> + <div> + <span>Vel. skupiny členů je</span> <strong>{groupSizeHalf}</strong> + </div> {nextProgramEntry && ( <div className="flex-grow text-right hidden sm:block lg:hidden xl:block"> Následuje:{" "} diff --git a/src/stores.js b/src/stores.js index fe8ab11..e98a90e 100644 --- a/src/stores.js +++ b/src/stores.js @@ -52,8 +52,8 @@ const postStoreInitial = { perPage: 20, }, filters: { - flags: "all", - sort: "byDate", + flags: "active", + sort: "byScore", type: "all", showPendingProposals: false, }, -- GitLab