-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add partial approve related logic in funding detail frame #1403
Merged
jooyeongmee
merged 2 commits into
dev
from
1402-add-partial-approve-toast-in-funding-page
Jan 31, 2025
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
107 changes: 107 additions & 0 deletions
107
packages/web/src/common/components/ApproveReasonToast.tsx
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,107 @@ | ||
import React from "react"; | ||
|
||
import styled from "styled-components"; | ||
|
||
import colors from "@sparcs-clubs/web/styles/themes/colors"; | ||
import { formatDotDetailDate } from "@sparcs-clubs/web/utils/Date/formatDate"; | ||
|
||
import FlexWrapper from "./FlexWrapper"; | ||
import Icon from "./Icon"; | ||
|
||
import Typography from "./Typography"; | ||
|
||
interface Reason { | ||
datetime: Date; | ||
reason: React.ReactNode; | ||
status?: string; | ||
} | ||
|
||
interface ApproveReasonToastProps { | ||
title: string; | ||
reasons: Reason[]; | ||
} | ||
|
||
const ForceBorderRadius = styled.div` | ||
position: sticky; | ||
top: 0px; | ||
border-radius: 8px; | ||
width: 100%; | ||
overflow: hidden; | ||
border: 1px solid ${({ theme }) => theme.colors.GREEN[600]}; | ||
background: ${({ theme }) => theme.colors.GREEN[100]}; | ||
z-index: ${({ theme }) => theme.zIndices.toast}; | ||
`; | ||
|
||
const ApproveReasonToastInner = styled.div` | ||
color: ${({ theme }) => theme.colors.BLACK}; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: flex-start; | ||
gap: 8px; | ||
width: 100%; | ||
max-height: 300px; | ||
overflow-y: auto; | ||
|
||
.ApproveReasonToast-title { | ||
padding: 12px 16px 0 16px; | ||
|
||
position: sticky; | ||
top: 0; | ||
display: flex; | ||
align-items: center; | ||
gap: 8px; | ||
background: ${({ theme }) => theme.colors.GREEN[100]}; | ||
z-index: ${({ theme }) => theme.zIndices.toast + 1}; | ||
} | ||
|
||
.ApproveReasonToast-reasons { | ||
display: flex; | ||
width: 100%; | ||
padding: 0 16px 12px 44px; | ||
flex-direction: column; | ||
gap: 8px; | ||
flex: 1 0 0; | ||
} | ||
|
||
.ApproveReasonToast-sticky-title { | ||
position: sticky; | ||
top: 0; | ||
background: ${({ theme }) => theme.colors.GREEN[100]}; | ||
z-index: ${({ theme }) => theme.zIndices.toast + 1}; | ||
} | ||
`; | ||
|
||
const ApproveReasonToast: React.FC<ApproveReasonToastProps> = ({ | ||
title, | ||
reasons, | ||
}) => ( | ||
<ForceBorderRadius> | ||
<ApproveReasonToastInner> | ||
<div className="ApproveReasonToast-title"> | ||
<Icon type="error" size={20} color={colors.GREEN[600]} /> | ||
<Typography fs={16} lh={24} fw="MEDIUM"> | ||
{title} | ||
</Typography> | ||
</div> | ||
<div className="ApproveReasonToast-reasons"> | ||
{reasons.map(reason => ( | ||
<FlexWrapper | ||
direction="column" | ||
gap={4} | ||
key={formatDotDetailDate(reason.datetime)} | ||
> | ||
<Typography fs={14} lh={16} fw="REGULAR" color="GRAY.600"> | ||
{formatDotDetailDate(reason.datetime)}{" "} | ||
{reason.status && `• ${reason.status}`} | ||
</Typography> | ||
<Typography fs={16} lh={24} fw="REGULAR"> | ||
{reason.reason} | ||
</Typography> | ||
</FlexWrapper> | ||
))} | ||
</div> | ||
</ApproveReasonToastInner> | ||
</ForceBorderRadius> | ||
); | ||
|
||
export default ApproveReasonToast; |
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
69 changes: 69 additions & 0 deletions
69
packages/web/src/features/manage-club/funding/detail/components/FundingStatusSection.tsx
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,69 @@ | ||
import React, { useMemo } from "react"; | ||
|
||
import { IFundingCommentResponse } from "@sparcs-clubs/interface/api/funding/type/funding.type"; | ||
import { FundingStatusEnum } from "@sparcs-clubs/interface/common/enum/funding.enum"; | ||
|
||
import ApproveReasonToast from "@sparcs-clubs/web/common/components/ApproveReasonToast"; | ||
import ProgressStatus from "@sparcs-clubs/web/common/components/ProgressStatus"; | ||
|
||
import RejectReasonToast from "@sparcs-clubs/web/common/components/RejectReasonToast"; | ||
|
||
import { FundingTagList } from "@sparcs-clubs/web/constants/tableTagList"; | ||
import { getFundingProgress } from "@sparcs-clubs/web/features/manage-club/funding/constants/fundingProgressStatus"; | ||
import { getTagDetail } from "@sparcs-clubs/web/utils/getTagDetail"; | ||
|
||
interface FundingStatusSectionProps { | ||
status: FundingStatusEnum; | ||
editedAt: Date; | ||
commentedAt?: Date; | ||
comments: IFundingCommentResponse[]; | ||
} | ||
|
||
const FundingStatusSection: React.FC<FundingStatusSectionProps> = ({ | ||
status, | ||
editedAt, | ||
commentedAt = undefined, | ||
comments, | ||
}) => { | ||
const progressStatus = getFundingProgress(status, editedAt, commentedAt); | ||
|
||
const ToastSection = useMemo(() => { | ||
if (status === FundingStatusEnum.Rejected) { | ||
return ( | ||
<RejectReasonToast | ||
title="코멘트" | ||
reasons={comments.map(comment => ({ | ||
datetime: comment.createdAt, | ||
reason: comment.content, | ||
status: getTagDetail(comment.fundingStatusEnum, FundingTagList) | ||
.text, | ||
}))} | ||
/> | ||
); | ||
} | ||
|
||
return ( | ||
<ApproveReasonToast | ||
title="코멘트" | ||
reasons={comments.map(comment => ({ | ||
datetime: comment.createdAt, | ||
reason: comment.content, | ||
status: | ||
comment.fundingStatusEnum === FundingStatusEnum.Partial | ||
? `${getTagDetail(comment.fundingStatusEnum, FundingTagList).text}승인` | ||
: getTagDetail(comment.fundingStatusEnum, FundingTagList).text, | ||
}))} | ||
/> | ||
); | ||
}, [comments, status]); | ||
|
||
return ( | ||
<ProgressStatus | ||
labels={progressStatus.labels} | ||
progress={progressStatus.progress} | ||
optional={comments && comments.length > 0 && ToastSection} | ||
/> | ||
); | ||
}; | ||
|
||
export default FundingStatusSection; |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
가장 최신 커멘트의 상태에 따라 ApproveReasonToast, RejectReasonToast, (+ 운위나 부분 승인도?) 으로 감싸면 어떨까?
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.
그 가장 최신 커멘트의 상태가 funding.fundingStatusEnum 아냐?
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.
지금 funding 상세조회 api 에서 보내주는 fundingStatusEnum(comment 안에 statusEnum 말고) 기준으로 rejected이면 RejectReasonToast(빨간색), 그 외의 나머지 케이스에는 ApproveReasonToast(초록색) 로 했는데
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.
으악.. 코드를 반만 읽었나.. 그렇네요!
운위도 따로 만들면 좋을 것 같긴 한데, 일단 그건 집행부 쪽 할때 같이 하는걸로!