Skip to content

Commit

Permalink
Feat: 출석부 생성 조건 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
cjy3458 committed Mar 11, 2024
1 parent 555954f commit 1b9c8e9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
17 changes: 7 additions & 10 deletions src/components/mypage/TotalScoreSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import ScoreEditModal from './component/ScoreEditModal';
import ScoreHeader from './component/ScoreHeader';
import { TiPencil } from 'react-icons/ti';

const TotalScoreSection = () => {
const TotalScoreSection = ({ myName }: { myName: string }) => {
const tokenValue = useRecoilValue(token);
const [totalScoreArray, setTotalScoreArray] = useState<UserScore[]>([]);
const [isEditModalOn, setIsEditModalOn] = useState(false);
Expand Down Expand Up @@ -57,10 +57,9 @@ const TotalScoreSection = () => {
return (
<>
<Wrapper>
<ScoreHeader isAdmin={true} />
<ScoreHeader isAdmin={true} name={myName} />
<ScoreWrapper>
{
!totalAssignmentLoading && !totalAttendanceLoading &&
{!totalAssignmentLoading && !totalAttendanceLoading && (
<>
<ScoreRow index={0}>
<ScoreTitle index={0}>이름</ScoreTitle>
Expand All @@ -87,9 +86,8 @@ const TotalScoreSection = () => {
</ScoreRow>
))}
</>
}
)}
</ScoreWrapper>

</Wrapper>
{isEditModalOn ? (
<ScoreEditModal
Expand All @@ -100,7 +98,6 @@ const TotalScoreSection = () => {
) : null}
</>
);

};
export default TotalScoreSection;

Expand All @@ -121,13 +118,13 @@ const ScoreWrapper = styled.div`
overflow: hidden;
`;

const ScoreRow = styled.div<{ index: number; }>`
const ScoreRow = styled.div<{ index: number }>`
display: flex;
width: 100%;
background-color: ${(props) => (props.index % 2 == 0 ? GreyScale.light : BackgroundColor)};
`;

const ScoreTitle = styled.div<{ index: number; }>`
const ScoreTitle = styled.div<{ index: number }>`
font-family: 'Pretendard';
font-style: normal;
font-weight: 500;
Expand All @@ -140,7 +137,7 @@ const ScoreTitle = styled.div<{ index: number; }>`
border-right: ${(props) => (props.index == 7 ? 'none' : '1px solid gray')};
`;

const Score = styled.div<{ type?: string; }>`
const Score = styled.div<{ type?: string }>`
font-family: 'Pretendard';
font-style: normal;
font-weight: 500;
Expand Down
4 changes: 2 additions & 2 deletions src/components/mypage/component/ScoreHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import React from 'react';
import styled from 'styled-components';
import MakeAttendanceButton from './MakeAttendanceButton';

const ScoreHeader = ({ isAdmin }: { isAdmin: boolean }) => {
const ScoreHeader = ({ isAdmin, name }: { isAdmin: boolean; name: string }) => {
return (
<>
<TitleHeader>
<TitleText>출석현황</TitleText>
{isAdmin && <MakeAttendanceButton />}
{isAdmin && (name === '최재영' || name === '박재윤') && <MakeAttendanceButton />}
</TitleHeader>

<CallOut>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/mypage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const MyPage = () => {
<ProfileCard user={userProfile} />
{isActiveGeneration ? (
userProfile.is_admin ? (
<TotalScoreSection />
<TotalScoreSection myName={userProfile.name} />
) : (
<MyScoreSection userProfile={userProfile} />
)
Expand Down

0 comments on commit 1b9c8e9

Please sign in to comment.