From 00002a9f80dae904c1629f2d0b06d2acc89e94bf Mon Sep 17 00:00:00 2001
From: Carl Worth
Date: Sun, 28 Jun 2020 14:42:32 -0700
Subject: [PATCH] empathy: Add button to hide/(vote against) categories
The server collects (and distributes) votes against but only the
client who voted against a category hides it.
---
empathy/empathy.css | 1 +
empathy/empathy.jsx | 69 ++++++++++++++++++++++++++++++---------------
style.css | 3 +-
3 files changed, 49 insertions(+), 24 deletions(-)
diff --git a/empathy/empathy.css b/empathy/empathy.css
index a58e633..36281bc 100644
--- a/empathy/empathy.css
+++ b/empathy/empathy.css
@@ -7,6 +7,7 @@
font-size: 200%;
padding: 1em;
margin-bottom: 0.25em;
+ position: relative;
}
.vote-choices {
diff --git a/empathy/empathy.jsx b/empathy/empathy.jsx
index 143acd9..ab45be9 100644
--- a/empathy/empathy.jsx
+++ b/empathy/empathy.jsx
@@ -363,6 +363,50 @@ class CategoryRequest extends React.PureComponent {
}
}
+const PromptOption = React.memo(props => {
+
+ const prompt = props.prompt;
+ const [show_prompt, set_show_prompt] = React.useState(true);
+
+ if (! show_prompt)
+ return false;
+
+ if (prompt.votes_against.find(v => v === props.player.name))
+ return false;
+
+ return (
+
+ );
+});
+
const PromptOptions = React.memo(props => {
if (props.prompts.length === 0)
@@ -375,29 +419,7 @@ const PromptOptions = React.memo(props => {
Select any categories below that you'd like to play.
You can choose as many as you'd like.
- {props.prompts.map(p => {
- return (
-
- );
- })}
+ {props.prompts.map(p => )}
);
});
@@ -1221,6 +1243,7 @@ class Game extends React.PureComponent {
,