Skip to content

Commit

Permalink
Merge pull request #133 from Team-inglo/feat/IGW-59/132
Browse files Browse the repository at this point in the history
[Feat/igw-59/132] 홈/공고 검색/알림 디자인 오류 수정하기
  • Loading branch information
naarang authored Dec 15, 2024
2 parents b39e1fe + 112167c commit c400f32
Show file tree
Hide file tree
Showing 14 changed files with 79 additions and 68 deletions.
2 changes: 1 addition & 1 deletion src/components/Common/Header/TextFieldHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const TextFieldHeader = ({
placeholder={placeholder}
/>
{value && (
<button onClick={onClickDeleteButton}>
<button onClick={onClickDeleteButton} className="ml-2">
<CircleDeleteIcon />
</button>
)}
Expand Down
16 changes: 9 additions & 7 deletions src/components/Employer/ApplicantList/EmployerApplicantList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ const EmployerApplicationList = ({
);

const [applicantData, setApplicantData] = useState<ApplicantItemType[]>([]);
const [isLoading, setIsLoading] = useState<boolean>(false);

const { data, fetchNextPage, hasNextPage, isFetchingNextPage } =
useGetApplicantList(
Expand All @@ -55,8 +54,7 @@ const EmployerApplicationList = ({

const targetRef = useInfiniteScroll(() => {
if (hasNextPage && !isFetchingNextPage) {
setIsLoading(true);
fetchNextPage().finally(() => setIsLoading(false));
fetchNextPage();
}
}, !!hasNextPage);

Expand All @@ -81,10 +79,14 @@ const EmployerApplicationList = ({
/>
</div>
</div>
{applicantData?.map((data: ApplicantItemType) => (
<EmployerApplicationCard key={data.id} applicantData={data} />
))}
{isLoading && <LoadingItem />}
{applicantData?.length > 0 ? (
applicantData.map((data: ApplicantItemType) => (
<EmployerApplicationCard key={data.id} applicantData={data} />
))
) : (
<div className="mt-8 w-full text-center body-2">지원자가 없습니다.</div>
)}
{isFetchingNextPage && <LoadingItem />}
<div ref={targetRef} className="h-1"></div>
</section>
);
Expand Down
17 changes: 13 additions & 4 deletions src/components/Home/HomeApplicationCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,21 @@ const HomeApplicationCard = ({ applicationData }: HomeApplicationCardProps) => {
};

return (
<article className="flex flex-col gap-[0.5rem] px-[1.25rem] pt-[0.75rem] pb-[1.25rem] min-w-[17.5rem] bg-white rounded-[1rem] shadow-cardShadow">
<div className="w-fit px-[0.438rem] py-[0.125rem] caption-2 bg-[#1E1926] rounded-[0.188rem] text-[#F4F4F9]">
<article className="flex flex-col gap-2 px-5 pt-3 pb-5 min-w-fit bg-white rounded-2xl shadow-cardShadow">
<div className="w-fit px-[0.438rem] py-[0.125rem] caption-2 bg-[#1E1926] rounded-sm text-[#F4F4F9]">
Under the Review
</div>
<div className="w-full flex gap-[1rem] items-center">
<div className='w-[2rem] h-[2rem] rounded-[0.5rem] bg-cover bg-[url("/src/assets/images/JobIconExample.jpeg")]'></div>
<div className="w-full flex gap-4 items-center">
{applicationData?.icon_img_url ? (
<div
className="w-8 min-w-8 h-8 rounded-lg bg-cover bg-[#F4F4F9]"
style={{
backgroundImage: `url(${applicationData.icon_img_url})`,
}}
></div>
) : (
<div className="w-8 min-w-8 h-8 rounded-lg bg-[#F4F4F9]"></div>
)}
<div className="flex-1">
<h5 className="pb-[0.125rem] button-2 text-[#171719]">
{applicationData.title}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Home/HomeJobPostingList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const HomeJobPostingList = () => {

return (
<section className="w-full bg-[#FEF387]">
<nav className="flex gap-[0.5rem] w-full py-[1rem] px-[2rem] rounded-t-[1rem] bg-white">
<nav className="flex justify-evenly w-full py-4 px-2 rounded-t-2xl bg-white sticky top-0">
<button onClick={() => scrollToSelectedMenu(POST_SEARCH_MENU.TRENDING)}>
<Tag
value={
Expand Down
2 changes: 1 addition & 1 deletion src/components/Home/HomeRecommendPostCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const HomeRecommendPostCard = ({
<MessageIcon />
<div>
<p className="pb-[0.5rem] caption-1 text-[#656565] break-words whitespace-normal">
he recommendation notice for {name.replace(/-/g, ' ')} has arrived !
The recommendation notice for {name.replace(/-/g, ' ')} has arrived !
</p>
<div className="button-2 text-[#1E1926] break-words whitespace-normal">
Job Title {')'} {jobPostingData.title}
Expand Down
8 changes: 5 additions & 3 deletions src/components/PostApply/PostApplyResume.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ const PostApplyResume = () => {
const { data: userData } = useGetResume(account_type === UserType.USER);
const { data: ownerData } = useGetApplicantResume(
Number(currentApplicantId),
!isNaN(Number(currentApplicantId)) && account_type === UserType.OWNER ? true : false,
!isNaN(Number(currentApplicantId)) && account_type === UserType.OWNER
? true
: false,
);

const data = account_type === UserType.OWNER ? ownerData : userData;
Expand Down Expand Up @@ -151,15 +153,15 @@ const PostApplyResume = () => {
Social Intergration
</h5>
<div className="px-[0.5rem] py-[0.25rem] rounded-[0.188rem] border-[0.031rem] border-[#7872ED] text-[#7872ED] bg-[#2801E81F] caption-2">
Level {data?.data?.languages.social_integration}
LEVEL {data?.data?.languages.social_integration}
</div>
</div>
<div className="flex justify-between items-center w-full py-[1rem] px-[0.75rem] rounded-[0.75rem] bg-[#F4F4F980]">
<h5 className="pb-[0.125rem] button-2 text-[#464646]">
Sejong Institute
</h5>
<div className="px-[0.5rem] py-[0.25rem] rounded-[0.188rem] border-[0.031rem] border-[#7872ED] text-[#7872ED] bg-[#2801E81F] caption-2">
Level {data?.data?.languages.sejong_institute}
LEVEL {data?.data?.languages.sejong_institute}
</div>
</div>
{data?.data?.languages.etc?.map((data: LanguageType) => (
Expand Down
7 changes: 4 additions & 3 deletions src/components/PostDetail/PostDetailContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,6 @@ const PostDetailContent = ({ postDetailData }: PostDetailContentProps) => {
<div ref={(e) => (scrollRef.current[1] = e)}>
<div className="flex flex-col gap-[0.25rem] px-[0.5rem] pb-[0.5rem]">
<h3 className="text-[#1E1926] head-3">Workplace Information</h3>
<p className="text-[#656565] button-2">Recruitment Period</p>
<p className="text-[#656565] caption-1">Open recruitment</p>
</div>
<Map
center={{
Expand Down Expand Up @@ -184,7 +182,10 @@ const PostDetailContent = ({ postDetailData }: PostDetailContentProps) => {
{postDetailData.working_conditions.work_day_times
.filter(
(value) =>
!(value.work_start_time === "시간" && value.work_end_time === "무관")
!(
value.work_start_time === '시간' &&
value.work_end_time === '무관'
),
)
.map(
(value) =>
Expand Down
24 changes: 12 additions & 12 deletions src/components/PostSearch/PostSearchFilterList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ const PostSearchFilterList = () => {

const regionIndex = findFilterIndex(region1, region2, region3);

if (regionIndex !== -1) return;
if (regionIndex === -1) return;

const newFilterList = {
...filterList,
Expand All @@ -101,20 +101,20 @@ const PostSearchFilterList = () => {
),
};
updateFilterList(newFilterList);
} else {
const newFilterList = {
...filterList,
[tag.category]: filterList[tag.category as FILTER_CATEGORY].filter(
(value) => value !== tag.value,
),
};
updateFilterList(newFilterList);
}

const newFilterList = {
...filterList,
[tag.category]: filterList[tag.category as FILTER_CATEGORY].filter(
(value) => value !== tag.value,
),
};
updateFilterList(newFilterList);
};

return (
<section className="relative w-full pt-[0.75rem] pb-[0.5rem] pr-[2.5rem]">
<div className="w-full min-h-[1.5rem] pl-[1.5rem] flex items-center gap-[0.5rem] overflow-x-scroll whitespace-nowrap no-scrollbar">
<section className="relative w-full pt-3 pb-2 pr-10">
<div className="w-full min-h-6 pr-6 pl-6 flex items-center gap-2 overflow-x-scroll whitespace-nowrap no-scrollbar">
{formatFilterListToTag().map((value, index) => (
<Tag
key={`${index}_${value.category}`}
Expand All @@ -130,7 +130,7 @@ const PostSearchFilterList = () => {
))}
</div>
<button
className="absolute top-0 right-0 px-2 pr-6 py-[0.75rem] bg-white"
className="absolute top-0 right-0 px-2 pr-6 py-3 bg-white"
onClick={goToPostSearchFilterPage}
>
<FilterIcon />
Expand Down
2 changes: 1 addition & 1 deletion src/components/PostSearchFilter/PostSearchFilterArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ const PostSearchFilterArea = ({

const isValidRegionData = REGION_DATA[region1Depth];
if (isValidRegionData && isValidRegionData[region]) {
setRegion3DepthData(isValidRegionData[region]);
setRegion3DepthData(['전체', ...isValidRegionData[region]]);
} else {
setRegion3DepthData([]);
}
Expand Down
16 changes: 9 additions & 7 deletions src/pages/Alarm/AlarmPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ const AlarmPage = () => {
const navigate = useNavigate();

const [alarmList, setAlarmList] = useState<AlarmItemType[]>([]);
const [isLoading, setIsLoading] = useState<boolean>(false);

const readAlarm = async (id: number) => {
const result = await mutateAsync(id);
Expand All @@ -30,8 +29,7 @@ const AlarmPage = () => {

const targetRef = useInfiniteScroll(() => {
if (hasNextPage && !isFetchingNextPage) {
setIsLoading(true);
fetchNextPage().finally(() => setIsLoading(false));
fetchNextPage();
}
}, !!hasNextPage);

Expand All @@ -51,10 +49,14 @@ const AlarmPage = () => {
title="Notification"
/>
<section className="flex flex-col gap-[1rem] w-full p-[1rem] pb-[5rem]">
{alarmList?.map((data) => (
<AlarmCard key={data.id} alarmData={data} readAlarm={readAlarm} />
))}
{isLoading && <LoadingItem />}
{alarmList?.length > 0 ? (
alarmList.map((data) => (
<AlarmCard key={data.id} alarmData={data} readAlarm={readAlarm} />
))
) : (
<div className="mt-8 w-full text-center body-2">알람이 없습니다.</div>
)}
{isFetchingNextPage && <LoadingItem />}
</section>
<div ref={targetRef} className="h-1"></div>
</>
Expand Down
5 changes: 2 additions & 3 deletions src/pages/PostSearch/PostSearchPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ const PostSearchPage = () => {
const { account_type } = useUserStore();
const { searchText, updateSearchText, filterList, sortType, updateSortType } =
usePostSearchStore();
const [searchParams, setSearchParams] = useState<GetPostListReqType>(
formatSearchFilter(searchText, sortType, filterList),
);
const [searchParams, setSearchParams] =
useState<GetPostListReqType>(formatSearchFilter());

const [postData, setPostData] = useState<JobPostingItemType[]>([]);
const [isLoading, setIsLoading] = useState<boolean>(false);
Expand Down
26 changes: 9 additions & 17 deletions src/store/postSearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
PostSortingType,
} from '@/types/PostSearchFilter/PostSearchFilterItem';
import { create } from 'zustand';
import { persist } from 'zustand/middleware';

type PostSearchStore = {
sortType: PostSortingType | POST_SEARCH_MENU;
Expand All @@ -19,19 +18,12 @@ type PostSearchStore = {
updateFilterList: (newFilterList: PostSearchFilterItemType) => void;
};

export const usePostSearchStore = create(
persist<PostSearchStore>(
(set) => ({
sortType: POST_SORTING.RECENT,
searchText: '',
filterList: initialFilterList,
updateSortType: (type) => set(() => ({ sortType: type })),
updateSearchText: (text) => set(() => ({ searchText: text })),
updateFilterList: (newFilterList) =>
set(() => ({ filterList: newFilterList })),
}),
{
name: 'postSearchStore',
},
),
);
export const usePostSearchStore = create<PostSearchStore>()((set) => ({
sortType: POST_SORTING.RECENT,
searchText: '',
filterList: initialFilterList,
updateSortType: (type) => set(() => ({ sortType: type })),
updateSearchText: (text) => set(() => ({ searchText: text })),
updateFilterList: (newFilterList) =>
set(() => ({ filterList: newFilterList })),
}));
2 changes: 0 additions & 2 deletions src/utils/clearAllStore.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { usePostSearchStore } from '@/store/postSearch';
import { useEmailTryCountStore } from '@/store/signup';
import {
useCurrentApplicantIdStore,
Expand All @@ -11,7 +10,6 @@ import { useUserStore } from '@/store/user';
// store 전역 변수 초기화
export const clearAllStore = () => {
useUserStore.persist.clearStorage();
usePostSearchStore.persist.clearStorage();
useEmailTryCountStore.persist.clearStorage();
useCurrentPostIdStore.persist.clearStorage();
useCurrentApplicantIdStore.persist.clearStorage();
Expand Down
18 changes: 12 additions & 6 deletions src/utils/formatSearchFilter.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
import { FILTER_CATEGORY, POST_SEARCH_MENU } from '@/constants/postSearch';
import {
FILTER_CATEGORY,
initialFilterList,
POST_SEARCH_MENU,
} from '@/constants/postSearch';
import { PostSearchFilterItemType } from '@/types/PostSearchFilter/PostSearchFilterItem';

export const formatSearchFilter = (
searchText: string,
sortType: 'POPULAR' | 'RECENT' | POST_SEARCH_MENU,
filterList: PostSearchFilterItemType,
searchText: string = '',
sortType: 'POPULAR' | 'RECENT' | POST_SEARCH_MENU = 'POPULAR',
filterList: PostSearchFilterItemType = initialFilterList,
) => {
const newSearchFilter = {
size: 5,
search: searchText ?? null,
sorting: sortType,
region_1depth: filterList[FILTER_CATEGORY.REGION_1DEPTH].join(','),
region_2depth: filterList[FILTER_CATEGORY.REGION_2DEPTH].join(','),
region_2depth: filterList[FILTER_CATEGORY.REGION_2DEPTH]
.map((value) => (value === '전체' ? 'none' : value))
.join(','),
region_3depth: filterList[FILTER_CATEGORY.REGION_3DEPTH]
.map((value) => (value === '' ? 'none' : value))
.map((value) => (value === '' || value === '전체' ? 'none' : value))
.join(','),
industry: filterList[FILTER_CATEGORY.INDUSTRY]
.join(',')
Expand Down

0 comments on commit c400f32

Please sign in to comment.