Skip to content

Commit

Permalink
feat: 점수 편집 권한 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
cjy3458 committed May 5, 2024
1 parent 97b1681 commit 0377bc4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/components/mypage/TotalScoreSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ const TotalScoreSection = ({ myName }: { myName: string }) => {
const [isEditModalOn, setIsEditModalOn] = useState(false);
const [clickedUser, setClickedUser] = useState<UserScore>({} as UserScore);
const scoreChanged = useRecoilValue(userScoreChanged);
const [isPre, setIsPre] = useState<boolean>(false);

useEffect(() => {
if (myName === '최재영' || myName === '박재윤') {
setIsPre(true);
}
}, [myName]);

const handleScoreEditModal = (userScore: UserScore) => {
setIsEditModalOn(!isEditModalOn);
Expand Down Expand Up @@ -74,7 +81,7 @@ const TotalScoreSection = ({ myName }: { myName: string }) => {
<ScoreRow index={i + 1} key={i}>
<Score>
{userScore.name}
<EditButton onClick={() => handleScoreEditModal(userScore)} />
{isPre && <EditButton onClick={() => handleScoreEditModal(userScore)} />}
</Score>
<Score>{TRACK_NAME[userScore?.track]}</Score>
<Score>{userScore.absence}</Score>
Expand Down

0 comments on commit 0377bc4

Please sign in to comment.