Skip to content

Commit

Permalink
fixup! フロントエンドにリアクション機能を実装
Browse files Browse the repository at this point in the history
  • Loading branch information
MurakawaTakuya committed Jan 12, 2025
1 parent f13080f commit 174a67e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
13 changes: 6 additions & 7 deletions src/Components/Progress/Reaction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,34 +38,33 @@ export const Reaction = ({

useEffect(() => {
// 絵文字の種類を定義
let emojiList: { [key: string]: string } = {};
let emojiList: Record<string, string> = {};
if (resultType === "success") {
emojiList = ReactionType.success;
// keyをreactionListのkey、emojiListをそれぞれのiconに入れる
const updatedReactionList = Object.keys(emojiList).reduce(
(acc: { [key: string]: reactionValue }, key) => {
(acc: Record<string, reactionValue>, key) => {
acc[key] = { icon: emojiList[key], count: 0 };
return acc;
},
{} as { [key: string]: reactionValue }
{} as Record<string, reactionValue>
);
setReactionList(updatedReactionList);
} else if (resultType === "failed") {
emojiList = ReactionType.failed;
const updatedReactionList = Object.keys(emojiList).reduce(
(acc: { [key: string]: reactionValue }, key) => {
(acc: Record<string, reactionValue>, key) => {
acc[key] = { icon: emojiList[key], count: 0 };
return acc;
},
{} as { [key: string]: reactionValue }
{} as Record<string, reactionValue>
);
setReactionList(updatedReactionList);
}

setTimeout(() => {
setIsOnceClicked(false);
}, 1000);
}, []);
}, [resultType]);

useEffect(() => {
// リアクションのカウントを更新
Expand Down
1 change: 0 additions & 1 deletion src/Components/Progress/StepperBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export const StepperBlock = ({
resultType?: "success" | "failed" | "pending";
result: GoalWithIdAndUserData;
}) => {
const goalId = result.goalId;
const userData = result.userData;

const successRate = userData
Expand Down

0 comments on commit 174a67e

Please sign in to comment.