Customize chatbot appearance with primary color#476
Conversation
📝 Walkthrough요약채봇 로더 스크립트 태그에 세 가지 데이터 속성(data-primary-color, data-button-color, data-user-message-bg)을 추가하여 위젯의 색상 커스터마이제이션을 구현하는 변경사항입니다. 변경 사항
추정 코드 리뷰 노력🎯 1 (Trivial) | ⏱️ ~2 minutes 관련된 가능성 있는 PR
제안 리뷰어
시
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Pull request overview
This PR customizes the chatbot widget appearance by adding color configuration attributes to match the application's primary color (#FF4500, also known as OrangeRed). The chatbot is loaded from an external script (chatbot.gistory.me) and configured through data attributes.
Changes:
- Added three color-related data attributes to the chatbot Script component to customize the widget's appearance
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/app/[lng]/layout.tsx (1)
130-132: 동일한 색상 값이 세 곳에 중복 하드코딩됨브랜드 색상이 변경될 경우 세 속성을 모두 수정해야 합니다. 상수로 추출하거나
NEXT_PUBLIC_CHATBOT_PRIMARY_COLOR같은 환경 변수로 관리하면 유지보수가 용이해집니다.♻️ 제안하는 리팩토링 (환경 변수 방식 예시)
.env파일에 색상 상수 추가:+NEXT_PUBLIC_CHATBOT_PRIMARY_COLOR=#ff4500코드에서 참조:
+ {process.env.NEXT_PUBLIC_CHATBOT_WIDGET_KEY && ( <Script src="https://chatbot.gistory.me/loader.js" data-widget-key={process.env.NEXT_PUBLIC_CHATBOT_WIDGET_KEY} data-button-icon="logo" - data-primary-color="ff4500" - data-button-color="ff4500" - data-user-message-bg="ff4500" + data-primary-color={process.env.NEXT_PUBLIC_CHATBOT_PRIMARY_COLOR} + data-button-color={process.env.NEXT_PUBLIC_CHATBOT_PRIMARY_COLOR} + data-user-message-bg={process.env.NEXT_PUBLIC_CHATBOT_PRIMARY_COLOR} /> + )}🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/app/`[lng]/layout.tsx around lines 130 - 132, Extract the repeated hex color used in layout.tsx (currently assigned to data-primary-color, data-button-color, data-user-message-bg) into a single source of truth: either a constant (e.g., CHATBOT_PRIMARY_COLOR) or an environment variable (e.g., NEXT_PUBLIC_CHATBOT_PRIMARY_COLOR), and replace the three hardcoded values with references to that symbol so changing the brand color requires only one update; update any type or runtime access code that reads process.env in layout.tsx to safely fallback if the env var is missing.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/app/`[lng]/layout.tsx:
- Around line 130-132: The data attributes data-primary-color,
data-button-color, and data-user-message-bg in the layout component are missing
the '#' prefix on their hex values; update the values used in
src/app/[lng]/layout.tsx (where these attributes are set) to use valid CSS hex
notation (e.g., change "ff4500" to "#ff4500" or "#FF4500"), ensuring consistency
of casing if desired.
---
Nitpick comments:
In `@src/app/`[lng]/layout.tsx:
- Around line 130-132: Extract the repeated hex color used in layout.tsx
(currently assigned to data-primary-color, data-button-color,
data-user-message-bg) into a single source of truth: either a constant (e.g.,
CHATBOT_PRIMARY_COLOR) or an environment variable (e.g.,
NEXT_PUBLIC_CHATBOT_PRIMARY_COLOR), and replace the three hardcoded values with
references to that symbol so changing the brand color requires only one update;
update any type or runtime access code that reads process.env in layout.tsx to
safely fallback if the env var is missing.
챗봇 위젯 색깔(위젯, 전송 버튼, 말풍선)을 #FF4500으로 변경
Summary by CodeRabbit