Skip to content

Commit

Permalink
fix: build Errors
Browse files Browse the repository at this point in the history
  • Loading branch information
eunbeann committed Aug 26, 2024
1 parent 837500d commit 84aa0f7
Show file tree
Hide file tree
Showing 9 changed files with 72 additions and 73 deletions.
8 changes: 2 additions & 6 deletions src/app/(sidebar)/my-recruit/[id]/api/useGetCardCount.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import { http } from '@/apis/http';
import { useSuspenseQuery } from '@tanstack/react-query';

export type getCardCountType = {
서류_준비: number;
과제_준비: number;
인터뷰_준비: number;
};
type getCardCountType = Record<'서류_준비' | '과제_준비' | '인터뷰_준비', number>;

type Response = { data: getCardCountType[] };
type Response = { data: getCardCountType };

const getCardCount = (id: string) => {
return http.get<getCardCountType>({
Expand Down
3 changes: 2 additions & 1 deletion src/app/(sidebar)/my-recruit/[id]/api/useGetRecruitById.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { http } from '@/apis/http';
import { useSuspenseQuery } from '@tanstack/react-query';

interface recruitByIdType {
id: number;
title: string;
Expand All @@ -8,7 +9,7 @@ interface recruitByIdType {
recruitStatus: string;
}

type Response = { data: recruitByIdType[] };
type Response = { data: recruitByIdType };

const getRecruitById = (id: string) => {
return http.get<recruitByIdType>({
Expand Down
4 changes: 3 additions & 1 deletion src/app/(sidebar)/my-recruit/[id]/api/useGetSeason.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ export interface SeasonType {
name: string;
}

type Response = { data: SeasonType[] };

const getSeasons = () => {
return http.get<SeasonType[]>({
url: `/seasons`,
Expand All @@ -17,5 +19,5 @@ export function useGetSeasons() {
queryFn: () => getSeasons(),
});

return result.data as unknown as SeasonType[];
return result.data as unknown as Response;
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,16 @@ import TagList from './TagList';

const PROGRESS_OPTIONS = ['서류_준비', '과제_준비', '인터뷰_준비'] as const;

export type ProgressType = (typeof PROGRESS_OPTIONS)[number];

export function DetailContent({ recruitId }: { recruitId: string }) {
const [currentOption, setCurrentOption] = useState<(typeof PROGRESS_OPTIONS)[number]>('서류_준비');
const [currentOption, setCurrentOption] = useState<ProgressType>('서류_준비');
const [selectedTags, setSelectedTags] = useState<string[]>([]);

const { data: cardCount } = useGetCardCount(recruitId);
const { data: tagsData } = useGetAllTags();
const { data: cardList } = useGetRecruitCards({ id: recruitId, progress: currentOption });

const filteredCardList =
selectedTags.length > 0
? cardList?.filter((card) => card.tagList.some((tag) => selectedTags.includes(tag.name)))
Expand All @@ -46,7 +49,7 @@ export function DetailContent({ recruitId }: { recruitId: string }) {
'px-[8px] py-[2px] rounded-[6px] text-[14px] font-semibold',
isActive ? 'bg-neutral-80 text-neutral-1' : 'bg-neutral-10 text-neutral-1',
)}>
{cardCount ? cardCount[option] : 0}
{cardCount?.[option]}
</div>
</button>
);
Expand Down
51 changes: 25 additions & 26 deletions src/app/(sidebar)/my-recruit/[id]/components/DetailHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { useOutsideClick } from '@/hooks/useOutsideClick';
import { Button, Icon } from '@/system/components';
import { color } from '@/system/token/color';
import { cn } from '@/utils';
import { ChangeEvent, useRef, useState } from 'react';
import { useGetRecruitById } from '../api/useGetRecruitById';
import { usePatchTitle } from '../api/usePatchTitle';
Expand All @@ -19,6 +20,7 @@ export default function DetailHeader({ recruitId }: { recruitId: string }) {
const [isFocused, setIsFocused] = useState<boolean>(false);
const [isHovered, setIsHovered] = useState<boolean>(false);
const [isLinked, setIsLinked] = useState<boolean>(false);

useOutsideClick(tooltipRef, () => setIsLinked(false));

const handleTitleChange = (e: ChangeEvent<HTMLInputElement>) => {
Expand Down Expand Up @@ -51,34 +53,31 @@ export default function DetailHeader({ recruitId }: { recruitId: string }) {
};

return (
<div className="fixed top-0 w-full bg-white border-b-1 border-neutral-5 px-[80px] py-[24px]">
<div className="flex justify-between items-center max-w-[1580px] mx-auto">
<div className="flex gap-[0.75rem] items-center">
<SemesterSelector recruitId={recruitId} season={recruitInfoById?.season || ''} />
<ApplicationStatus recruitId={recruitId} status={recruitInfoById?.recruitStatus || ''} />
<input
className="pl-[6px] pr-[3px] px-[10px] rounded-[6px] text-neutral-95 text-heading1 font-bold border-none hover:bg-neutral-3 focus:outline-none focus:ring-2 focus:ring-mint-20 focus:ring-offset-2 focus:hover:bg-white"
onChange={handleTitleChange}
value={title}
size={title.length}
onFocus={() => setIsFocused(true)}
onBlur={handleUpdateTitle}
/>
<div className="flex gap-[0.75rem] items-center">
<SemesterSelector recruitId={recruitId} season={recruitInfoById?.season || ''} />
<ApplicationStatus recruitId={recruitId} status={recruitInfoById?.recruitStatus || ''} />
<input
className={cn(
'pl-[6px] mr-[6px] rounded-[6px] text-neutral-95 text-heading1 font-bold border-none hover:bg-neutral-3 focus:outline-none focus:ring-2 focus:ring-mint-20 focus:ring-offset-2 focus:hover:bg-white',
)}
onChange={handleTitleChange}
value={title}
onFocus={() => setIsFocused(true)}
onBlur={handleUpdateTitle}
/>

<div ref={tooltipRef} className="relative">
{!isFocused && (
<Button
className="flex justify-center items-center rounded-full hover:bg-neutral-1
<div ref={tooltipRef} className="relative">
{!isFocused && (
<Button
className="flex justify-center items-center rounded-full hover:bg-neutral-1
hover:transition-delay: 2s hover:block"
aria-label={isLinked ? 'link button' : 'unlink button'}
onMouseEnter={handleMouseEnter}
onMouseLeave={handleMouseLeave}>
<Icon name={isLinked ? 'link' : 'unlink'} size={16} color={isLinked ? color.mint40 : color.neutral40} />
</Button>
)}
<TextBubble isHovered={isHovered} linkedOn={handleSetLink} recruitId={recruitId} />
</div>
</div>
aria-label={isLinked ? 'link button' : 'unlink button'}
onMouseEnter={handleMouseEnter}
onMouseLeave={handleMouseLeave}>
<Icon name={isLinked ? 'link' : 'unlink'} size={16} color={isLinked ? color.mint40 : color.neutral40} />
</Button>
)}
<TextBubble isHovered={isHovered} linkedOn={handleSetLink} recruitId={recruitId} />
</div>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export default function SemesterSelector({ recruitId, season }: { recruitId: str
const { data: seasons } = useGetSeasons();
const { mutate: patchSeason } = usePatchSeason();

// const defaultSeason = seasons[0]?.name || '';
const [clickSemester, setClickSemester] = useState<string>(season);

const handlePatchStatus = (status: string) => {
Expand All @@ -19,7 +18,6 @@ export default function SemesterSelector({ recruitId, season }: { recruitId: str

return (
<Dropdown>
{/* TODO Content 열렸을 때 downChevron 유지되도록*/}
<Dropdown.Trigger>
<div className="flex items-center border border-gray-200 bg-white rounded px-[8px] py-[4px] group">
<p className="text-label2 font-medium">{clickSemester}</p>
Expand Down
6 changes: 3 additions & 3 deletions src/app/(sidebar)/my-recruit/[id]/components/TagList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ export default function TagList({ tagsData, selectedTags, setSelectedTags }: Tag

return (
<div className="flex items-center ml-[24px] my-[30px] ">
<div className="flex mr-[24px]">
<Icon name="tag" size={28} />
</div>
{viewAllTags ? (
<>
<div className="flex mr-[24px]">
<Icon name="tag" size={28} />
</div>
<TagSelector classNames={{ base: 'w-full mx-[24px]', trigger: cn('hover:bg-neutral-1') }}>
<TagSelector.Content defaultOpen className="absolute w-full -top-28 -left-8 bg-white">
<div className="px-16 pt-16 pb-24">
Expand Down
Loading

0 comments on commit 84aa0f7

Please sign in to comment.