Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import styled from 'styled-components';

export const TextAreaContainer = styled.div<{ width: string }>`
width: ${(props) => props.width};
min-width: 300px;
max-width: 100%;
display: flex;
flex-direction: column;
`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ import styled from 'styled-components';

export const InputContainer = styled.div<{ width: string; readOnly?: boolean }>`
width: ${(props) => props.width};
min-width: 300px;
max-width: 100%;
display: flex;
flex-direction: column;

@media (max-width: 768px) {
min-width: 0;
width: 100%;
}
`;
Expand All @@ -27,7 +26,7 @@ export const InputWrapper = styled.div`
export const Input = styled.input<{ hasError?: boolean; readOnly?: boolean }>`
flex: 1;
height: 45px;
padding: 12px 80px 12px 18px;
padding: 12px 18px;
border: 1px solid ${({ hasError }) => (hasError ? 'red' : '#c5c5c5')};
background-color: transparent;
border-radius: 6px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,15 @@ export const FormDescription = styled.div`
color: #444;
margin-top: -20px;
margin-bottom: 48px;
padding: 0 15px;
padding: 12px 18px;
background-color: #f5f5f5;
border-radius: 6px;

${media.mobile} {
font-size: 0.95rem;
line-height: 1.5;

padding: 4px 6px;
}
`;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import useMixpanelTrack from '@/hooks/useMixpanelTrack';
import styled from 'styled-components';
import { useNavigate, useParams } from 'react-router-dom';
import { useGetClubDetail } from '@/hooks/queries/club/useGetClubDetail';

interface ButtonProps {
isRecruiting: boolean;
}
import getApplication from '@/apis/application/getApplication';
import { parseRecruitmentPeriod } from '@/utils/recruitmentPeriodParser';
import getDeadlineText from '@/utils/getDeadLineText';
import useMixpanelTrack from '@/hooks/useMixpanelTrack';

const Button = styled.button`
display: flex;
Expand Down Expand Up @@ -36,20 +35,45 @@ const Button = styled.button`
}
`;

const ClubApplyButton = ({ isRecruiting }: ButtonProps) => {
const ClubApplyButton = () => {
const { clubId } = useParams<{ clubId: string }>();
const trackEvent = useMixpanelTrack();
const navigate = useNavigate();
const trackEvent = useMixpanelTrack();

const { data: clubDetail } = useGetClubDetail(clubId!);

const handleClick = async () => {
if (!clubId || !clubDetail) return;

const handleClick = () => {
trackEvent('Club Apply Button Clicked');

//TODO: μ§€μ›μ„œλ₯Ό μž‘μ„±ν•œ λ™μ•„λ¦¬μ˜ κ²½μš°μ—λ§Œ λ¦¬λ‹€μ΄λ ‰νŠΈ
if (!isRecruiting) {
alert('지원λͺ¨μ§‘이 λ§ˆκ°λ˜μ—ˆμŠ΅λ‹ˆλ‹€. λ‹€μŒμ— 지원해 μ£Όμ„Έμš”.');
const { recruitmentStart, recruitmentEnd } = parseRecruitmentPeriod(
clubDetail.recruitmentPeriod,
);
const deadlineText = getDeadlineText(
recruitmentStart,
recruitmentEnd,
new Date(),
);

if (deadlineText === 'λͺ¨μ§‘ 마감') {
alert(`ν˜„μž¬ ${clubDetail.name} λ™μ•„λ¦¬λŠ” λͺ¨μ§‘ 기간이 μ•„λ‹™λ‹ˆλ‹€.`);
return;
}
navigate(`/application/${clubId}`);

// λͺ¨μ•„동 μ§€μ›μ„œ 확인
try {
await getApplication(clubId);
navigate(`/application/${clubId}`);
} catch (err: unknown) {
const externalFormLink = clubDetail.externalApplicationUrl?.trim();

if (externalFormLink) {
window.open(externalFormLink, '_blank', 'noopener,noreferrer');
} else {
alert('동아리 λͺ¨μ§‘ 정보λ₯Ό ν™•μΈν•΄μ£Όμ„Έμš”.');
}
}
};

return <Button onClick={handleClick}>μ§€μ›ν•˜κΈ°</Button>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ interface ClubDetailFooterProps {
}

const ClubDetailFooter = ({
recruitmentPeriod,
recruitmentForm,
presidentPhoneNumber,
recruitmentPeriod
}: ClubDetailFooterProps) => {
const { recruitmentStart, recruitmentEnd } =
parseRecruitmentPeriod(recruitmentPeriod);
Expand All @@ -24,10 +22,10 @@ const ClubDetailFooter = ({
new Date(),
);

return (
return (
<Styled.ClubDetailFooterContainer>
<DeadlineBadge deadlineText={deadlineText} />
<ClubApplyButton isRecruiting={deadlineText !== 'λͺ¨μ§‘ 마감'} />
<ClubApplyButton />
</Styled.ClubDetailFooterContainer>
);
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import * as Styled from './ClubDetailHeader.styles';
import ClubProfile from '@/pages/ClubDetailPage/components/ClubProfile/ClubProfile';
import ClubApplyButton from '@/pages/ClubDetailPage/components/ClubApplyButton/ClubApplyButton';
import { parseRecruitmentPeriod } from '@/utils/recruitmentPeriodParser';
import getDeadlineText from '@/utils/getDeadLineText';

interface ClubDetailHeaderProps {
name: string;
category: string;
Expand All @@ -20,19 +19,7 @@ const ClubDetailHeader = ({
division,
tags,
logo,
recruitmentPeriod,
recruitmentForm,
presidentPhoneNumber,
}: ClubDetailHeaderProps) => {
const { recruitmentStart, recruitmentEnd } =
parseRecruitmentPeriod(recruitmentPeriod);

const deadlineText = getDeadlineText(
recruitmentStart,
recruitmentEnd,
new Date(),
);

return (
<Styled.ClubDetailHeaderContainer>
<ClubProfile
Expand All @@ -42,7 +29,7 @@ const ClubDetailHeader = ({
tags={tags}
logo={logo}
/>
<ClubApplyButton isRecruiting={deadlineText !== 'λͺ¨μ§‘ 마감'} />
<ClubApplyButton />
</Styled.ClubDetailHeaderContainer>
);
};
Expand Down
1 change: 1 addition & 0 deletions frontend/src/types/club.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export interface ClubDetail extends Club {
recruitmentPeriod: string;
recruitmentTarget: string;
socialLinks: Record<SNSPlatform, string>;
externalApplicationUrl?: string;
}

export interface ClubDescription {
Expand Down