-
Notifications
You must be signed in to change notification settings - Fork 1
[Feature/#271] 타임라인 조회/생성 API 연동 및 mock 데이터 교체 #281
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
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
c9b2a95
feat: Query Key 추가
jjjsun 2cb650e
feat: 타임라인 API함수 생성
jjjsun b38d110
feat: 타임라인 기간 보여줄 util함수구현
jjjsun 7465e37
feat: 타임라인 바 칸수 유틸함수, 패널 KPI 함수 만들기
jjjsun a3825ab
feat: formatDot 날자간 구별을 -에서 .으로 수정
jjjsun 08a2880
feat: 타임라인 커스텀 훅 생성
jjjsun 2333a7b
feat: 타임라인 스켈레톤 UI
jjjsun 1508d3d
feat: 타임라인 생성 모달 mock 제출을 createTimeline mutation으로 교체
jjjsun d788c08
feat: 타임라인 페이지 mock 제거 및 목록 API 연동
jjjsun ab90779
fix: Storybook Chromatic 빌드 VITE_API_BASE_URL 미설정 오류 수정
jjjsun d7a1063
fix: 다른 바 클릭시 이전 타임라인 요약 데이터 노출되지 않도록 수정
jjjsun 268e0a0
fix: 타임라인 에러 UI 접근성 및 error 타입 캐스팅 제거, 오타수정
jjjsun b612e60
fix: 타임라인 empty 상태를 전체 목록/현재 기간 기준으로 분리
jjjsun bd4c78b
fix: 이전 동일 기간 대비를 작년 동기간 대비로 타임라인 기간설정 값 변경
jjjsun f88347c
fix: lint에러 수정
jjjsun c19861f
Merge branch 'develop' into feature/#271
jjjsun 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
This file contains hidden or 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 |
|---|---|---|
| @@ -1,8 +1,19 @@ | ||
| import type { StorybookConfig } from "@storybook/react-vite"; | ||
| import type { InlineConfig } from "vite"; | ||
|
|
||
| const config: StorybookConfig = { | ||
| stories: ["../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"], | ||
| addons: ["@storybook/addon-essentials"], | ||
| framework: "@storybook/react-vite", | ||
| async viteFinal(viteConfig: InlineConfig) { | ||
| viteConfig.define = { | ||
| ...(viteConfig.define ?? {}), | ||
| "import.meta.env.VITE_API_BASE_URL": JSON.stringify( | ||
| "http://localhost:8080", | ||
| ), | ||
| }; | ||
| return viteConfig; | ||
| }, | ||
| }; | ||
|
|
||
| export default config; |
This file contains hidden or 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 hidden or 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,53 @@ | ||
| import type { ICommonResponse } from "@/types/common/common"; | ||
| import type { | ||
| ITimelineDetail, | ||
| ITimelineListItem, | ||
| ITimelineMutationResponse, | ||
| ITimelineUpsertRequest, | ||
| } from "@/types/timeline/api"; | ||
|
|
||
| import { axiosInstance } from "@/lib/axiosInstance"; | ||
|
|
||
| //타임라인 상세 조회 API | ||
| export const getTimelineDetail = async ( | ||
| orgId: number, | ||
| timelineId: number, | ||
| ): Promise<ITimelineDetail> => { | ||
| const { data } = await axiosInstance.get<ICommonResponse<ITimelineDetail>>( | ||
| `/api/org/${orgId}/timeline/${timelineId}`, | ||
| ); | ||
| return data.data; | ||
| }; | ||
|
|
||
| //타임라인 목록 조회 API | ||
| export const getTimelineList = async ( | ||
| orgId: number, | ||
| ): Promise<ITimelineListItem[]> => { | ||
| const { data } = await axiosInstance.get< | ||
| ICommonResponse<ITimelineListItem[]> | ||
| >(`/api/org/${orgId}/timeline`); | ||
| return data.data; | ||
| }; | ||
|
|
||
| //타임라인 생성 API | ||
| export const createTimeline = async ( | ||
| orgId: number, | ||
| body: ITimelineUpsertRequest, | ||
| ): Promise<ITimelineMutationResponse> => { | ||
| const { data } = await axiosInstance.post< | ||
| ICommonResponse<ITimelineMutationResponse> | ||
| >(`/api/org/${orgId}/timeline`, body, { | ||
| validateStatus: (status) => | ||
| status === 201 || (status >= 200 && status < 300), | ||
| }); | ||
| return data.data; | ||
| }; | ||
|
|
||
| //타임라인 수정 API | ||
| //export const updateTimeline = async | ||
|
|
||
| //타임라인 삭제 API | ||
| //export const deleteTimeline = async | ||
|
|
||
| //타임라인 AI 요약 요청 API | ||
| //export const requestTimelineSummary = async |
This file contains hidden or 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 hidden or 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,24 @@ | ||
| import { TIMELINE_PAGE_HEIGHT } from "@/constants/timeline/layout"; | ||
|
|
||
| import { Skeleton } from "@/components/common/skeleton/Skeleton"; | ||
|
|
||
| export default function TimelineSkeleton() { | ||
| return ( | ||
| <section | ||
| className="flex flex-col w-full min-w-0" | ||
| style={{ height: TIMELINE_PAGE_HEIGHT }} | ||
| > | ||
| <div className="flex min-h-0 flex-col flex-1 rounded-2xl border border-surface-400/70 bg-surface-100"> | ||
| <div className="flex flex-col gap-4 shrink-0 border-b border-surface-400/80 px-5 py-5"> | ||
| <Skeleton className="h-6 w-48" /> | ||
| <Skeleton className="h-10 w-full" /> | ||
| </div> | ||
| <div className="flex flex-1 flex-col gap-3 p-5"> | ||
| <Skeleton className="h-14 w-full" /> | ||
| <Skeleton className="h-24 w-full" /> | ||
| <Skeleton className="h-24 w-full" /> | ||
| </div> | ||
| </div> | ||
| </section> | ||
| ); | ||
| } |
This file contains hidden or 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 hidden or 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,37 @@ | ||
| import { toast } from "sonner"; | ||
|
|
||
| import type { IApiErrorResponse } from "@/types/common/common"; | ||
| import type { ITimelineUpsertRequest } from "@/types/timeline/api"; | ||
|
|
||
| import { useCoreMutation } from "@/hooks/customQuery"; | ||
|
|
||
| import { createTimeline } from "@/api/timeline/timeline"; | ||
| import { QUERY_KEYS } from "@/lib/queryKeys"; | ||
| import useWorkspaceStore from "@/store/useWorkspaceStore"; | ||
|
|
||
| export function useCreateTimeline() { | ||
| const orgId = useWorkspaceStore((s) => s.selectedOrgId); | ||
|
|
||
| return useCoreMutation( | ||
| (body: ITimelineUpsertRequest) => { | ||
| if (orgId == null) { | ||
| return Promise.reject(new Error("워크스페이스를 선택해주세요")); | ||
| } | ||
| return createTimeline(orgId, body); | ||
| }, | ||
| { | ||
| invalidateKeys: orgId != null ? [QUERY_KEYS.timeline.list(orgId)] : [], | ||
| userOnSuccess: (data) => { | ||
| toast.success("타임라인이 생성되었습니다", { | ||
| description: `"${data.name}" 타임라인을 추가했습니다`, | ||
| }); | ||
| }, | ||
| userOnError: (error) => { | ||
| const message = | ||
| (error as IApiErrorResponse).message ?? | ||
| "타임라인 생성에 실패했습니다. 다시 시도해주세요"; | ||
| toast.error(message); | ||
| }, | ||
| }, | ||
| ); | ||
| } |
This file contains hidden or 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,15 @@ | ||
| import { useCoreQuery } from "@/hooks/customQuery"; | ||
|
|
||
| import { getTimelineDetail } from "@/api/timeline/timeline"; | ||
| import { QUERY_KEYS } from "@/lib/queryKeys"; | ||
| import useWorkspaceStore from "@/store/useWorkspaceStore"; | ||
|
|
||
| export function useTimelineDetail(timelineId: number | null) { | ||
| const orgId = useWorkspaceStore((s) => s.selectedOrgId); | ||
|
|
||
| return useCoreQuery( | ||
| QUERY_KEYS.timeline.detail(orgId, timelineId), | ||
| () => getTimelineDetail(orgId!, timelineId!), | ||
| { enabled: orgId != null && timelineId != null }, | ||
| ); | ||
| } |
This file contains hidden or 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,16 @@ | ||
| import { useCoreQuery } from "@/hooks/customQuery"; | ||
|
|
||
| import { getTimelineList } from "@/api/timeline/timeline"; | ||
| import { QUERY_KEYS } from "@/lib/queryKeys"; | ||
| import useWorkspaceStore from "@/store/useWorkspaceStore"; | ||
|
|
||
| export function useTimelineList() { | ||
| const orgId = useWorkspaceStore((s) => s.selectedOrgId); | ||
| return useCoreQuery( | ||
| QUERY_KEYS.timeline.list(orgId), | ||
| () => getTimelineList(orgId!), | ||
| { | ||
| enabled: orgId != null, | ||
| }, | ||
| ); | ||
| } |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.