-
Notifications
You must be signed in to change notification settings - Fork 1
[Feature/#233] 플랫폼 연동 페이지 UI 구현 #234
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
Open
YermIm
wants to merge
9
commits into
develop
Choose a base branch
from
feature/#233
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 5 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
f9a745d
feat: 플랫폼 연동 목록 mock 데이터 및 타입 추가
YermIm 48f1464
feat: 플랫폼 연동 UI 및 라우드 연결
YermIm f3b4391
feat: 플랫폼 연동 UI 및 라우드 연결
YermIm ce93ffd
feat: 사이드바에 뱃지 추가
YermIm 8693a0a
feat: skeleton ui
YermIm 6d7c294
feat: 카드 세부사항 및 추후 연동 플랫폼 추가
YermIm c5f9ab9
chore: 머지 및 충돌 해결
YermIm 276e955
chore: 주석 삭제
YermIm e3a8a6b
fix: 코드래빗 리뷰 반영
YermIm 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,164 @@ | ||
| import { memo, type ReactNode } from "react"; | ||
|
|
||
| import { PLATFORM_MAP } from "@/types/dashboard/platform"; | ||
| import type { | ||
| IPlatformConnectionItem, | ||
| TIntegrationProvider, | ||
| TPlatformConnectionStatus, | ||
| } from "@/types/integration/platformConnection"; | ||
|
|
||
| import Badge, { type TBadgeVariant } from "@/components/common/badge/Badge"; | ||
| import Button from "@/components/common/button/Button"; | ||
|
|
||
| import GoogleLogo from "@/assets/logo/social-logo/circle/google-circle.svg?react"; | ||
| import MetaLogo from "@/assets/logo/social-logo/circle/meta-circle.svg?react"; | ||
| import NaverLogo from "@/assets/logo/social-logo/circle/naver-circle.svg?react"; | ||
|
|
||
| const PLATFORM_LOGOS: Record<TIntegrationProvider, ReactNode> = { | ||
| GOOGLE: <GoogleLogo className="h-12 w-12" />, | ||
| NAVER: <NaverLogo className="h-12 w-12" />, | ||
| META: <MetaLogo className="h-12 w-12" />, | ||
| }; | ||
|
|
||
| const STATUS_LABEL: Record<TPlatformConnectionStatus, string> = { | ||
| disconnected: "미연동", | ||
| connected: "연동됨", | ||
| error: "연동 오류", | ||
| syncing: "동기화 중", | ||
| }; | ||
|
|
||
| /** 안정=infoBlue · 주의=infoYellow · 위험=infoRed · 중립=surface (Badge variant 추가 없음) */ | ||
| const CONNECTION_STATUS_BADGE: Record< | ||
| TPlatformConnectionStatus, | ||
| TBadgeVariant | ||
| > = { | ||
| connected: "infoBlue", | ||
| syncing: "infoYellow", | ||
| error: "infoRed", | ||
| disconnected: "surface", | ||
| }; | ||
|
|
||
| type TProps = IPlatformConnectionItem & { | ||
| onConnect?: () => void; | ||
| onReconnect?: () => void; | ||
| onDisconnect?: () => void; | ||
| }; | ||
|
|
||
| function formatSyncedAt(iso?: string) { | ||
| if (!iso) return null; | ||
| const date = new Date(iso); | ||
| if (Number.isNaN(date.getTime())) return iso; | ||
| return date.toLocaleString("ko-KR", { | ||
| year: "numeric", | ||
| month: "2-digit", | ||
| day: "2-digit", | ||
| hour: "2-digit", | ||
| minute: "2-digit", | ||
| }); | ||
| } | ||
|
|
||
| function PlatformIntegrationCard({ | ||
| provider, | ||
| status, | ||
| lastSyncedAt, | ||
| errorMessage, | ||
| onConnect, | ||
| onReconnect, | ||
| onDisconnect, | ||
| }: TProps) { | ||
| const label = PLATFORM_MAP[provider] ?? provider; | ||
| const syncedLabel = formatSyncedAt(lastSyncedAt); | ||
|
|
||
| return ( | ||
| <div className="flex h-full min-h-70 w-full flex-col gap-5 rounded-3xl bg-surface-100 p-8 shadow-Soft"> | ||
| <div className="flex min-w-0 items-center justify-between gap-3"> | ||
| <div className="flex min-w-0 items-center gap-3"> | ||
| <div className="shrink-0">{PLATFORM_LOGOS[provider]}</div> | ||
| <h3 className="min-w-0 truncate font-heading3 text-text-title"> | ||
| {label} | ||
| </h3> | ||
| </div> | ||
| <Badge | ||
| variant={CONNECTION_STATUS_BADGE[status]} | ||
| className="h-8 shrink-0 font-body2" | ||
| > | ||
| {STATUS_LABEL[status]} | ||
| </Badge> | ||
| </div> | ||
|
|
||
| {syncedLabel ? ( | ||
| <p className="font-body2 text-text-muted"> | ||
| 마지막 동기화 · {syncedLabel} | ||
| </p> | ||
| ) : null} | ||
|
|
||
| {status === "error" && errorMessage ? ( | ||
| <p className="font-body2 text-info-red" role="alert"> | ||
| {errorMessage} | ||
| </p> | ||
| ) : null} | ||
|
|
||
| <div className="flex-1" aria-hidden /> | ||
|
|
||
| <div className="mt-auto flex w-full flex-col gap-4"> | ||
| {status === "disconnected" ? ( | ||
| <p className="font-body2 text-text-muted/80"> | ||
| 광고 계정을 연동하면 대시보드와 캠페인에서 데이터를 확인할 수 | ||
| 있습니다. | ||
| </p> | ||
| ) : null} | ||
|
|
||
| <div className="flex w-full flex-wrap gap-4"> | ||
| {status === "disconnected" ? ( | ||
| <Button type="button" size="big" fullWidth onClick={onConnect}> | ||
| 연동하기 | ||
| </Button> | ||
| ) : null} | ||
|
|
||
| {status === "connected" ? ( | ||
| <> | ||
| <Button | ||
| type="button" | ||
| variant="outline" | ||
| size="big" | ||
| className="min-w-0 flex-1" | ||
| onClick={onReconnect} | ||
| > | ||
| 재연동 | ||
| </Button> | ||
| <Button | ||
| type="button" | ||
| variant="dangerSoft" | ||
| size="big" | ||
| className="min-w-0 flex-1" | ||
| onClick={onDisconnect} | ||
| > | ||
| 연결 해제 | ||
| </Button> | ||
| </> | ||
| ) : null} | ||
|
|
||
| {status === "error" ? ( | ||
| <Button | ||
| type="button" | ||
| variant="outline" | ||
| size="big" | ||
| fullWidth | ||
| onClick={onReconnect} | ||
| > | ||
| 재연동 | ||
| </Button> | ||
| ) : null} | ||
|
|
||
| {status === "syncing" ? ( | ||
| <Button type="button" size="small" fullWidth disabled> | ||
| 동기화 중… | ||
| </Button> | ||
| ) : null} | ||
| </div> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| export default memo(PlatformIntegrationCard); |
49 changes: 49 additions & 0 deletions
49
src/components/integration/skeleton/PlatformIntegrationsSkeleton.tsx
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,49 @@ | ||
| import { | ||
| Skeleton, | ||
| SkeletonCircle, | ||
| } from "@/components/common/skeleton/Skeleton"; | ||
|
|
||
| const SKELETON_COUNT = 3; | ||
|
|
||
| export function PlatformIntegrationCardSkeleton() { | ||
| return ( | ||
| <div | ||
| className="flex h-full min-h-70 w-full flex-col gap-5 rounded-3xl bg-surface-100 p-8 shadow-Soft" | ||
| aria-hidden | ||
| > | ||
| <div className="flex min-w-0 items-center justify-between gap-3"> | ||
| <div className="flex min-w-0 items-center gap-3"> | ||
| <SkeletonCircle className="h-12 w-12 shrink-0" /> | ||
| <Skeleton className="h-6 w-24" /> | ||
| </div> | ||
| <Skeleton className="h-8 w-16 shrink-0 rounded-full" /> | ||
| </div> | ||
|
|
||
| <div className="flex w-full flex-col gap-3"> | ||
| <Skeleton className="h-4 w-full max-w-60" /> | ||
| </div> | ||
|
|
||
| <div className="flex-1" aria-hidden /> | ||
|
|
||
| <div className="mt-auto flex w-full flex-col gap-4"> | ||
| <Skeleton className="h-14 w-full rounded-2xl" /> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| export default function PlatformIntegrationsPageSkeleton() { | ||
| return ( | ||
| <ul | ||
| className="grid w-full min-w-0 list-none grid-cols-3 items-stretch gap-6 p-0 m-0 tablet:grid-cols-1" | ||
| aria-busy="true" | ||
| aria-label="플랫폼 연동 목록 로딩 중" | ||
| > | ||
| {Array.from({ length: SKELETON_COUNT }, (_, i) => ( | ||
| <li key={i} className="flex h-full min-h-0 w-full min-w-0"> | ||
| <PlatformIntegrationCardSkeleton /> | ||
| </li> | ||
| ))} | ||
| </ul> | ||
| ); | ||
| } |
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
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,27 @@ | ||
| import type { IPlatformConnectionItem } from "@/types/integration/platformConnection"; | ||
|
|
||
| import { useCoreQuery } from "@/hooks/customQuery"; | ||
|
|
||
| import { platformConnectionsMock } from "@/pages/integration/platformIntegrations.mock"; | ||
| import useWorkspaceStore from "@/store/useWorkspaceStore"; | ||
|
|
||
| export function needsIntegrationAttention( | ||
| items: IPlatformConnectionItem[] | undefined, | ||
| ): boolean { | ||
| return items?.some((item) => item.status === "error") ?? false; | ||
| } | ||
|
|
||
| export function usePlatformConnections() { | ||
| const orgId = useWorkspaceStore((s) => s.selectedOrgId); | ||
|
|
||
| return useCoreQuery( | ||
| ["platform-connections", orgId], | ||
| async () => { | ||
| await new Promise((resolve) => { | ||
| setTimeout(resolve, 800); | ||
| }); | ||
| return platformConnectionsMock; | ||
| }, | ||
| { 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.