Skip to content

캐릭터 하드코딩 데이터 대신 서버의 데이터를 사용하도록 수정#60

Merged
yoouyeon merged 3 commits into
developfrom
fix/MD-23
Jun 7, 2026
Merged

캐릭터 하드코딩 데이터 대신 서버의 데이터를 사용하도록 수정#60
yoouyeon merged 3 commits into
developfrom
fix/MD-23

Conversation

@yoouyeon

@yoouyeon yoouyeon commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

💻 작업 내용

이전

  • CHARACTER_DATA config 객체에 캐릭터별 이미지 크기, 설명 등을 하드코딩
  • CharacterSharePage에서 DOM 요소를 html-to-image로 캡처해 PNG 다운로드
  • CharacterType이 CHARACTER_DATA의 키에 의존

변경 후

  • CHARACTER_DATA 제거, API 응답의 imageUrl / imageBigUrl 직접 사용
  • CharacterSharePage: data.imageUrl을 로 표시하고 fetch → blob → saveAs로 다운로드
  • CharacterData.name 타입을 string으로 변경 (CharacterType 제거)

✅ 테스트 리스트

  • 캐릭터 획득 바텀시트 이미지 정상 표시
  • 캐릭터 공유 페이지 이미지 정상 표시
  • PC에서 이미지 크기 제한 확인 (max-width: 19.375rem)
  • 이미지 저장 버튼 동작 확인

📸 스크린샷

캐릭터 바텀 시트 캐릭터 공유 페이지 캐릭터 도감
캐릭터 바텀 시트 캐릭터 공유 화면 캐릭터 도감

👻 리뷰 요구사항

이미지 다운로드가 CORS 에러로 인해서 동작하지 않습니다...
AllowedOrigins 설정을 했음에도 불구하고 안되고 있어서 원인을 찾아봐야 하는 상황입니다!!
(코드래빗 리뷰를 위해서 일단 열어두고, 이 문제 해결한 뒤에 머지하겠습니다 .. ㅠ)

Summary by CodeRabbit

  • Refactor
    • 캐릭터 데이터 참조를 제거하고 이미지 관련 처리와 렌더링을 단순화했습니다.
  • Style
    • 캐릭터 카드의 패딩 및 이미지 레이아웃을 조정해 표시가 더 일관되도록 개선했습니다.
  • Bug Fixes
    • 이미지 다운로드 방식을 개선해 파일명 처리와 실패/성공 알림을 일관되게 안정화했습니다.

@yoouyeon yoouyeon added the 🔨 Refactor 코드 구조 개선 label Jun 6, 2026
@coderabbitai

coderabbitai Bot commented Jun 6, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 5a09992d-dde2-4f36-8345-7b3a1fd5795c

📥 Commits

Reviewing files that changed from the base of the PR and between d11cfcb and 34f58b8.

📒 Files selected for processing (1)
  • src/pages/characterShare/CharacterSharePage.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/pages/characterShare/CharacterSharePage.tsx

📝 Walkthrough

Walkthrough

CHARACTER_DATA 설정 객체를 제거하고 타입 제약을 완화합니다. 이미지 참조 방식을 imageBigUrl 필드로 통일하고, 캐릭터 UI 컴포넌트의 스타일을 통합한 후, 공유 페이지의 다운로드 메커니즘을 DOM 캡처에서 직접 이미지 fetch로 변경합니다.

Changes

Character 데이터 참조 마이그레이션

Layer / File(s) Summary
타입 시스템에서 CHARACTER_DATA 의존성 제거
src/entities/character/model/character.type.ts
CharacterType을 CHARACTER_DATA 키 타입에서 제거하고, CharacterData.name을 string으로 완화합니다. StarCount 타입은 유지하되 선언 위치가 정리되었습니다.
이미지 렌더링 스타일 컴포넌트 통합
src/features/character-management/ui/CharacterBottomSheet/index.styles.ts, src/pages/characterShare/CharacterSharePage.styles.ts
BottomSheet와 SharePage에서 CharacterImage styled 컴포넌트를 도입해 이미지 크기 제약(max-width, max-height, object-fit)과 카드 패딩(0.5rem 2.5rem)을 고정값으로 관리합니다. 기존 CharacterName/CharacterDescription 스타일은 제거되었습니다.
컴포넌트 이미지 참조 업데이트
src/features/character-management/ui/CharacterBottomSheet/index.tsx, src/features/character-management/ui/CharacterItem/index.tsx
BottomSheet와 CharacterItem에서 CHARACTER_DATA import를 제거하고 이미지 필드를 imageBigUrl로 변경하여 S.CharacterImage로 렌더링하도록 통합했습니다.
이미지 다운로드 메커니즘 재구현
src/pages/characterShare/CharacterSharePage.tsx
다운로드를 DOM 캡처(html-to-image)에서 fetch(data.imageUrl)response.blob()saveAs(blob, <sanitized>.png)로 변경하고, 토스트 처리를 try/catch로 통일했습니다. 카드 렌더링에서 CHARACTER_DATA 기반 빅 이미지 로직과 ref 연결이 제거되어 S.CharacterImage로 단순화되었습니다.

Possibly Related PRs

  • moddo-kr/moddo-frontend#31: CHARACTER_DATA 캐릭터 설정 객체 및 이를 참조하는 캐릭터 UI/타입 레이어 변경으로 직접 연관됩니다.

Suggested Labels

✨ Feature

Poem

🐰 캐릭터 데이터를 바꿔 담고,
이미지 길 새로 닦아
다운로드는 fetch로 가볍게,
타입은 자유로워지고
스타일은 통일되니
변화의 춤을 춘다네! 🎨✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/MD-23

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

github-actions Bot commented Jun 6, 2026

Copy link
Copy Markdown

📝 관련 이슈

MD-23

@github-actions github-actions Bot requested a review from ongheong June 6, 2026 13:50
@yoouyeon

yoouyeon commented Jun 6, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 6, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
src/pages/characterShare/CharacterSharePage.styles.ts (2)

50-54: 💤 Low value

CharacterImage 스타일 컴포넌트가 중복 정의되어 있습니다.

src/features/character-management/ui/CharacterBottomSheet/index.styles.ts에도 CharacterImage가 존재하지만 스타일이 다릅니다:

  • BottomSheet: max-width: 100%; max-height: 100%; object-fit: contain;
  • SharePage: width: 100%; max-width: 19.375rem; height: auto;

사용 컨텍스트가 다르다면 현재 구조가 적절할 수 있으나, 향후 변경 시 양쪽을 모두 수정해야 하는 점을 유의하시기 바랍니다.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/pages/characterShare/CharacterSharePage.styles.ts` around lines 50 - 54,
There are two distinct styled components both named CharacterImage (used in
CharacterSharePage and CharacterBottomSheet) which risks confusion and duplicate
edits; either consolidate them into one shared, configurable component (e.g., a
single CharacterImage that accepts props like maxWidth, maxHeight, and
objectFit) and import it into both CharacterSharePage and CharacterBottomSheet,
or rename the two implementations to distinct names (e.g., CharacterImageShare
and CharacterImageBottomSheet) and update their imports; update references where
CharacterImage is used so the correct variant or prop-driven styling is applied.

26-26: ⚡ Quick win

패딩 값 일부는 토큰으로 치환 가능하지만(0.5rem), 2.5rem은 현재 토큰으로 대체 불가

src/pages/characterShare/CharacterSharePage.styles.tsCharacterCardContainer padding: 0.5rem 2.5rem;0.5rem(8px)getToken('padding.3')로 대체 가능합니다.
다만 2.5rem(40px)은 semantic spacing 토큰 padding.1~padding.7에 대응 값이 없어(padding.8+ 없음) getToken('padding.*')로 치환하기 어렵습니다.

padding: 0.5rem 2.5rem;
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/pages/characterShare/CharacterSharePage.styles.ts` at line 26,
CharacterCardContainer's padding uses hardcoded values "0.5rem 2.5rem"; replace
the 0.5rem with the token getToken('padding.3') and avoid the raw 2.5rem by
adding a new semantic spacing token (e.g., padding.8 = 2.5rem) to your design
tokens and then use getToken('padding.8') in CharacterCardContainer so both
horizontal and vertical paddings are expressed via tokens.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/pages/characterShare/CharacterSharePage.tsx`:
- Line 21: The call saveAs(blob, `${data.name}.png`) may fail if data.name
contains invalid filesystem characters; update the code around saveAs to
sanitize data.name before building the filename (e.g., create a helper
sanitizeFileName(name) that strips or replaces characters like / \ : * ? " < > |
and trims whitespace), ensure the sanitized result is not empty (use a safe
fallback like "share"), and then call saveAs(blob, `${sanitizedName}.png`) so
the saved filename is always filesystem-safe.

---

Nitpick comments:
In `@src/pages/characterShare/CharacterSharePage.styles.ts`:
- Around line 50-54: There are two distinct styled components both named
CharacterImage (used in CharacterSharePage and CharacterBottomSheet) which risks
confusion and duplicate edits; either consolidate them into one shared,
configurable component (e.g., a single CharacterImage that accepts props like
maxWidth, maxHeight, and objectFit) and import it into both CharacterSharePage
and CharacterBottomSheet, or rename the two implementations to distinct names
(e.g., CharacterImageShare and CharacterImageBottomSheet) and update their
imports; update references where CharacterImage is used so the correct variant
or prop-driven styling is applied.
- Line 26: CharacterCardContainer's padding uses hardcoded values "0.5rem
2.5rem"; replace the 0.5rem with the token getToken('padding.3') and avoid the
raw 2.5rem by adding a new semantic spacing token (e.g., padding.8 = 2.5rem) to
your design tokens and then use getToken('padding.8') in CharacterCardContainer
so both horizontal and vertical paddings are expressed via tokens.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f7ee4649-9417-410d-a898-542c8f6914b7

📥 Commits

Reviewing files that changed from the base of the PR and between 9fb4fb7 and d11cfcb.

📒 Files selected for processing (7)
  • src/entities/character/config/character.ts
  • src/entities/character/model/character.type.ts
  • src/features/character-management/ui/CharacterBottomSheet/index.styles.ts
  • src/features/character-management/ui/CharacterBottomSheet/index.tsx
  • src/features/character-management/ui/CharacterItem/index.tsx
  • src/pages/characterShare/CharacterSharePage.styles.ts
  • src/pages/characterShare/CharacterSharePage.tsx
💤 Files with no reviewable changes (1)
  • src/entities/character/config/character.ts

Comment thread src/pages/characterShare/CharacterSharePage.tsx Outdated
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 6, 2026

Copy link
Copy Markdown

Deploying moddo-frontend with  Cloudflare Pages  Cloudflare Pages

Latest commit: 34f58b8
Status: ✅  Deploy successful!
Preview URL: https://c20a5328.moddo-frontend.pages.dev
Branch Preview URL: https://fix-md-23.moddo-frontend.pages.dev

View logs

@yoouyeon

yoouyeon commented Jun 6, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 6, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@yoouyeon

yoouyeon commented Jun 7, 2026

Copy link
Copy Markdown
Contributor Author

이미지 저장 안되는 이슈는 일단 현재 배포버전에서도 발생중인 문제라서... 우선 해당 작업은 개발 브랜치에 머지하고 별도 브랜치에서 문제 수정하도록 하겠습니다!!!

@yoouyeon yoouyeon merged commit 41b466b into develop Jun 7, 2026
3 checks passed
@yoouyeon yoouyeon deleted the fix/MD-23 branch June 7, 2026 12:39
@yoouyeon yoouyeon mentioned this pull request Jun 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔨 Refactor 코드 구조 개선

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant