Skip to content

Commit

Permalink
Merge pull request #84 from Team-inglo/feat/IGW-49/73
Browse files Browse the repository at this point in the history
Feat/igw-49/73 - 회원가입 동의 모달 에러 해결 및 고용주 프로필 api
  • Loading branch information
hyeona01 authored Oct 31, 2024
2 parents 4757d15 + 6e0e248 commit 9ab479b
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 25 deletions.
23 changes: 15 additions & 8 deletions src/components/Employer/Profile/EmployerJobInfo.tsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,37 @@
import { EmployerInfoData } from '@/constants/profile';
// import { useGetOwnerApplicationCounts } from '@/hooks/api/useProfile';
import { useGetOwnerApplicationCounts } from '@/hooks/api/useProfile';
import { EmployerCountsInfoResponse } from '@/types/api/profile';
import { useEffect, useState } from 'react';

const EmployerJobInfo = () => {
// const { data } = useGetOwnerApplicationCounts();
const data = EmployerInfoData;
const { data } = useGetOwnerApplicationCounts();
const [jobData, setJobData] = useState<EmployerCountsInfoResponse>();

useEffect(() => {
if (data) {
setJobData(data.data);
}
}, [data]);

return (
<>
{data && data.success ? (
{jobData ? (
<div className="flex gap-4 items-center justify-between">
<div className="flex flex-col gap-3 w-24 py-2 px-1">
<div className="body-3 text-[#1E1926] text-center">올린 공고</div>
<div className="head-3 text-[#1E1926] text-center">
{data.data.job_postings_counts}
{jobData.job_postings_counts}
</div>
</div>
<div className="flex flex-col gap-3 py-2 px-1">
<div className="body-3 text-[#1E1926] text-center">지원자 총합</div>
<div className="head-3 text-[#1E1926] text-center">
{data.data.applicants_counts}
{jobData.applicants_counts}
</div>
</div>
<div className="flex flex-col gap-3 w-24 py-2 px-1">
<div className="body-3 text-[#1E1926] text-center">계약 성공</div>
<div className="head-3 text-[#1E1926] text-center">
{data.data.successful_hire_counts}
{jobData.successful_hire_counts}
</div>
</div>
</div>
Expand Down
20 changes: 13 additions & 7 deletions src/components/Employer/Profile/EmployerProfileCard.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
import { EmployerSummaryData } from '@/constants/profile';
// import { usegetOwnerSummaries } from '@/hooks/api/useProfile';
import { usegetOwnerSummaries } from '@/hooks/api/useProfile';
import { EmployerProfileResponse } from '@/types/api/profile';
import { useEffect, useState } from 'react';

const EmployerProfileCard = () => {
// const { data } = usegetOwnerSummaries();
const data = EmployerSummaryData;
const { data } = usegetOwnerSummaries();
const [profileData, setProfileData] = useState<EmployerProfileResponse>();

useEffect(() => {
if (data) {
setProfileData(data.data);
}
}, [data]);
return (
<>
{data && data.success ? (
{profileData ? (
<div className="pt-5 pb-4 flex items-center gap-4">
<div className="w-20 h-20 rounded-full overflow-hidden">
<img src={data?.data.icon_img_url} alt="profile image" />
<img src={profileData.icon_img_url} alt="profile image" />
</div>
<h1 className="head-3 text-[#1E1926]">{data?.data.company_name}</h1>
<h1 className="head-3 text-[#1E1926]">{profileData.company_name}</h1>
</div>
) : (
<div>로딩 중</div>
Expand Down
4 changes: 2 additions & 2 deletions src/components/Employer/Signup/AgreeModalInner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ const AgreeModalInner = ({
title="Agree"
onClick={
essentialAgreeList.slice(0, 3).includes(false)
? handleNext
: undefined
? undefined
: handleNext
}
/>
</div>
Expand Down
9 changes: 8 additions & 1 deletion src/components/Profile/ProfileHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import { headerTranslation } from '@/constants/translation';
import { isEmployer } from '@/utils/signup';
import { useLocation } from 'react-router-dom';

const ProfileHeader = () => {
const { pathname } = useLocation();
return (
<section className="w-full h-[3.5rem] flex justify-center items-center">
<span className="head-3 text-[#464646]">Profile</span>
<span className="head-3 text-[#464646]">
{headerTranslation.profile[isEmployer(pathname)]}
</span>
</section>
);
};
Expand Down
11 changes: 4 additions & 7 deletions src/components/Profile/ProfileMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import LogoutIcon from '@/assets/icons/Profile/LogoutIcon.svg?react';
import ToggleBar from '@/assets/icons/Profile/ToggleBar.svg?react';
import ToggleButton from '@/assets/icons/Profile/ToggleButton.svg?react';
import { usePatchNotificationAllowed } from '@/hooks/api/useSetting';
import { useGetUserSummaries } from '@/hooks/api/useProfile';
import { usegetOwnerSummaries } from '@/hooks/api/useProfile';

type ProfileMenuProps = {
title: string;
Expand All @@ -25,17 +25,14 @@ const ProfileMenu = ({
isToggle,
}: ProfileMenuProps) => {
const { mutate: patchNotificationAllowed } = usePatchNotificationAllowed();
const { data: notificaionAllowed } = useGetUserSummaries();
const { data: notificaionAllowed } = usegetOwnerSummaries();

// const { data } = useGetUserSummaries();
const [toggleOn, setToggleOn] = useState<boolean>(false);

useEffect(() => {
// 알림 설정 상태 불러오기
if (isToggle && notificaionAllowed && notificaionAllowed.success) {
setToggleOn(
notificaionAllowed.data.user_information.is_notification_allowed,
);
if (isToggle && notificaionAllowed) {
setToggleOn(notificaionAllowed.data.is_notification_allowed);
}
}, []);

Expand Down
7 changes: 7 additions & 0 deletions src/constants/translation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,10 @@ export const profileTranslation = {
en: 'Delete',
},
};

export const headerTranslation = {
profile: {
ko: '프로필',
en: 'Profile',
},
};

0 comments on commit 9ab479b

Please sign in to comment.