-
-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1537 from tijlleenders/feature/goal-pps
Feature: Show Goal Participants
- Loading branch information
Showing
30 changed files
with
455 additions
and
237 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import Icon from "@src/common/Icon"; | ||
import { GoalItem } from "@src/models/GoalItem"; | ||
import { openInbox } from "@src/store"; | ||
import { getSvgForGoalPps } from "@src/utils"; | ||
import { Tooltip } from "antd"; | ||
import React from "react"; | ||
import { useLocation, useNavigate } from "react-router-dom"; | ||
import { useRecoilValue } from "recoil"; | ||
|
||
const Avatar = ({ goal }: { goal: GoalItem }) => { | ||
const location = useLocation(); | ||
const navigate = useNavigate(); | ||
const { participants, goalColor } = goal; | ||
const participantsSvg = getSvgForGoalPps(participants.length); | ||
|
||
return ( | ||
<div className="contact-button" style={goal.archived ? { right: "78px" } : {}}> | ||
<button | ||
type="button" | ||
className="contact-icon pps-icon" | ||
style={{ | ||
cursor: "pointer", | ||
background: `radial-gradient(50% 50% at 50% 50%, ${goalColor}33 20% 79.17%, ${goalColor} 100%)`, | ||
}} | ||
onClick={() => { | ||
navigate("/MyGoals", { | ||
state: { | ||
...location.state, | ||
displayParticipants: goal.participants, | ||
}, | ||
}); | ||
}} | ||
> | ||
<Icon active title={participantsSvg} c1={goalColor} c2={goalColor} /> | ||
</button> | ||
</div> | ||
); | ||
}; | ||
|
||
const GoalAvatar = ({ goal }: { goal: GoalItem }) => { | ||
const isInboxOpen = useRecoilValue(openInbox); | ||
|
||
return isInboxOpen ? ( | ||
<Tooltip placement="top" title={goal.participants[0].name}> | ||
<div className="contact-button" style={goal.archived ? { right: "78px" } : {}}> | ||
<button | ||
type="button" | ||
className="contact-icon" | ||
style={{ | ||
background: `radial-gradient(50% 50% at 50% 50%, ${goal.goalColor}33 20% 79.17%, ${goal.goalColor} 100%)`, | ||
}} | ||
> | ||
{goal.participants[0].name.charAt(0)} | ||
</button> | ||
</div> | ||
</Tooltip> | ||
) : ( | ||
<Avatar goal={goal} /> | ||
); | ||
}; | ||
|
||
export default GoalAvatar; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
89682f9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
zinzen – ./
zinzen-git-main-tijlleenders.vercel.app
zinzen.vercel.app
zinzen-tijlleenders.vercel.app