Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion apps/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"react": "^19.1.1",
"react-dom": "^19.1.1",
"react-error-boundary": "^6.0.0",
"react-router-dom": "^7.8.2"
"react-router-dom": "^7.8.2",
"lottie-react": "^2.4.1"
},
"devDependencies": {
"@eslint/js": "^9.33.0",
Expand Down
1 change: 1 addition & 0 deletions apps/client/src/assets/5_chippiface.json

Large diffs are not rendered by default.

42 changes: 31 additions & 11 deletions apps/client/src/pages/level/Level.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { Icon } from '@pinback/design-system/icons';
import { cn } from '@pinback/design-system/utils';
import LevelScene from '@pages/level/components/LevelScene';
import TreeStatusCard from '@pages/level/components/TreeStatusCard';
import { getTreeLevel } from '@shared/utils/treeLevel';
import { TreeLevel } from '@pages/level/types/treeLevelType';
import { Badge } from '@pinback/design-system/ui';
import { useGetArcons } from '@shared/apis/queries';
import { lazy, Suspense } from 'react';
import { Balloon } from '@shared/components/balloon/Balloon';

const LevelInfoCard = lazy(
() => import('@pages/level/components/LevelInfoCard')
);
Expand All @@ -15,8 +16,8 @@ const NextAcornTime = lazy(() => import('./components/NextAcornTime'));
export default function Level() {
const { data, isPending, isError } = useGetArcons();

if (isPending) return <div></div>;
if (isError) return <div></div>;
if (isPending) return <div />;
if (isError) return <div />;

const acornCount = data.acornCount;
const nextAcornTime = data.nextRemind;
Expand All @@ -27,22 +28,35 @@ export default function Level() {
const defaultLevel: TreeLevel = 1;
const level = isPending ? defaultLevel : (info.level as TreeLevel);

const balloonText =
acornCount >= 7
? '도토리를 모두 모았어요!'
: `다음 레벨까지 저장한 북마크 ${
acornCount === 0 || acornCount % 2 === 0 ? 1 : 2
}개 다시 읽기`;

return (
<div className={cn('bg-subcolor mx-auto h-dvh w-full overflow-hidden')}>
<div className="relative h-full w-full overflow-hidden rounded-[1.2rem]">
<LevelScene level={level} />

<div className="absolute inset-0">
<div className="flex flex-col items-start gap-[2rem] px-[8rem] py-[5.2rem]">
<div className="flex flex-row items-center gap-[0.8rem]">
<h1 className="head3 text-font-black-1">치삐의 지식나무 숲</h1>

<div className="relative items-center">
<button
type="button"
className="peer flex items-center justify-center p-[0.4rem]"
className="peer flex items-center justify-center gap-[4px] p-[0.4rem]"
aria-describedby="level-info-card"
>
<Icon name="ic_info" width={20} height={20} />
<span className="body3-r text-font-gray-3">
치삐의 지식나무 숲, 어떻게하면 성장하나요?
</span>
</button>

<div
id="level-info-card"
className={cn(
Expand All @@ -59,15 +73,21 @@ export default function Level() {
</div>
</div>

<Badge
text="오늘 모은 도토리 개수"
countNum={acornCount}
isActive={true}
/>
<div className="flex">
<TreeStatusCard acorns={acornCount} />
<div className="relative inline-block">
<Badge
text="오늘 모은 도토리 개수"
countNum={acornCount}
isActive={true}
/>

<div className="absolute left-1/2 top-full z-[3] mt-[0.8rem] -translate-x-[53px]">
<Balloon variant="gray" side="top">
<span className="caption1-m text-white">{balloonText}</span>
</Balloon>
</div>
</div>
</div>

{isLevel5 && (
<Suspense fallback={null}>
<NextAcornTime
Expand Down
4 changes: 2 additions & 2 deletions apps/client/src/shared/components/balloon/Balloon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ export function Balloon({
<div className="relative inline-block">
<div
className={cn(
'relative flex items-start gap-3 rounded-[4px] p-[1.2rem]',
'relative flex w-full items-start whitespace-nowrap rounded-[5.5px] px-[1.2rem] py-[0.8rem]',
variantStyle[variant]
)}
>
<div className="flex-1">{children}</div>

{onClose && (
<button type="button" onClick={onClose}>
<Icon name="ic_close" size={16} />
<Icon name="ic_close" size={20} />
</button>
)}
</div>
Expand Down
35 changes: 35 additions & 0 deletions apps/client/src/shared/components/sidebar/JobPinGuidePortal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { createPortal } from 'react-dom';
import { Balloon } from '@shared/components/balloon/Balloon';

interface Props {
anchorEl: HTMLElement | null;
open: boolean;
onClose?: () => void;
}

export default function JobPinGuidePortal({ anchorEl, open, onClose }: Props) {
if (!open || !anchorEl) return null;

const rect = anchorEl.getBoundingClientRect();

return createPortal(
<div
style={{
position: 'fixed',
left: rect.right + 12,
top: rect.top + rect.height / 2,
transform: 'translateY(-50%)',
zIndex: 10,
}}
>
<Balloon variant="gray" side="left" onClose={onClose}>
<div className="flex flex-col gap-[0.2rem] text-white">
<span className="caption1-sb">새 기능이 생겼어요</span>
<span className="body4-r">같은 직무의 사람들이</span>
<span className="body4-r">북마크한 아티클을 살펴봐요</span>
</div>
</Balloon>
</div>,
document.body
);
}
Loading
Loading