Skip to content

Commit 6252818

Browse files
sumisumi
authored andcommitted
feat: 이미지 추가 및 데브 정리
1 parent c99e582 commit 6252818

12 files changed

Lines changed: 31 additions & 31 deletions

File tree

32.4 KB
Loading
5.26 KB
Loading
32.4 KB
Loading
5.26 KB
Loading
Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
import { Suspense } from 'react';
22

33
import { MobileLayout } from '@/app/[locale]/game/quiz/_components/MobileLayout';
4-
import DevModePage from '@/components/DevMode/DevModePage';
54

65
export default function QuizLayout({ children }: { children: React.ReactNode }) {
76
return (
87
<Suspense>
9-
<DevModePage>
10-
<MobileLayout background={{ url: '/assets/game/quiz/quiz-bg.webp', position: 'bottom' }}>
11-
{children}
12-
</MobileLayout>
13-
</DevModePage>
8+
<MobileLayout background={{ url: '/assets/game/quiz/quiz-bg.webp', position: 'bottom' }}>{children}</MobileLayout>
149
</Suspense>
1510
);
1611
}

apps/web/src/app/[locale]/landing/AvailablePetSection/AnimalSlider.tsx

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use client';
22

33
import { css, cx } from '_panda/css';
4+
import type { PersonaInfo } from '@gitanimals/api';
45

56
import { AnimalCard } from '@/components/AnimalCard';
67
import { MediaQuery } from '@/components/MediaQuery';
@@ -10,12 +11,7 @@ import { useGetAllPersona } from '@/hooks/query/render/useGetAllPersona';
1011
import * as styles from './AnimalSlider.style';
1112
import AnimalSliderContainerMobile from './AnimalSliderContainerMobile';
1213

13-
interface Animal {
14-
type: string;
15-
dropRate: string;
16-
}
17-
18-
function shuffle(array: Animal[]): Animal[] {
14+
function shuffle(array: PersonaInfo[]): PersonaInfo[] {
1915
return array.sort(() => Math.random() - 0.5);
2016
}
2117

@@ -26,7 +22,7 @@ function AnimalSlider() {
2622

2723
const ANIMAL_LIST = shuffle(data.personas);
2824

29-
const animalList: Animal[][] = data.personas.reduce<Animal[][]>((acc, _, idx) => {
25+
const animalList: PersonaInfo[][] = data.personas.reduce<PersonaInfo[][]>((acc, _, idx) => {
3026
if (idx % 12 === 0) {
3127
acc.push(ANIMAL_LIST.slice(idx, idx + 12));
3228
}
@@ -39,12 +35,12 @@ function AnimalSlider() {
3935
<MediaQuery
4036
desktop={
4137
<PerspectiveCenterSlider>
42-
{animalList.map((animalList: Animal[], idx) => {
38+
{animalList.map((animalList: PersonaInfo[], idx) => {
4339
return (
4440
<div key={idx}>
4541
<div className={styles.cardContainer}>
46-
{animalList.map((animal: Animal, index: number) => (
47-
<AnimalCard key={index} type={animal.type} dropRate={animal.dropRate} />
42+
{animalList.map((animal: PersonaInfo, index: number) => (
43+
<AnimalCard key={index} {...animal} />
4844
))}
4945
</div>
5046
</div>
@@ -54,10 +50,10 @@ function AnimalSlider() {
5450
}
5551
mobile={
5652
<AnimalSliderContainerMobile>
57-
{data.personas.map((animalList: Animal, idx) => {
53+
{data.personas.map((animalList: PersonaInfo, idx) => {
5854
return (
5955
<div key={idx} className={styles.cardContainerMobile}>
60-
<AnimalCard type={animalList.type} dropRate={animalList.dropRate} />
56+
<AnimalCard {...animalList} />
6157
</div>
6258
);
6359
})}

apps/web/src/app/[locale]/mypage/my-pet/SelectedPetTable.tsx

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import { overlay } from 'overlay-kit';
1515
import { toast } from 'sonner';
1616

1717
import { LOCAL_STORAGE_KEY } from '@/constants/storage';
18-
import { useDevMode } from '@/lib/devtools/devtools';
1918
import { ANIMAL_TIER_TEXT_MAP, getAnimalTierInfo } from '@/utils/animals';
2019
import { getPersonaImage } from '@/utils/image';
2120

@@ -30,18 +29,10 @@ interface SelectedPetTableProps {
3029
export function SelectedPetTable({ currentPersona, reset }: SelectedPetTableProps) {
3130
const queryClient = useQueryClient();
3231

33-
const { isDevMode } = useDevMode();
34-
3532
const t = useTranslations('Shop');
3633
const [sellPersonaId, setSellPersonaId] = useState<string | null>(null);
3734
const { setDoNotShowAgain, isChecked: isDoNotShowAgain } = useDoNotShowAgain();
3835

39-
// const { data: isEvolutionAble } = useQuery({
40-
// ...evolutionQueries.checkPersonaEvolution(currentPersona?.id as string),
41-
// enabled: !!currentPersona?.id,
42-
// select: (data) => data.evolutionAble,
43-
// });
44-
4536
const { mutate: dropPetMutation } = useMutation({
4637
mutationFn: (personaId: string) => dropPet({ personaId }),
4738
onSuccess: (data) => {
@@ -121,7 +112,7 @@ export function SelectedPetTable({ currentPersona, reset }: SelectedPetTableProp
121112
<Button variant="secondary" onClick={onMergeClick}>
122113
{t('merge')}
123114
</Button>
124-
{isEvolutionAble && isDevMode && (
115+
{isEvolutionAble && (
125116
<Button variant="secondary" onClick={onEvolutionClick}>
126117
{t('evolution')}
127118
</Button>

apps/web/src/components/AnimalCard/AnimalCard.tsx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,32 @@
11
import type { ComponentProps } from 'react';
2+
import type { PersonaInfo } from '@gitanimals/api';
23
import { CardBack, GameCard } from '@gitanimals/ui-panda';
34
import type { CardTierType } from '@gitanimals/ui-panda/src/components/Card/constants';
45

56
import { getAnimalTierInfo } from '@/utils/animals';
67
import { getPersonaImage } from '@/utils/image';
78

8-
interface AnimalCardProps {
9+
interface AnimalCardProps extends Partial<PersonaInfo> {
910
type: string;
1011
dropRate: string;
1112
}
1213

1314
function AnimalCard(props: AnimalCardProps) {
15+
props.type.includes('WHITE') && console.log('props', props);
1416
const tier = getAnimalTierInfo(Number(props.dropRate.replace('%', '')));
1517

18+
if (props.grade === 'EVOLUTION') {
19+
return (
20+
<GameCard
21+
tier="EVOLUTION"
22+
title={props.type}
23+
percentage={props.dropRate}
24+
imageUrl={getPersonaImage(props.type)}
25+
size="responsive"
26+
/>
27+
);
28+
}
29+
1630
return (
1731
<GameCard
1832
tier={tier}

apps/web/src/hooks/query/render/useGetAllPersona.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ import { useSuspenseQuery } from '@tanstack/react-query';
66
export const useGetAllPersona = (options?: Omit<UseQueryOptions<GetAllPersonaResponse>, 'queryKey' | 'queryFn'>) =>
77
useSuspenseQuery<GetAllPersonaResponse>({
88
queryKey: ['persona', 'info', 'all'],
9-
queryFn: getAllPersona,
9+
queryFn: () => getAllPersona(),
1010
...options,
1111
});
32.4 KB
Loading

0 commit comments

Comments
 (0)