Compare commits

...
Author SHA1 Message Date
skkim d3502fd421 에러메시지 수정 2026-05-13 16:59:24 +09:00
skkim f8ae482a16 배경음악 가사 표기 추가 및 파일정리 2026-05-13 14:37:57 +09:00
skkim 8a60d69467 페이지 설명, Open Graph 제목, 설명 추가 2026-05-12 17:18:04 +09:00
skkim 0a055a605c 가사 노출 형식 변경 2026-05-12 15:43:55 +09:00
skkim a155a98767 배경음악 기능 추가 및 예외 처리 수정 2026-05-12 15:22:19 +09:00
skkim cf27da30b4 링크 수정 2026-05-07 17:21:44 +09:00
skkim 8df5233fee Merge branch 'feature-credit' of https://gitea.o2o.kr/castad/o2o-castad-frontend into feature-credit 2026-05-07 15:48:14 +09:00
skkim 5796cce9c0 서비스약관, 개인정보처리방침 페이지 추가 및 푸터 링크 추가 2026-05-07 15:47:17 +09:00
skkim 310fde31d6 서비스약관, 개인정보처리방침 페이지 추가 2026-05-07 14:52:24 +09:00
skkim 324c78405a 업체명 검색시 오류메시지 추가 2026-05-06 17:30:05 +09:00
skkim 00ea49b7ed 크레딧 충전 기능 및 UI 수정 2026-05-04 13:47:38 +09:00
skkim 82dcda0038 임시 저장 2026-04-30 14:58:10 +09:00
skkim bdd52ed992 크레딧기능 추가 2026-04-28 14:32:55 +09:00
skkim 044fd21b2d 검색히스토리 추가 및 번역 수정 2026-04-24 15:50:05 +09:00
skkim 29cee13da7 프로그래스바 추가 및 UI 수정 2026-04-23 13:20:58 +09:00
skkim 6675b5301f 튜토리얼 수정 2026-04-21 15:24:26 +09:00
skkim 2b975a09eb 랜딩 페이지 UI 수정 2026-04-21 14:43:35 +09:00
skkim b1c3dd49e9 단어 수정 2026-04-16 17:11:48 +09:00
28 changed files with 1840 additions and 439 deletions

No files matched your search

+561 -53
View File
@@ -86,6 +86,7 @@
} }
.landing-section { .landing-section {
background: var(--Color-teal-800, #002224);
min-height: 100dvh; min-height: 100dvh;
width: 100%; width: 100%;
} }
@@ -779,6 +780,16 @@
white-space: nowrap; white-space: nowrap;
} }
.profile-credits {
color: rgba(255, 255, 255, 0.6);
font-size: 12px;
font-weight: 500;
margin-top: 2px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* Sidebar Language Switch */ /* Sidebar Language Switch */
.sidebar-language-switch { .sidebar-language-switch {
padding: 0 1rem 0.75rem; padding: 0 1rem 0.75rem;
@@ -2446,6 +2457,27 @@
letter-spacing: -0.006em; letter-spacing: -0.006em;
white-space: pre-line; white-space: pre-line;
flex: 1; flex: 1;
margin: 0;
}
.comp2-lyrics-paragraphs {
display: flex;
flex-direction: column;
gap: 1rem;
flex: 1;
}
.comp2-lyrics-para-section {
display: flex;
flex-direction: column;
gap: 0.3rem;
}
.comp2-lyrics-tag {
font-size: 12px;
font-weight: 700;
color: #379599;
letter-spacing: 0.05em;
} }
/* 소셜 연결 섹션 */ /* 소셜 연결 섹션 */
@@ -3931,7 +3963,7 @@
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
text-align: center; text-align: center;
max-width: 500px; max-width: 400px;
width: 100%; width: 100%;
} }
@@ -4127,10 +4159,10 @@
.url-input-autocomplete-dropdown { .url-input-autocomplete-dropdown {
position: absolute; position: absolute;
top: calc(100% + 8px); top: calc(100% + 4px);
left: 0; left: 0;
right: 0; right: 0;
background-color: #002224; background-color: #01393B;
border: 1px solid rgba(148, 251, 224, 0.2); border: 1px solid rgba(148, 251, 224, 0.2);
border-radius: 12px; border-radius: 12px;
max-height: 300px; max-height: 300px;
@@ -4246,8 +4278,9 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
z-index: 10; z-index: 20;
position: relative; position: relative;
margin-top: 50px;
} }
.hero-logo { .hero-logo {
@@ -4313,8 +4346,9 @@
/* Hero Form */ /* Hero Form */
.hero-form { .hero-form {
padding-top: 50px;
width: 100%; width: 100%;
max-width: 400px; max-width: 375px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
@@ -4344,16 +4378,14 @@
} }
.hero-input-wrapper { .hero-input-wrapper {
width: 100%;
background-color: #ffffff;
border-radius: 999px;
padding: 11px 24px;
display: flex; display: flex;
width: 100%;
height: 48px;
padding: 11px 24px;
align-items: center; align-items: center;
gap: 10px; gap: 10px;
transition: box-shadow 0.2s ease; border-radius: 999px;
box-sizing: border-box; background: var(--Color-white, #FFF);
overflow: visible;
position: relative; position: relative;
} }
@@ -4446,7 +4478,7 @@
.hero-dropdown-menu { .hero-dropdown-menu {
position: absolute; position: absolute;
top: calc(100% + 8px); top: calc(100% + 4px);
left: 0; left: 0;
min-width: 100px; min-width: 100px;
background-color: #ffffff; background-color: #ffffff;
@@ -4484,15 +4516,14 @@
/* Hero Autocomplete */ /* Hero Autocomplete */
.hero-input-container { .hero-input-container {
flex: 1; flex: 1;
position: relative;
min-width: 0; min-width: 0;
} }
.hero-autocomplete-dropdown { .hero-autocomplete-dropdown {
position: absolute; position: absolute;
top: calc(100% + 8px); top: calc(100% + 4px);
left: -24px; left: 90px;
right: -60px; right: 0;
background-color: #ffffff; background-color: #ffffff;
border: 1px solid #E5E7EB; border: 1px solid #E5E7EB;
border-radius: 12px; border-radius: 12px;
@@ -4554,7 +4585,7 @@
font-weight: 400; font-weight: 400;
color: #CEE5E6; color: #CEE5E6;
letter-spacing: -0.006em; letter-spacing: -0.006em;
margin-bottom: 24px; margin: 10px;
white-space: pre-line; white-space: pre-line;
} }
@@ -4565,6 +4596,12 @@
} }
.hero-button { .hero-button {
display: flex;
height: 48px;
padding: 11px 16px;
justify-content: center;
align-items: center;
gap: 10px;
width: 100%; width: 100%;
padding: 11px 16px; padding: 11px 16px;
border-radius: 999px; border-radius: 999px;
@@ -4701,7 +4738,7 @@
align-items: center; align-items: center;
justify-content: center; justify-content: center;
width: 100%; width: 100%;
padding: 4rem 1rem 6rem; padding: 6rem 1rem 6rem;
position: relative; position: relative;
} }
@@ -4785,7 +4822,7 @@
@media (min-width: 640px) { @media (min-width: 640px) {
.feature-grid { .feature-grid {
gap: 1.5rem; gap: 1rem;
} }
} }
@@ -4794,7 +4831,7 @@
flex-direction: row; flex-direction: row;
gap: 24px; gap: 24px;
justify-content: center; justify-content: center;
padding: 0 2rem; padding: 0 1rem;
} }
} }
@@ -4810,7 +4847,7 @@
position: relative; position: relative;
background-color: #01393B; background-color: #01393B;
border-radius: 40px; border-radius: 40px;
padding: 24px 32px; padding: 24px 24px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
@@ -4826,7 +4863,7 @@
max-width: 280px; max-width: 280px;
min-height: 340px; min-height: 340px;
padding: 24px 24px; padding: 24px 24px;
gap: 20px; gap: 16px;
} }
} }
@@ -4834,8 +4871,8 @@
.feature-card { .feature-card {
max-width: 500px; max-width: 500px;
min-height: 440px; min-height: 440px;
padding: 24px 40px; padding: 24px 24px;
gap: 24px; gap: 16px;
} }
} }
@@ -5152,6 +5189,7 @@
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
padding: 50px 16px 0 16px;
} }
/* Display Frames Container */ /* Display Frames Container */
@@ -5160,7 +5198,7 @@
flex-direction: row; flex-direction: row;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
gap: 1rem; gap: 2rem;
margin-bottom: 2rem; margin-bottom: 2rem;
width: 100%; width: 100%;
max-width: 72rem; max-width: 72rem;
@@ -5168,14 +5206,13 @@
@media (min-width: 640px) { @media (min-width: 640px) {
.display-frames { .display-frames {
gap: 1.5rem; gap: 1rem;
} }
} }
@media (min-width: 768px) { @media (min-width: 768px) {
.display-frames { .display-frames {
gap: 2rem; gap: 1rem;
margin-bottom: 3rem;
} }
} }
@@ -5188,32 +5225,22 @@
/* Display Frame - 가로 크기는 feature-card와 일치, 세로는 9:16 비율 */ /* Display Frame - 가로 크기는 feature-card와 일치, 세로는 9:16 비율 */
.display-frame { .display-frame {
display: flex; display: flex;
width: 120px; aspect-ratio: 9 / 16;
height: 213px;
border-radius: 2.5rem; border-radius: 2.5rem;
overflow: hidden; overflow: hidden;
position: relative; position: relative;
transition: all var(--transition-normal); transition: all var(--transition-normal);
} }
@media (min-width: 640px) {
.display-frame {
width: 160px;
height: 284px;
}
}
@media (min-width: 768px) { @media (min-width: 768px) {
.display-frame { .display-frame {
width: 280px; width: 280px;
height: 498px;
} }
} }
@media (min-width: 1024px) { @media (min-width: 1024px) {
.display-frame { .display-frame {
width: 340px; width: 360px;
height: 604px;
} }
} }
@@ -5392,7 +5419,7 @@
transition: all var(--transition-normal); transition: all var(--transition-normal);
border: none; border: none;
cursor: pointer; cursor: pointer;
margin-bottom: 2rem; margin-top: 30px;
} }
@media (min-width: 768px) { @media (min-width: 768px) {
@@ -5695,6 +5722,37 @@
} }
} }
/* Loading Progress Bar */
.loading-progress-wrapper {
display: flex;
flex-direction: column;
align-items: center;
gap: 8px;
margin-top: 24px;
width: 240px;
}
.loading-progress-bar {
width: 100%;
height: 4px;
background: rgba(255, 255, 255, 0.1);
border-radius: 2px;
overflow: hidden;
}
.loading-progress-fill {
height: 100%;
background: #a6ffea;
border-radius: 2px;
transition: width 0.1s linear;
}
.loading-progress-text {
font-size: 13px;
color: rgba(255, 255, 255, 0.5);
font-variant-numeric: tabular-nums;
}
/* Loading Spinner Wrapper */ /* Loading Spinner Wrapper */
.loading-spinner-wrapper { .loading-spinner-wrapper {
width: 120px; width: 120px;
@@ -7217,7 +7275,7 @@
/* Landing Footer */ /* Landing Footer */
.landing-footer { .landing-footer {
width: 100%; width: 100%;
background-color: #002224; background: var(--Color-teal-800, #002224);
padding: 40px 1.5rem; padding: 40px 1.5rem;
} }
@@ -7229,7 +7287,7 @@
@media (min-width: 1024px) { @media (min-width: 1024px) {
.landing-footer { .landing-footer {
padding: 60px 148px; padding: 60px 100px;
} }
} }
@@ -7245,12 +7303,13 @@
.footer-content { .footer-content {
flex-direction: row; flex-direction: row;
justify-content: space-between; justify-content: space-between;
align-items: flex-start; align-items: center;
gap: 4rem; gap: 4rem;
} }
} }
.footer-left { .footer-left {
min-width: 262px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 1rem; gap: 1rem;
@@ -7270,7 +7329,33 @@
line-height: 1.19; line-height: 1.19;
} }
.footer-links {
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
}
.footer-link {
font-size: 13px;
color: #379599;
text-decoration: none;
opacity: 0.8;
}
.footer-link:hover {
opacity: 1;
text-decoration: underline;
}
.footer-link-divider {
font-size: 13px;
color: #379599;
opacity: 0.5;
}
.footer-right { .footer-right {
max-width: 600px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 4px; gap: 4px;
@@ -7306,7 +7391,7 @@
top: 16px; top: 16px;
left: 50%; left: 50%;
transform: translateX(-50%); transform: translateX(-50%);
z-index: 100; z-index: 10100;
background: rgba(0, 34, 36, 0.3); background: rgba(0, 34, 36, 0.3);
border: 1px solid rgba(229, 241, 242, 0.2); border: 1px solid rgba(229, 241, 242, 0.2);
border-radius: 999px; border-radius: 999px;
@@ -7429,7 +7514,6 @@
align-items: center; align-items: center;
justify-content: center; justify-content: center;
text-align: center; text-align: center;
padding: 0 1rem;
} }
@@ -7682,6 +7766,10 @@
border-color: var(--color-mint); border-color: var(--color-mint);
} }
.sound-type-btn.active:hover:not(:disabled) {
border-color: var(--color-mint);
}
.sound-type-btn:disabled { .sound-type-btn:disabled {
opacity: 0.5; opacity: 0.5;
cursor: not-allowed; cursor: not-allowed;
@@ -7958,6 +8046,70 @@
resize: none; resize: none;
outline: none; outline: none;
line-height: 1.6; line-height: 1.6;
scrollbar-width: thin;
scrollbar-color: #046266 transparent;
}
.lyrics-textarea::-webkit-scrollbar {
width: 6px;
}
.lyrics-textarea::-webkit-scrollbar-track {
background: transparent;
}
.lyrics-textarea::-webkit-scrollbar-thumb {
background: #046266;
border-radius: 3px;
}
.lyrics-textarea::-webkit-scrollbar-thumb:hover {
background: #379599;
}
.lyrics-paragraphs {
width: 100%;
overflow-y: auto;
padding: 1rem;
display: flex;
flex-direction: column;
gap: 1.25rem;
scrollbar-color: #046266 transparent;
}
.lyrics-paragraphs::-webkit-scrollbar {
width: 6px;
}
.lyrics-paragraphs::-webkit-scrollbar-track {
background: transparent;
}
.lyrics-paragraphs::-webkit-scrollbar-thumb {
background: #046266;
border-radius: 3px;
}
.lyrics-section {
display: flex;
flex-direction: column;
gap: 0.4rem;
}
.lyrics-tag {
font-size: var(--text-xs);
font-weight: 700;
color: #379599;
letter-spacing: 0.05em;
}
.lyrics-paragraph {
font-size: var(--text-sm);
font-weight: 400;
color: #CEE5E6;
line-height: 1.9;
white-space: pre-line;
margin: 0;
} }
.lyrics-placeholder { .lyrics-placeholder {
@@ -7975,7 +8127,7 @@
/* Generate Sound Button */ /* Generate Sound Button */
.btn-generate-sound { .btn-generate-sound {
height: 48px; height: 40px;
min-width: 120px; min-width: 120px;
padding: 0.625rem 1.25rem; padding: 0.625rem 1.25rem;
background-color: #94FBE0; background-color: #94FBE0;
@@ -7992,6 +8144,7 @@
gap: 0.5rem; gap: 0.5rem;
line-height: 1.19; line-height: 1.19;
letter-spacing: -0.006em; letter-spacing: -0.006em;
margin-top: 10px;
} }
.btn-generate-sound:hover:not(.disabled) { .btn-generate-sound:hover:not(.disabled) {
@@ -8003,6 +8156,21 @@
cursor: not-allowed; cursor: not-allowed;
} }
.regenerate-hint {
font-size: 14px;
color: #CEE5E6;
text-align: center;
}
.charge-credits-link {
display: block;
margin-top: 6px;
font-size: 13px;
color: #AE72F9;
text-decoration: underline;
cursor: pointer;
}
/* Video Generate Button */ /* Video Generate Button */
.btn-video-generate { .btn-video-generate {
padding: 0.625rem 2.5rem; padding: 0.625rem 2.5rem;
@@ -8010,6 +8178,7 @@
border: none; border: none;
border-radius: var(--radius-full); border-radius: var(--radius-full);
color: #FFFFFF; color: #FFFFFF;
height: 40px;
font-size: var(--text-sm); font-size: var(--text-sm);
font-weight: 600; font-weight: 600;
cursor: pointer; cursor: pointer;
@@ -8089,6 +8258,7 @@
align-items: center; align-items: center;
justify-content: center; justify-content: center;
gap: 0.5rem; gap: 0.5rem;
margin-top: 10px;
} }
/* Responsive Styles for Sound Studio */ /* Responsive Styles for Sound Studio */
@@ -8260,8 +8430,20 @@
} }
@media (min-width: 768px) { @media (min-width: 768px) {
.asset-sticky-footer { body:has(.sidebar.expanded) .asset-sticky-footer {
left: 240px; left: 15rem;
right: 0;
width: auto;
display: flex;
justify-content: center;
}
body:has(.sidebar.collapsed) .asset-sticky-footer {
left: 5rem;
right: 0;
width: auto;
display: flex;
justify-content: center;
} }
} }
@@ -8397,6 +8579,23 @@
overflow-y: auto; overflow-y: auto;
} }
.asset-image-list::-webkit-scrollbar {
width: 6px;
}
.asset-image-list::-webkit-scrollbar-track {
background: transparent;
}
.asset-image-list::-webkit-scrollbar-thumb {
background: #067C80;
border-radius: 3px;
}
.asset-image-list::-webkit-scrollbar-thumb:hover {
background: #088a8e;
}
/* Load More Button */ /* Load More Button */
.asset-load-more { .asset-load-more {
width: 100%; width: 100%;
@@ -9274,6 +9473,232 @@
border: 1px solid rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.06);
} }
.myinfo-credits-card {
background: rgba(255, 255, 255, 0.04);
border: 1px solid rgba(255, 255, 255, 0.08);
border-radius: 16px;
padding: 2rem;
display: flex;
flex-direction: column;
gap: 1rem;
}
.myinfo-credits-row {
display: flex;
align-items: center;
justify-content: space-between;
}
.myinfo-credits-label {
color: rgba(255, 255, 255, 0.6);
font-size: 0.95rem;
}
.myinfo-credits-value {
color: #a6ffea;
font-size: 1.4rem;
font-weight: 700;
letter-spacing: 0.02em;
}
.myinfo-credits-desc {
color: rgba(255, 255, 255, 0.4);
font-size: 0.85rem;
margin: 0;
flex: 1;
}
.myinfo-credits-charge-btn {
padding: 0.75rem 1.25rem;
background: linear-gradient(135deg, #a6ffea 0%, #7ee8cf 100%);
border: none;
border-radius: 8px;
color: #002224;
font-size: 0.875rem;
font-weight: 600;
cursor: pointer;
white-space: nowrap;
transition: all 0.2s ease;
}
.myinfo-credits-charge-btn:hover {
transform: translateY(-1px);
box-shadow: 0 4px 12px rgba(166, 255, 234, 0.3);
}
.myinfo-popup-overlay {
position: fixed;
inset: 0;
background: rgba(0, 0, 0, 0.6);
display: flex;
align-items: center;
justify-content: center;
z-index: 9999;
}
.myinfo-popup {
background: #132034;
border: 1px solid rgba(78, 205, 196, 0.3);
border-radius: 16px;
padding: 2rem;
display: flex;
flex-direction: column;
align-items: center;
gap: 1.25rem;
width: 380px;
max-width: 90vw;
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.myinfo-popup-title {
color: #fff;
font-size: 1.05rem;
font-weight: 700;
margin: 0 0 0.5rem;
align-self: flex-start;
}
.myinfo-popup-message {
color: #fff;
font-size: 1.1rem;
font-weight: 600;
text-align: center;
margin: 0;
}
.myinfo-popup-field {
display: flex;
flex-direction: column;
gap: 0.4rem;
width: 100%;
}
.myinfo-popup-label {
color: rgba(255, 255, 255, 0.6);
font-size: 0.85rem;
}
.myinfo-popup-counter {
display: flex;
align-items: center;
gap: 0;
border: 1px solid rgba(255, 255, 255, 0.12);
border-radius: 8px;
overflow: hidden;
}
.myinfo-popup-counter-btn {
background: rgba(255, 255, 255, 0.08);
border: none;
color: #fff;
font-size: 1.25rem;
width: 48px;
min-width: 48px;
height: 44px;
cursor: pointer;
transition: background 0.15s;
flex-shrink: 0;
}
.myinfo-popup-counter-btn:hover {
background: rgba(255, 255, 255, 0.15);
}
.myinfo-popup-input {
background: rgba(255, 255, 255, 0.06);
border: 1px solid rgba(255, 255, 255, 0.12);
border-radius: 8px;
color: #fff;
font-size: 0.95rem;
padding: 0.6rem 0.875rem;
outline: none;
width: 100%;
box-sizing: border-box;
}
.myinfo-popup-input--center {
border: none;
border-left: 1px solid rgba(255, 255, 255, 0.12);
border-right: 1px solid rgba(255, 255, 255, 0.12);
border-radius: 0;
text-align: center;
flex: 1;
height: 44px;
padding: 0;
}
.myinfo-popup-input--center::-webkit-inner-spin-button,
.myinfo-popup-input--center::-webkit-outer-spin-button {
-webkit-appearance: none;
}
.myinfo-popup-input:focus {
border-color: rgba(78, 205, 196, 0.5);
}
.myinfo-popup-textarea {
background: rgba(255, 255, 255, 0.06);
border: 1px solid rgba(255, 255, 255, 0.12);
border-radius: 8px;
color: #fff;
font-size: 0.9rem;
padding: 0.6rem 0.875rem;
outline: none;
resize: none;
width: 100%;
box-sizing: border-box;
font-family: inherit;
}
.myinfo-popup-textarea:focus {
border-color: rgba(78, 205, 196, 0.5);
}
.myinfo-popup-actions {
display: flex;
gap: 0.75rem;
width: 100%;
justify-content: flex-end;
margin-top: 0.25rem;
}
.myinfo-popup-cancel {
background: rgba(255, 255, 255, 0.08);
color: rgba(255, 255, 255, 0.7);
border: 1px solid rgba(255, 255, 255, 0.12);
border-radius: 8px;
padding: 0.6rem 1.25rem;
font-size: 0.9rem;
cursor: pointer;
transition: background 0.2s;
}
.myinfo-popup-cancel:hover {
background: rgba(255, 255, 255, 0.13);
}
.myinfo-popup-close {
background: linear-gradient(135deg, #a6ffea 0%, #7ee8cf 100%);
color: #002224;
border: none;
border-radius: 8px;
padding: 0.6rem 1.5rem;
font-size: 0.9rem;
font-weight: 700;
cursor: pointer;
transition: opacity 0.2s;
}
.myinfo-popup-close:disabled {
opacity: 0.4;
cursor: not-allowed;
}
.myinfo-popup-close:not(:disabled):hover {
opacity: 0.85;
}
/* 내 비즈니스 카드 */ /* 내 비즈니스 카드 */
.myinfo-business-card { .myinfo-business-card {
background: rgba(255, 255, 255, 0.03); background: rgba(255, 255, 255, 0.03);
@@ -10213,6 +10638,10 @@
transform: rotate(180deg); transform: rotate(180deg);
} }
.social-posting-channel-placeholder {
color: rgba(255, 255, 255, 0.35);
}
.social-posting-channel-menu { .social-posting-channel-menu {
position: absolute; position: absolute;
top: 100%; top: 100%;
@@ -10512,7 +10941,21 @@
padding: 1.25rem 1.5rem; padding: 1.25rem 1.5rem;
border-top: 1px solid rgba(255, 255, 255, 0.1); border-top: 1px solid rgba(255, 255, 255, 0.1);
display: flex; display: flex;
justify-content: center; flex-direction: column;
align-items: center;
gap: 0.75rem;
}
.upload-progress-calendar-link {
font-size: 0.8rem;
color: rgba(255, 255, 255, 0.45);
cursor: pointer;
text-decoration: underline;
text-underline-offset: 3px;
}
.upload-progress-calendar-link:hover {
color: rgba(255, 255, 255, 0.75);
} }
.upload-progress-btn { .upload-progress-btn {
@@ -10624,13 +11067,29 @@
pointer-events: all; pointer-events: all;
} }
@keyframes tutorial-pulse {
0%, 100% {
border-color: rgba(166, 255, 234, 0.9);
box-shadow: 0 0 0 2px rgba(166, 255, 234, 0.3),
0 0 16px 4px rgba(166, 255, 234, 0.35),
0 0 40px 8px rgba(166, 255, 234, 0.15);
}
50% {
border-color: rgba(166, 255, 234, 0.5);
box-shadow: 0 0 0 5px rgba(166, 255, 234, 0.12),
0 0 32px 10px rgba(166, 255, 234, 0.5),
0 0 64px 20px rgba(166, 255, 234, 0.2);
}
}
.tutorial-spotlight-ring { .tutorial-spotlight-ring {
position: fixed; position: fixed;
border: 2px solid rgba(166, 255, 234, 0.85); border: 4px solid rgba(166, 255, 234, 0.85);
border-radius: 12px; border-radius: 12px;
box-shadow: 0 0 0 1px rgba(166, 255, 234, 0.2); box-shadow: 0 0 0 1px rgba(166, 255, 234, 0.2), 0 0 12px 2px rgba(166, 255, 234, 0.15);
pointer-events: none; pointer-events: none;
z-index: 10001; z-index: 10001;
animation: tutorial-pulse 2s ease-in-out infinite;
} }
.tutorial-tooltip { .tutorial-tooltip {
@@ -10917,3 +11376,52 @@
border-color: rgba(166, 255, 234, 0.5); border-color: rgba(166, 255, 234, 0.5);
color: #a6ffea; color: #a6ffea;
} }
/* 튜토리얼 토글 버튼 */
.tutorial-toggle-fab {
position: fixed;
top: 16px;
right: 20px;
z-index: 900;
display: flex;
align-items: center;
gap: 8px;
padding: 7px 14px;
background: rgba(0, 34, 36, 0.85);
border: 1px solid rgba(166, 255, 234, 0.25);
border-radius: 20px;
color: rgba(255, 255, 255, 0.5);
cursor: pointer;
font-size: 13px;
backdrop-filter: blur(6px);
transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.tutorial-toggle-fab:hover {
background: rgba(166, 255, 234, 0.12);
border-color: rgba(166, 255, 234, 0.5);
color: #a6ffea;
}
.tutorial-toggle-fab.active {
color: #a6ffea;
border-color: rgba(166, 255, 234, 0.4);
}
.tutorial-toggle-badge {
font-size: 10px;
font-weight: 700;
padding: 2px 6px;
border-radius: 4px;
transition: background 0.15s, color 0.15s;
}
.tutorial-toggle-badge.on {
background: #a6ffea;
color: #002224;
}
.tutorial-toggle-badge.off {
background: rgba(255, 255, 255, 0.12);
color: rgba(255, 255, 255, 0.4);
}
+9 -1
View File
@@ -4,7 +4,15 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>CASTAD</title> <title>ADO2</title>
<!-- ① 페이지 설명 -->
<meta name="description" content="ADO2는 ㈜에이아이오투오의 AI 기반 마케팅 자동화 플랫폼입니다. 콘텐츠 제작부터 채널 배포까지 자동으로 처리합니다." />
<!-- ② Open Graph 제목 -->
<meta property="og:title" content="ADO2 - AI 마케팅 자동화 플랫폼" />
<!-- ③ Open Graph 설명 -->
<meta property="og:description" content="ADO2는 ㈜에이아이오투오의 AI 기반 마케팅 자동화 플랫폼입니다. 콘텐츠 제작부터 채널 배포까지 자동으로 처리합니다." />
<meta property="og:url" content="https://demo.castad.net/" />
<meta property="og:type" content="website" />
<link rel="icon" type="image/svg+xml" href="/favicon_32.svg" sizes="32x32"> <link rel="icon" type="image/svg+xml" href="/favicon_32.svg" sizes="32x32">
<link rel="icon" type="image/svg+xml" href="/favicon_48.svg" sizes="48x48"> <link rel="icon" type="image/svg+xml" href="/favicon_48.svg" sizes="48x48">
<script src="https://cdn.tailwindcss.com"></script> <script src="https://cdn.tailwindcss.com"></script>
+16 -7
View File
@@ -13,6 +13,7 @@ import SocialConnectSuccess from './pages/Social/SocialConnectSuccess';
import SocialConnectError from './pages/Social/SocialConnectError'; import SocialConnectError from './pages/Social/SocialConnectError';
import YouTubeOAuthCallback from './pages/Social/YouTubeOAuthCallback'; import YouTubeOAuthCallback from './pages/Social/YouTubeOAuthCallback';
import { crawlUrl, autocomplete, kakaoCallback, isLoggedIn, saveTokens, AutocompleteRequest } from './utils/api'; import { crawlUrl, autocomplete, kakaoCallback, isLoggedIn, saveTokens, AutocompleteRequest } from './utils/api';
import { saveSearchHistory } from './components/SearchHistory/useSearchHistory';
import { CrawlingResponse } from './types/api'; import { CrawlingResponse } from './types/api';
type ViewMode = 'landing' | 'loading' | 'analysis' | 'login' | 'generation_flow'; type ViewMode = 'landing' | 'loading' | 'analysis' | 'login' | 'generation_flow';
@@ -96,6 +97,7 @@ const App: React.FC = () => {
parseSavedAnalysisData() parseSavedAnalysisData()
); );
const [error, setError] = useState<string | null>(null); const [error, setError] = useState<string | null>(null);
const [isAnalysisComplete, setIsAnalysisComplete] = useState(false);
const [scrollProgress, setScrollProgress] = useState(0); const [scrollProgress, setScrollProgress] = useState(0);
const [isProcessingCallback, setIsProcessingCallback] = useState(false); const [isProcessingCallback, setIsProcessingCallback] = useState(false);
@@ -256,6 +258,7 @@ const App: React.FC = () => {
if (!url.trim()) return; if (!url.trim()) return;
setViewMode('loading'); setViewMode('loading');
setIsAnalysisComplete(false);
setError(null); setError(null);
try { try {
@@ -268,11 +271,11 @@ const App: React.FC = () => {
setAnalysisData(data); setAnalysisData(data);
localStorage.setItem(ANALYSIS_DATA_KEY, JSON.stringify(data)); localStorage.setItem(ANALYSIS_DATA_KEY, JSON.stringify(data));
setViewMode('analysis'); saveSearchHistory({ type: 'url', value: url });
setIsAnalysisComplete(true);
} catch (err) { } catch (err) {
console.error('Crawling failed:', err); console.error('Crawling failed:', err);
const errorMessage = err instanceof Error ? err.message : t('app.analysisError'); setError(t('app.analysisError'));
setError(errorMessage);
setViewMode('landing'); setViewMode('landing');
} }
}; };
@@ -280,6 +283,7 @@ const App: React.FC = () => {
// 업체명 자동완성으로 분석 시작 // 업체명 자동완성으로 분석 시작
const handleAutocomplete = async (request: AutocompleteRequest) => { const handleAutocomplete = async (request: AutocompleteRequest) => {
setViewMode('loading'); setViewMode('loading');
setIsAnalysisComplete(false);
setError(null); setError(null);
try { try {
@@ -292,11 +296,11 @@ const App: React.FC = () => {
setAnalysisData(data); setAnalysisData(data);
localStorage.setItem(ANALYSIS_DATA_KEY, JSON.stringify(data)); localStorage.setItem(ANALYSIS_DATA_KEY, JSON.stringify(data));
setViewMode('analysis'); saveSearchHistory({ type: 'name', value: request.title.replace(/<[^>]*>/g, ''), address: request.address, roadAddress: request.roadAddress });
setIsAnalysisComplete(true);
} catch (err) { } catch (err) {
console.error('Autocomplete failed:', err); console.error('Autocomplete failed:', err);
const errorMessage = err instanceof Error ? err.message : t('app.autocompleteGeneralError'); setError(t('app.autocompleteError'));
setError(errorMessage);
setViewMode('landing'); setViewMode('landing');
} }
}; };
@@ -395,7 +399,12 @@ const App: React.FC = () => {
} }
if (viewMode === 'loading') { if (viewMode === 'loading') {
return <LoadingSection />; return (
<LoadingSection
isComplete={isAnalysisComplete}
onComplete={() => setViewMode('analysis')}
/>
);
} }
if (viewMode === 'analysis' && analysisData) { if (viewMode === 'analysis' && analysisData) {
+5
View File
@@ -10,6 +10,11 @@ const Footer: React.FC = () => {
<div className="footer-left"> <div className="footer-left">
<img src="/assets/images/ado2-sidebar-logo.svg" alt="ADO2" className="footer-logo" /> <img src="/assets/images/ado2-sidebar-logo.svg" alt="ADO2" className="footer-logo" />
<p className="footer-copyright">Copyright ⓒ O2O Inc. All rights reserved</p> <p className="footer-copyright">Copyright ⓒ O2O Inc. All rights reserved</p>
<div className="footer-links">
<a href="https://demo.castad.net/privacy.html" rel="noopener noreferrer" className="footer-link">{t('footer.privacyPolicy')}</a>
<span className="footer-link-divider">|</span>
<a href="https://demo.castad.net/terms.html" rel="noopener noreferrer" className="footer-link">{t('footer.termsOfService')}</a>
</div>
</div> </div>
<div className="footer-right"> <div className="footer-right">
<p className="footer-info">{t('footer.company')}</p> <p className="footer-info">{t('footer.company')}</p>
@@ -0,0 +1,58 @@
import React from 'react';
import { SearchHistoryItem } from './useSearchHistory';
interface SearchHistoryDropdownProps {
items: SearchHistoryItem[];
onSelect: (item: SearchHistoryItem) => void;
onDelete: (e: React.MouseEvent, value: string) => void;
className?: string;
itemClassName?: string;
titleClassName?: string;
addressClassName?: string;
}
const SearchHistoryDropdown: React.FC<SearchHistoryDropdownProps> = ({
items,
onSelect,
onDelete,
className = 'url-input-autocomplete-dropdown',
itemClassName = 'url-input-autocomplete-item',
titleClassName = 'url-input-autocomplete-title',
addressClassName = 'url-input-autocomplete-address',
}) => {
if (items.length === 0) return null;
return (
<div className={className}>
{items.map((item, index) => (
<div
key={index}
className={itemClassName}
style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}
>
<button
type="button"
style={{ flex: 1, textAlign: 'left', background: 'none', border: 'none', padding: 0, cursor: 'pointer' }}
onMouseDown={(e) => { e.preventDefault(); onSelect(item); }}
>
<div className={titleClassName}>{item.value}</div>
{item.roadAddress && (
<div className={addressClassName}>{item.roadAddress}</div>
)}
</button>
<button
type="button"
onMouseDown={(e) => onDelete(e, item.value)}
style={{ color:'#737983', background: 'none', border: 'none', cursor: 'pointer', padding: '0 4px', opacity: 0.8, flexShrink: 0 }}
>
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="3">
<line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/>
</svg>
</button>
</div>
))}
</div>
);
};
export default SearchHistoryDropdown;
@@ -0,0 +1,56 @@
import { useState, useEffect } from 'react';
export const SEARCH_HISTORY_KEY = 'castad_search_history';
export const SEARCH_HISTORY_MAX = 5;
export interface SearchHistoryItem {
type: 'url' | 'name';
value: string;
address?: string;
roadAddress?: string;
}
export const saveSearchHistory = (item: SearchHistoryItem) => {
try {
const saved = localStorage.getItem(SEARCH_HISTORY_KEY);
const history: SearchHistoryItem[] = saved ? JSON.parse(saved) : [];
const filtered = history.filter(h => h.value !== item.value);
const updated = [item, ...filtered].slice(0, SEARCH_HISTORY_MAX);
localStorage.setItem(SEARCH_HISTORY_KEY, JSON.stringify(updated));
} catch { /* ignore */ }
};
export const useSearchHistory = (searchType: 'url' | 'name') => {
const [history, setHistory] = useState<SearchHistoryItem[]>([]);
const [showHistory, setShowHistory] = useState(false);
useEffect(() => {
try {
const saved = localStorage.getItem(SEARCH_HISTORY_KEY);
if (saved) setHistory(JSON.parse(saved));
} catch { /* ignore */ }
}, []);
const filteredHistory = history.filter(h => h.type === searchType);
const deleteItem = (value: string) => {
const updated = history.filter(h => h.value !== value);
setHistory(updated);
localStorage.setItem(SEARCH_HISTORY_KEY, JSON.stringify(updated));
if (updated.filter(h => h.type === searchType).length === 0) {
setShowHistory(false);
}
};
const openHistory = (inputValue: string) => {
if (!inputValue && filteredHistory.length > 0) setShowHistory(true);
};
const closeHistory = () => setShowHistory(false);
const hideOnInput = (value: string) => {
if (value) setShowHistory(false);
};
return { filteredHistory, showHistory, openHistory, closeHistory, hideOnInput, deleteItem };
};
+8 -4
View File
@@ -37,9 +37,10 @@ interface SidebarProps {
onHome?: () => void; onHome?: () => void;
userInfo?: UserMeResponse | null; userInfo?: UserMeResponse | null;
onLogout?: () => void; onLogout?: () => void;
credits?: number | null;
} }
const Sidebar: React.FC<SidebarProps> = ({ activeItem, onNavigate, onHome, userInfo, onLogout }) => { const Sidebar: React.FC<SidebarProps> = ({ activeItem, onNavigate, onHome, userInfo, onLogout, credits }) => {
const { t } = useTranslation(); const { t } = useTranslation();
const [isCollapsed, setIsCollapsed] = useState(false); const [isCollapsed, setIsCollapsed] = useState(false);
const [isMobileOpen, setIsMobileOpen] = useState(false); const [isMobileOpen, setIsMobileOpen] = useState(false);
@@ -85,7 +86,7 @@ const Sidebar: React.FC<SidebarProps> = ({ activeItem, onNavigate, onHome, userI
{ id: '새 프로젝트 만들기', label: t('sidebar.newProject'), disabled: false, icon: <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg> }, { id: '새 프로젝트 만들기', label: t('sidebar.newProject'), disabled: false, icon: <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg> },
{ id: 'ADO2 콘텐츠', label: t('sidebar.ado2Contents'), disabled: false, icon: <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5"><path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"/></svg> }, { id: 'ADO2 콘텐츠', label: t('sidebar.ado2Contents'), disabled: false, icon: <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5"><path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"/></svg> },
{ id: '내 콘텐츠', label: t('sidebar.myContents'), disabled: true, icon: <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"/><circle cx="8.5" cy="8.5" r="1.5"/><polyline points="21 15 16 10 5 21"/></svg> }, { id: '내 콘텐츠', label: t('sidebar.myContents'), disabled: true, icon: <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"/><circle cx="8.5" cy="8.5" r="1.5"/><polyline points="21 15 16 10 5 21"/></svg> },
{ id: '콘텐츠 캘린더', label: '콘텐츠 캘린더', disabled: false, icon: <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5"><rect x="3" y="4" width="18" height="18" rx="2" ry="2"/><line x1="16" y1="2" x2="16" y2="6"/><line x1="8" y1="2" x2="8" y2="6"/><line x1="3" y1="10" x2="21" y2="10"/></svg> }, { id: '콘텐츠 캘린더', label: t('contentCalendar.title'), disabled: false, icon: <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5"><rect x="3" y="4" width="18" height="18" rx="2" ry="2"/><line x1="16" y1="2" x2="16" y2="6"/><line x1="8" y1="2" x2="8" y2="6"/><line x1="3" y1="10" x2="21" y2="10"/></svg> },
{ id: '내 정보', label: t('sidebar.myInfo'), disabled: false, icon: <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5"><path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/></svg> }, { id: '내 정보', label: t('sidebar.myInfo'), disabled: false, icon: <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5"><path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/></svg> },
]; ];
@@ -180,6 +181,9 @@ const Sidebar: React.FC<SidebarProps> = ({ activeItem, onNavigate, onHome, userI
{!isCollapsed && ( {!isCollapsed && (
<div className="flex-1 min-w-0"> <div className="flex-1 min-w-0">
<p className="profile-name">{userInfo?.nickname || t('sidebar.defaultUser')}</p> <p className="profile-name">{userInfo?.nickname || t('sidebar.defaultUser')}</p>
{credits !== null && credits !== undefined && (
<p className="profile-credits">{t('sidebar.credits', { count: credits })}</p>
)}
</div> </div>
)} )}
</div> </div>
@@ -200,12 +204,12 @@ const Sidebar: React.FC<SidebarProps> = ({ activeItem, onNavigate, onHome, userI
target="_blank" target="_blank"
rel="noopener noreferrer" rel="noopener noreferrer"
className={`sidebar-inquiry-btn ${isCollapsed ? 'collapsed' : ''}`} className={`sidebar-inquiry-btn ${isCollapsed ? 'collapsed' : ''}`}
title="고객의견" title={t('sidebar.inquiry')}
> >
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5"> <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5">
<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" /> <path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" />
</svg> </svg>
{!isCollapsed && <span>고객의견</span>} {!isCollapsed && <span>{t('sidebar.inquiry')}</span>}
</a> </a>
</div> </div>
</div> </div>
+44 -6
View File
@@ -12,6 +12,7 @@ interface SocialPostingModalProps {
isOpen: boolean; isOpen: boolean;
onClose: () => void; onClose: () => void;
video: VideoListItem | null; video: VideoListItem | null;
onGoToCalendar?: () => void;
} }
type PrivacyType = 'public' | 'unlisted' | 'private'; type PrivacyType = 'public' | 'unlisted' | 'private';
@@ -116,7 +117,8 @@ const MiniCalendar: React.FC<{
const SocialPostingModal: React.FC<SocialPostingModalProps> = ({ const SocialPostingModal: React.FC<SocialPostingModalProps> = ({
isOpen, isOpen,
onClose, onClose,
video video,
onGoToCalendar,
}) => { }) => {
const { t } = useTranslation(); const { t } = useTranslation();
const tutorial = useTutorial(); const tutorial = useTutorial();
@@ -140,6 +142,10 @@ const SocialPostingModal: React.FC<SocialPostingModalProps> = ({
const channelDropdownRef = useRef<HTMLDivElement>(null); const channelDropdownRef = useRef<HTMLDivElement>(null);
const privacyDropdownRef = useRef<HTMLDivElement>(null); const privacyDropdownRef = useRef<HTMLDivElement>(null);
const hasBeenOpenedRef = useRef(false); const hasBeenOpenedRef = useRef(false);
const loadedForTaskIdRef = useRef<string | null>(null);
const loadedAtRef = useRef<number>(0);
const seoCache = useRef<Map<string, { title: string; description: string; tags: string }>>(new Map());
const SEO_CACHE_TTL = 50 * 60 * 1000;
// Upload progress modal state // Upload progress modal state
const [showUploadProgress, setShowUploadProgress] = useState(false); const [showUploadProgress, setShowUploadProgress] = useState(false);
@@ -150,6 +156,7 @@ const SocialPostingModal: React.FC<SocialPostingModalProps> = ({
// 업로드 정보 (모달이 닫힌 후에도 유지) // 업로드 정보 (모달이 닫힌 후에도 유지)
const [uploadVideoTitle, setUploadVideoTitle] = useState<string>(''); const [uploadVideoTitle, setUploadVideoTitle] = useState<string>('');
const [uploadChannelName, setUploadChannelName] = useState<string>(''); const [uploadChannelName, setUploadChannelName] = useState<string>('');
const [uploadIsScheduled, setUploadIsScheduled] = useState(false);
// 드롭다운 외부 클릭 시 닫기 // 드롭다운 외부 클릭 시 닫기
useEffect(() => { useEffect(() => {
@@ -204,11 +211,28 @@ const SocialPostingModal: React.FC<SocialPostingModalProps> = ({
// 소셜 계정 로드 // 소셜 계정 로드
useEffect(() => { useEffect(() => {
if (isOpen) { if (!isOpen) return;
const now = Date.now();
loadSocialAccounts(); loadSocialAccounts();
const taskId = video?.task_id ?? null;
const expired = now - loadedAtRef.current > SEO_CACHE_TTL;
if (taskId && (taskId !== loadedForTaskIdRef.current || expired)) {
loadedForTaskIdRef.current = taskId;
loadedAtRef.current = now;
loadAutocomplete(); loadAutocomplete();
} else if (taskId) {
const cached = seoCache.current.get(taskId);
if (cached) {
setTitle(cached.title);
setDescription(cached.description);
setTags(cached.tags);
} }
}, [isOpen, video]); }
}, [isOpen, video?.task_id]);
const loadSocialAccounts = async () => { const loadSocialAccounts = async () => {
setIsLoadingAccounts(true); setIsLoadingAccounts(true);
@@ -217,7 +241,9 @@ const SocialPostingModal: React.FC<SocialPostingModalProps> = ({
const activeAccounts = response.accounts?.filter(acc => acc.is_active) || []; const activeAccounts = response.accounts?.filter(acc => acc.is_active) || [];
setSocialAccounts(activeAccounts); setSocialAccounts(activeAccounts);
if (activeAccounts.length > 0) { if (activeAccounts.length > 0) {
setSelectedChannel(activeAccounts[0].platform_user_id); const lastUsed = localStorage.getItem('lastUsedSocialChannel');
const defaultAccount = activeAccounts.find(acc => acc.platform_user_id === lastUsed) || activeAccounts[0];
setSelectedChannel(defaultAccount.platform_user_id);
} }
} catch (error) { } catch (error) {
if (error instanceof TokenExpiredError) { if (error instanceof TokenExpiredError) {
@@ -247,6 +273,11 @@ const SocialPostingModal: React.FC<SocialPostingModalProps> = ({
if (autoSeoResponse.title) setTitle(autoSeoResponse.title); if (autoSeoResponse.title) setTitle(autoSeoResponse.title);
if (autoSeoResponse.description) setDescription(autoSeoResponse.description); if (autoSeoResponse.description) setDescription(autoSeoResponse.description);
if (autoSeoResponse.keywords) setTags(autoSeoResponse.keywords.join(',')); if (autoSeoResponse.keywords) setTags(autoSeoResponse.keywords.join(','));
seoCache.current.set(video.task_id, {
title: autoSeoResponse.title || '',
description: autoSeoResponse.description || '',
tags: autoSeoResponse.keywords?.join(',') || '',
});
} catch (error) { } catch (error) {
console.error('Failed to load autocomplete:', error); console.error('Failed to load autocomplete:', error);
// 실패해도 사용자에게 별도 알림 없이 조용히 처리 // 실패해도 사용자에게 별도 알림 없이 조용히 처리
@@ -298,6 +329,7 @@ const SocialPostingModal: React.FC<SocialPostingModalProps> = ({
// 업로드 정보 저장 (모달이 닫힌 후에도 유지) // 업로드 정보 저장 (모달이 닫힌 후에도 유지)
setUploadVideoTitle(title.trim()); setUploadVideoTitle(title.trim());
setUploadChannelName(selectedAcc.display_name); setUploadChannelName(selectedAcc.display_name);
setUploadIsScheduled(publishTime === 'schedule');
setShowUploadProgress(true); setShowUploadProgress(true);
try { try {
@@ -335,6 +367,8 @@ const SocialPostingModal: React.FC<SocialPostingModalProps> = ({
throw new Error(uploadResponse.message || t('social.uploadStartFailed')); throw new Error(uploadResponse.message || t('social.uploadStartFailed'));
} }
localStorage.setItem('lastUsedSocialChannel', selectedAcc.platform_user_id);
if (publishTime === 'schedule') { if (publishTime === 'schedule') {
// 예약 업로드: 폴링 없이 바로 완료 처리 // 예약 업로드: 폴링 없이 바로 완료 처리
setUploadStatus('completed'); setUploadStatus('completed');
@@ -397,6 +431,7 @@ const SocialPostingModal: React.FC<SocialPostingModalProps> = ({
setUploadErrorMessage(undefined); setUploadErrorMessage(undefined);
setUploadVideoTitle(''); setUploadVideoTitle('');
setUploadChannelName(''); setUploadChannelName('');
setUploadIsScheduled(false);
}; };
const handleClose = () => { const handleClose = () => {
@@ -425,7 +460,8 @@ const SocialPostingModal: React.FC<SocialPostingModalProps> = ({
channelName={uploadChannelName || selectedAccount?.display_name || ''} channelName={uploadChannelName || selectedAccount?.display_name || ''}
youtubeUrl={uploadYoutubeUrl} youtubeUrl={uploadYoutubeUrl}
errorMessage={uploadErrorMessage} errorMessage={uploadErrorMessage}
isScheduled={publishTime === 'schedule'} isScheduled={uploadIsScheduled}
onGoToCalendar={onGoToCalendar}
/> />
); );
@@ -520,7 +556,7 @@ const SocialPostingModal: React.FC<SocialPostingModalProps> = ({
onClick={() => setIsChannelDropdownOpen(!isChannelDropdownOpen)} onClick={() => setIsChannelDropdownOpen(!isChannelDropdownOpen)}
> >
<div className="social-posting-channel-selected"> <div className="social-posting-channel-selected">
{selectedAccount && ( {selectedAccount ? (
<> <>
<img <img
src={getPlatformIcon(selectedAccount.platform)} src={getPlatformIcon(selectedAccount.platform)}
@@ -529,6 +565,8 @@ const SocialPostingModal: React.FC<SocialPostingModalProps> = ({
/> />
<span>{selectedAccount.display_name}</span> <span>{selectedAccount.display_name}</span>
</> </>
) : (
<span className="social-posting-channel-placeholder">{t('social.selectChannel')}</span>
)} )}
</div> </div>
<svg className="social-posting-channel-arrow" viewBox="0 0 12 8" fill="none"> <svg className="social-posting-channel-arrow" viewBox="0 0 12 8" fill="none">
+9 -1
View File
@@ -7,6 +7,7 @@ interface Rect {
left: number; left: number;
width: number; width: number;
height: number; height: number;
bottom: number;
} }
interface TooltipPos { interface TooltipPos {
@@ -29,7 +30,7 @@ function getTargetRect(selector: string): Rect | null {
const el = document.querySelector(selector); const el = document.querySelector(selector);
if (!el) return null; if (!el) return null;
const r = el.getBoundingClientRect(); const r = el.getBoundingClientRect();
return { top: r.top, left: r.left, width: r.width, height: r.height }; return { top: r.top, left: r.left, width: r.width, height: r.height, bottom: r.bottom };
} }
function getSpotlightRect( function getSpotlightRect(
@@ -48,6 +49,7 @@ function getSpotlightRect(
return { return {
top, top,
bottom,
left, left,
width: Math.max(0, right - left), width: Math.max(0, right - left),
height: Math.max(0, bottom - top), height: Math.max(0, bottom - top),
@@ -175,6 +177,12 @@ const TutorialOverlay: React.FC<TutorialOverlayProps> = ({
if (!hint) return null; if (!hint) return null;
const isTargetVisible = targetRect
? targetRect.top + 60 < window.innerHeight && targetRect.bottom > 60
: true;
if (!isTargetVisible) return null;
const spotlightPadding = hint.spotlightPadding ?? PADDING; const spotlightPadding = hint.spotlightPadding ?? PADDING;
const spotlightRect = (targetRect && !hint.noSpotlight) ? getSpotlightRect(targetRect, spotlightPadding, hint.spotlightPaddingOverride) : null; const spotlightRect = (targetRect && !hint.noSpotlight) ? getSpotlightRect(targetRect, spotlightPadding, hint.spotlightPaddingOverride) : null;
+3 -51
View File
@@ -46,14 +46,6 @@ export const tutorialSteps: TutorialStepDef[] = [
{ {
key: TUTORIAL_KEYS.LANDING, key: TUTORIAL_KEYS.LANDING,
hints: [ hints: [
// {
// targetSelector: '.tutorial-center-anchor',
// titleKey: 'tutorial.landing.intro.title',
// descriptionKey: 'tutorial.landing.intro.desc',
// position: 'bottom',
// clickToAdvance: false,
// noSpotlight: true,
// },
{ {
targetSelector: '.hero-dropdown-trigger', targetSelector: '.hero-dropdown-trigger',
titleKey: 'tutorial.landing.dropdown.title', titleKey: 'tutorial.landing.dropdown.title',
@@ -77,52 +69,12 @@ export const tutorialSteps: TutorialStepDef[] = [
titleKey: 'tutorial.landing.button.title', titleKey: 'tutorial.landing.button.title',
descriptionKey: 'tutorial.landing.button.desc', descriptionKey: 'tutorial.landing.button.desc',
position: 'right', position: 'right',
clickToAdvance: false, clickToAdvance: true,
noSpotlight: true, noSpotlight: true,
variant: 'bubble', variant: 'bubble',
}, },
], ],
}, },
// {
// key: TUTORIAL_KEYS.ANALYSIS,
// hints: [
// {
// targetSelector: '.bi2-identity-card',
// titleKey: 'tutorial.analysis.identity.title',
// descriptionKey: 'tutorial.analysis.identity.desc',
// position: 'top',
// clickToAdvance: false,
// },
// {
// targetSelector: '.bi2-selling-card',
// titleKey: 'tutorial.analysis.selling.title',
// descriptionKey: 'tutorial.analysis.selling.desc',
// position: 'top',
// clickToAdvance: false,
// },
// {
// targetSelector: '.bi2-persona-grid',
// titleKey: 'tutorial.analysis.persona.title',
// descriptionKey: 'tutorial.analysis.persona.desc',
// position: 'top',
// clickToAdvance: false,
// },
// {
// targetSelector: '.bi2-keyword-tags',
// titleKey: 'tutorial.analysis.keywords.title',
// descriptionKey: 'tutorial.analysis.keywords.desc',
// position: 'top',
// clickToAdvance: false,
// },
// {
// targetSelector: '.bi2-generate-btn',
// titleKey: 'tutorial.analysis.generate.title',
// descriptionKey: 'tutorial.analysis.generate.desc',
// position: 'right',
// clickToAdvance: true,
// },
// ],
// },
{ {
key: TUTORIAL_KEYS.ASSET, key: TUTORIAL_KEYS.ASSET,
hints: [ hints: [
@@ -167,7 +119,7 @@ export const tutorialSteps: TutorialStepDef[] = [
clickToAdvance: false, clickToAdvance: false,
}, },
{ {
targetSelector: '.language-selector-wrapper', targetSelector: '.language-grid',
titleKey: 'tutorial.sound.language.title', titleKey: 'tutorial.sound.language.title',
descriptionKey: 'tutorial.sound.language.desc', descriptionKey: 'tutorial.sound.language.desc',
position: 'top', position: 'top',
@@ -393,7 +345,7 @@ export const tutorialSteps: TutorialStepDef[] = [
titleKey: 'tutorial.contentCalendar.grid.title', titleKey: 'tutorial.contentCalendar.grid.title',
descriptionKey: 'tutorial.contentCalendar.grid.desc', descriptionKey: 'tutorial.contentCalendar.grid.desc',
position: 'top', position: 'top',
clickToAdvance: true, clickToAdvance: false,
}, },
{ {
targetSelector: '.calendar-side-panel', targetSelector: '.calendar-side-panel',
+25
View File
@@ -19,6 +19,7 @@ function getGroupProgress(key: string, currentIndex: number): { groupTotal: numb
const SEEN_KEY = 'ado2_tutorial_seen'; const SEEN_KEY = 'ado2_tutorial_seen';
const PROGRESS_KEY = 'ado2_tutorial_progress'; const PROGRESS_KEY = 'ado2_tutorial_progress';
const ENABLED_KEY = 'ado2_tutorial_enabled';
// 전역 단일 활성 튜토리얼 관리 — 새 튜토리얼 시작 시 이전 것을 skip 처리 // 전역 단일 활성 튜토리얼 관리 — 새 튜토리얼 시작 시 이전 것을 skip 처리
let globalSkip: (() => void) | null = null; let globalSkip: (() => void) | null = null;
@@ -66,6 +67,7 @@ function clearProgress(key: string) {
interface UseTutorialReturn { interface UseTutorialReturn {
isActive: boolean; isActive: boolean;
isEnabled: boolean;
isRestartPopupVisible: boolean; isRestartPopupVisible: boolean;
currentHintIndex: number; currentHintIndex: number;
hints: TutorialHint[]; hints: TutorialHint[];
@@ -75,6 +77,7 @@ interface UseTutorialReturn {
nextHint: () => void; nextHint: () => void;
prevHint: () => void; prevHint: () => void;
skipTutorial: () => void; skipTutorial: () => void;
toggleTutorial: (currentKey: string | null) => void;
showRestartPopup: (key: string) => void; showRestartPopup: (key: string) => void;
confirmRestart: () => void; confirmRestart: () => void;
cancelRestart: () => void; cancelRestart: () => void;
@@ -83,6 +86,7 @@ interface UseTutorialReturn {
export function useTutorial(): UseTutorialReturn { export function useTutorial(): UseTutorialReturn {
const [isActive, setIsActive] = useState(false); const [isActive, setIsActive] = useState(false);
const [isEnabled, setIsEnabled] = useState(() => localStorage.getItem(ENABLED_KEY) !== 'false');
const [isRestartPopupVisible, setIsRestartPopupVisible] = useState(false); const [isRestartPopupVisible, setIsRestartPopupVisible] = useState(false);
const [pendingRestartKey, setPendingRestartKey] = useState<string | null>(null); const [pendingRestartKey, setPendingRestartKey] = useState<string | null>(null);
const [currentHintIndex, setCurrentHintIndex] = useState(0); const [currentHintIndex, setCurrentHintIndex] = useState(0);
@@ -91,6 +95,7 @@ export function useTutorial(): UseTutorialReturn {
const onCompleteRef = React.useRef<(() => void) | undefined>(undefined); const onCompleteRef = React.useRef<(() => void) | undefined>(undefined);
const startTutorial = useCallback((key: string, onComplete?: () => void, forceFromStart?: boolean) => { const startTutorial = useCallback((key: string, onComplete?: () => void, forceFromStart?: boolean) => {
if (localStorage.getItem(ENABLED_KEY) === 'false') return;
const step = tutorialSteps.find(s => s.key === key); const step = tutorialSteps.find(s => s.key === key);
if (!step || step.hints.length === 0) return; if (!step || step.hints.length === 0) return;
// 다른 인스턴스에서 활성화된 튜토리얼이 있으면 skip 처리 // 다른 인스턴스에서 활성화된 튜토리얼이 있으면 skip 처리
@@ -139,6 +144,24 @@ export function useTutorial(): UseTutorialReturn {
setCurrentHintIndex(0); setCurrentHintIndex(0);
}, [tutorialKey, currentHintIndex]); }, [tutorialKey, currentHintIndex]);
const toggleTutorial = useCallback((currentKey: string | null) => {
if (isEnabled) {
// off: 튜토리얼 중단 + 비활성화
setIsActive(false);
setIsEnabled(false);
localStorage.setItem(ENABLED_KEY, 'false');
} else {
// on: seen/progress 초기화 + 현재 화면 튜토리얼 시작
localStorage.removeItem(SEEN_KEY);
localStorage.removeItem(PROGRESS_KEY);
localStorage.setItem(ENABLED_KEY, 'true');
setIsEnabled(true);
if (currentKey) {
startTutorial(currentKey, undefined, true);
}
}
}, [isEnabled, startTutorial]);
// 튜토리얼 다시 보기: 팝업 표시만 // 튜토리얼 다시 보기: 팝업 표시만
const showRestartPopup = useCallback((key: string) => { const showRestartPopup = useCallback((key: string) => {
setPendingRestartKey(key); setPendingRestartKey(key);
@@ -168,6 +191,7 @@ export function useTutorial(): UseTutorialReturn {
return { return {
isActive, isActive,
isEnabled,
isRestartPopupVisible, isRestartPopupVisible,
currentHintIndex, currentHintIndex,
hints, hints,
@@ -177,6 +201,7 @@ export function useTutorial(): UseTutorialReturn {
nextHint, nextHint,
prevHint, prevHint,
skipTutorial, skipTutorial,
toggleTutorial,
showRestartPopup, showRestartPopup,
confirmRestart, confirmRestart,
cancelRestart, cancelRestart,
+9
View File
@@ -14,6 +14,7 @@ interface UploadProgressModalProps {
youtubeUrl?: string; youtubeUrl?: string;
errorMessage?: string; errorMessage?: string;
isScheduled?: boolean; isScheduled?: boolean;
onGoToCalendar?: () => void;
} }
const UploadProgressModal: React.FC<UploadProgressModalProps> = ({ const UploadProgressModal: React.FC<UploadProgressModalProps> = ({
@@ -26,6 +27,7 @@ const UploadProgressModal: React.FC<UploadProgressModalProps> = ({
youtubeUrl, youtubeUrl,
errorMessage, errorMessage,
isScheduled = false, isScheduled = false,
onGoToCalendar,
}) => { }) => {
const { t } = useTranslation(); const { t } = useTranslation();
if (!isOpen) return null; if (!isOpen) return null;
@@ -151,9 +153,16 @@ const UploadProgressModal: React.FC<UploadProgressModalProps> = ({
{/* Footer */} {/* Footer */}
<div className="upload-progress-footer"> <div className="upload-progress-footer">
{canClose ? ( {canClose ? (
<>
<button className="upload-progress-btn primary" onClick={onClose}> <button className="upload-progress-btn primary" onClick={onClose}>
{status === 'completed' ? t('upload.confirm') : t('upload.close')} {status === 'completed' ? t('upload.confirm') : t('upload.close')}
</button> </button>
{status === 'completed' && onGoToCalendar && (
<span className="upload-progress-calendar-link" onClick={() => { onClose(); onGoToCalendar(); }}>
{t('upload.goToCalendar')}
</span>
)}
</>
) : ( ) : (
<p className="upload-progress-note">{t('upload.doNotClose')}</p> <p className="upload-progress-note">{t('upload.doNotClose')}</p>
)} )}
+117 -19
View File
@@ -12,9 +12,14 @@
"myContents": "My Contents", "myContents": "My Contents",
"myInfo": "My Info", "myInfo": "My Info",
"defaultUser": "User", "defaultUser": "User",
"credits": "Credits left: {{count}}",
"loggingOut": "Logging out...", "loggingOut": "Logging out...",
"logout": "Log Out", "logout": "Log Out",
"tutorialRestart": "Restart Tutorial" "tutorialRestart": "Restart Tutorial",
"tutorial": "Tutorial",
"tutorialOn": "Enable Tutorial",
"tutorialOff": "Disable Tutorial",
"inquiry": "Feedback"
}, },
"tutorial": { "tutorial": {
"skip": "Skip", "skip": "Skip",
@@ -27,13 +32,6 @@
"field": { "title": "Enter Search Term", "desc": "For URL, paste a Naver Maps share URL.\nFor business name, type the name and select from the list." }, "field": { "title": "Enter Search Term", "desc": "For URL, paste a Naver Maps share URL.\nFor business name, type the name and select from the list." },
"button": { "title": "Start Brand Analysis", "desc": "Click the button to let AI start analyzing your brand." } "button": { "title": "Start Brand Analysis", "desc": "Click the button to let AI start analyzing your brand." }
}, },
"analysis": {
"identity": { "title": "Brand Identity", "desc": "Check the core values and market positioning AI analyzed for your brand." },
"selling": { "title": "Key Selling Points", "desc": "See your brand's strengths." },
"persona": { "title": "Target Customer Types", "desc": "AI analyzed what kind of customers visit this brand." },
"keywords": { "title": "Recommended Keywords", "desc": "Keywords your customers are likely to search for." },
"generate": { "title": "Generate Content", "desc": "Create video content based on the analysis.\nClick to sign in with Kakao and continue." }
},
"asset": { "asset": {
"image": { "title": "Image List", "desc": "Photos from Naver Place. Tap 'Show more' to see the rest, or X to remove any." }, "image": { "title": "Image List", "desc": "Photos from Naver Place. Tap 'Show more' to see the rest, or X to remove any." },
"upload": { "title": "Add Images", "desc": "You can freely add more images." }, "upload": { "title": "Add Images", "desc": "You can freely add more images." },
@@ -41,7 +39,7 @@
"next": { "title": "Next Step", "desc": "Proceed to the next step when ready." } "next": { "title": "Next Step", "desc": "Proceed to the next step when ready." }
}, },
"sound": { "sound": {
"genre": { "title": "Select Genre", "desc": "Pick a music genre that fits your brand." }, "genre": { "title": "Select Genre", "desc": "Pick a music genre that fits your brand.", "note": "Background music is coming soon." },
"language": { "title": "Select Language", "desc": "You can choose the language for the sound.\nWant to continue with Korean?" }, "language": { "title": "Select Language", "desc": "You can choose the language for the sound.\nWant to continue with Korean?" },
"generate": { "title": "Generate Sound", "desc": "Click the button and AI will generate lyrics and music in your chosen genre and language." }, "generate": { "title": "Generate Sound", "desc": "Click the button and AI will generate lyrics and music in your chosen genre and language." },
"lyrics": { "title": "Lyrics Complete", "desc": "AI wrote lyrics in your selected language.\nCheck the generated lyrics." }, "lyrics": { "title": "Lyrics Complete", "desc": "AI wrote lyrics in your selected language.\nCheck the generated lyrics." },
@@ -100,7 +98,9 @@
"headquarters": "HQ : 41593 Unicorn Lab Daegu A05, 5F, 111 Oksan-ro, Buk-gu, Daegu, Korea", "headquarters": "HQ : 41593 Unicorn Lab Daegu A05, 5F, 111 Oksan-ro, Buk-gu, Daegu, Korea",
"researchCenter": "R&D : 13453 Rooms 504-505 (East), KT Pangyo Bldg, 32 Geumto-ro, Sujeong-gu, Seongnam-si, Gyeonggi-do, Korea", "researchCenter": "R&D : 13453 Rooms 504-505 (East), KT Pangyo Bldg, 32 Geumto-ro, Sujeong-gu, Seongnam-si, Gyeonggi-do, Korea",
"phone": "Tel : 070-4260-8310 | 010-2755-6463", "phone": "Tel : 070-4260-8310 | 010-2755-6463",
"email": "Email : o2oteam@o2o.kr" "email": "Email : o2oteam@o2o.kr",
"privacyPolicy": "Privacy Policy",
"termsOfService": "Terms of Service"
}, },
"social": { "social": {
"title": "Social Media Posting", "title": "Social Media Posting",
@@ -152,7 +152,8 @@
"viewOnYoutube": "View on YouTube", "viewOnYoutube": "View on YouTube",
"confirm": "OK", "confirm": "OK",
"close": "Close", "close": "Close",
"doNotClose": "Upload is in progress. Do not close this window." "doNotClose": "Upload is in progress. Do not close this window.",
"goToCalendar": "View in Calendar"
}, },
"landing": { "landing": {
"hero": { "hero": {
@@ -207,7 +208,7 @@
"imageAlt": "Image", "imageAlt": "Image",
"uploadBadge": "Uploaded", "uploadBadge": "Uploaded",
"imageUpload": "Image Upload", "imageUpload": "Image Upload",
"dragAndDrop": "Drag and drop\nimages to upload", "dragAndDrop": "Drag & drop or\nclick to upload",
"videoRatio": "Video Ratio", "videoRatio": "Video Ratio",
"minImages": "Min. 5 images", "minImages": "Min. 5 images",
"youtubeShorts": "YouTube Shorts", "youtubeShorts": "YouTube Shorts",
@@ -233,7 +234,10 @@
"lyricsColumn": "Lyrics", "lyricsColumn": "Lyrics",
"lyricsHint": "Select the lyrics area to edit", "lyricsHint": "Select the lyrics area to edit",
"lyricsPlaceholder": "Lyrics will be displayed when sound is generated.", "lyricsPlaceholder": "Lyrics will be displayed when sound is generated.",
"lyricsPlaceholderBGM": "Background music is generated without lyrics.",
"generateButton": "Generate Sound", "generateButton": "Generate Sound",
"regenerateButton": "Regenerate",
"regenerateHint": "Press the regenerate button to create new lyrics and music.",
"generating": "Generating...", "generating": "Generating...",
"generateVideo": "Generate Video", "generateVideo": "Generate Video",
"videoGenerating": "Generating Video", "videoGenerating": "Generating Video",
@@ -251,7 +255,10 @@
"musicGenerationFailed": "Music generation failed.", "musicGenerationFailed": "Music generation failed.",
"multipleRetryFailed": "Music generation failed after multiple attempts. Please try again.", "multipleRetryFailed": "Music generation failed after multiple attempts. Please try again.",
"musicGenerationError": "An error occurred during music generation.", "musicGenerationError": "An error occurred during music generation.",
"songRegenerationError": "An error occurred during music regeneration." "songRegenerationError": "An error occurred during music regeneration.",
"creditsRemaining": "{{count}} left",
"creditsExhausted": "Not enough credits.",
"chargeCredits": "Purchase credits"
}, },
"completion": { "completion": {
"back": "Go Back", "back": "Go Back",
@@ -292,7 +299,18 @@
"videoNotReady": "The video is not ready yet.", "videoNotReady": "The video is not ready yet.",
"youtubeUploadMessage": "Uploading video to YouTube channel \"{{channelName}}\".\n\n(Upload feature coming soon)", "youtubeUploadMessage": "Uploading video to YouTube channel \"{{channelName}}\".\n\n(Upload feature coming soon)",
"deployComingSoon": "The deployment feature for the selected social channel is coming soon.", "deployComingSoon": "The deployment feature for the selected social channel is coming soon.",
"youtubeExpiredAlert": "YouTube authentication has expired. Redirecting to reconnect page." "youtubeExpiredAlert": "YouTube authentication has expired. Redirecting to reconnect page.",
"contentComplete": "Content Creation Complete",
"contentCompleteDesc": "Your optimized content has been created through AI analysis and editing",
"contentInfo": "File Name",
"genre": "Genre",
"resolution": "Resolution",
"lyrics": "Lyrics",
"sampleLyrics": "Loading lyrics...",
"noLyricsBGM": "Background music is generated without lyrics.",
"downloading": "Downloading...",
"download": "Download",
"uploadToSocial": "Upload to Social"
}, },
"dashboard": { "dashboard": {
"title": "Dashboard", "title": "Dashboard",
@@ -365,7 +383,38 @@
"stayIntroReel": "Stay Meomum Introduction Reel", "stayIntroReel": "Stay Meomum Introduction Reel",
"newYearEvent": "New Year Special Event", "newYearEvent": "New Year Special Event",
"nightTimelapse": "Pension Night View Timelapse" "nightTimelapse": "Pension Night View Timelapse"
} },
"metricTotalViews": "Views",
"metricWatchTime": "Watch Time",
"metricAvgViewDuration": "Avg. Watch Duration",
"metricNewSubscribers": "New Subscribers",
"metricUploadedVideos": "Uploaded Videos",
"unitHours": "h",
"unitMinutes": "m",
"noDataInPeriod": "No data available for this period.",
"dataLoading": "Loading data...",
"noUploadsTitle": "No uploaded videos yet.",
"noUploadsDesc": "Upload videos via ADO2 to see real stats.",
"reconnectButton": "Reconnect →",
"connectButton": "Connect →",
"retryButton": "Retry →",
"selectAccount": "Select an account",
"modeAnnual": "Annual",
"modeMonthly": "Monthly",
"chartThisYear": "This Year",
"chartLastYear": "Last Year",
"chartThisMonth": "This Month",
"chartLastMonth": "Last Month",
"monthOverMonth": "Month-over-Month Growth",
"noAudienceData": "Not enough data to show real audience insights.",
"mockContentNotice": "The content shown below is sample data, not your actual content.",
"dataDelayTitle": "Data is being prepared",
"dataDelayDesc": "According to YouTube's policy, analytics data may take up to 48 hours to be reflected after a video is uploaded. Please check back later.",
"sampleHide": "Hide Sample",
"sampleShow": "Show Sample",
"recentVideosDesc": "Showing stats for the latest 30 videos uploaded via ADO2.",
"channelStatsDesc": "Showing stats for the selected channel.",
"youtubeApiFailed": "Failed to call YouTube Analytics API."
}, },
"myInfo": { "myInfo": {
"title": "My Info", "title": "My Info",
@@ -386,7 +435,22 @@
"connected": "Connected", "connected": "Connected",
"disconnectAccount": "Disconnect", "disconnectAccount": "Disconnect",
"loadingAccounts": "Loading account information...", "loadingAccounts": "Loading account information...",
"youtubeExpiredAlert": "YouTube authentication has expired. Redirecting to reconnect page." "youtubeExpiredAlert": "YouTube authentication has expired. Redirecting to reconnect page.",
"creditsTitle": "Credit Balance",
"creditsLoading": "Loading...",
"creditsLabel": "Available Credits",
"creditsUnit": "credits",
"creditsDesc": "You can request a top-up from the admin if you run low on credits.",
"creditsChargeBtn": "Top Up",
"chargePopupTitle": "Credit Top-up Request",
"chargeAmountLabel": "Credits to Request",
"chargeNoteLabel": "Additional Notes",
"chargeNotePlaceholder": "Enter any message for the admin",
"chargeCancel": "Cancel",
"chargeSubmit": "Submit",
"chargeSubmitting": "Submitting...",
"chargeSuccess": "Your top-up request has been submitted!",
"chargeConfirm": "OK"
}, },
"ado2Contents": { "ado2Contents": {
"title": "ADO2 Contents", "title": "ADO2 Contents",
@@ -434,7 +498,11 @@
"generateContent": "Generate Content", "generateContent": "Generate Content",
"pageDescBefore": " reveals ", "pageDescBefore": " reveals ",
"pageDescAfter": "'s core strategy.", "pageDescAfter": "'s core strategy.",
"loadingTitle": "Analyzing Brand" "loadingTitle": "Analyzing Brand",
"loadingStep1": "Collecting brand information...",
"loadingStep2": "Analyzing collected data...",
"loadingStep3": "Deriving key strategies...",
"loadingStep4": "Organizing results..."
}, },
"common": { "common": {
"back": "Go Back", "back": "Go Back",
@@ -446,14 +514,44 @@
"required": "*", "required": "*",
"unknown": "Unknown" "unknown": "Unknown"
}, },
"contentCalendar": {
"title": "Content Calendar",
"tabs": {
"all": "All",
"completed": "Done",
"scheduled": "Planned",
"failed": "Failed"
},
"status": {
"completed": "Done",
"scheduled": "Planned",
"failed": "Failed"
},
"months": ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],
"days": ["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],
"yearMonth": "{{month}} {{year}}",
"monthDay": "{{month}} {{day}}",
"loading": "Loading...",
"noResults": "No recent results",
"noResultsDesc": "Upload your content to social channels",
"ado2Contents": "ADO2 Contents",
"cancel": "Cancel",
"retry": "Retry",
"cancelConfirm": "Are you sure you want to cancel this reservation?",
"cancelFailed": "Failed to cancel.",
"retryFailed": "Failed to retry.",
"completedCount": "Done {{count}}",
"scheduledCount": "Sched {{count}}",
"failedCount": "Fail {{count}}"
},
"app": { "app": {
"loginProcessing": "Processing login...", "loginProcessing": "Processing login...",
"loginFailed": "Login processing failed. Please try again.", "loginFailed": "Login processing failed. Please try again.",
"kakaoLoginFailed": "Kakao login failed. Please try again.", "kakaoLoginFailed": "Kakao login failed. Please try again.",
"loginUrlFailed": "Failed to get login URL. Please try again.", "loginUrlFailed": "Failed to get login URL. Please try again.",
"invalidUrl": "Invalid URL. Please enter a Naver Map URL.", "invalidUrl": "Invalid URL. Please enter a Naver Map URL.",
"analysisError": "An error occurred during analysis. Please try again.", "analysisError": "No results found. Please check your input and try again.",
"autocompleteError": "Failed to retrieve business information.", "autocompleteError": "No results found. Please check your input and try again.",
"autocompleteGeneralError": "An error occurred while retrieving business information. Please try again.", "autocompleteGeneralError": "An error occurred while retrieving business information. Please try again.",
"pageComingSoon": "{{page}} page is coming soon." "pageComingSoon": "{{page}} page is coming soon."
} }
+126 -28
View File
@@ -12,9 +12,14 @@
"myContents": "내 콘텐츠", "myContents": "내 콘텐츠",
"myInfo": "내 정보", "myInfo": "내 정보",
"defaultUser": "사용자", "defaultUser": "사용자",
"credits": "보유 크레딧: {{count}}",
"loggingOut": "로그아웃 중...", "loggingOut": "로그아웃 중...",
"logout": "로그아웃", "logout": "로그아웃",
"tutorialRestart": "튜토리얼 다시 보기" "tutorialRestart": "튜토리얼 다시 보기",
"tutorial": "튜토리얼",
"tutorialOn": "튜토리얼 켜기",
"tutorialOff": "튜토리얼 끄기",
"inquiry": "고객의견"
}, },
"tutorial": { "tutorial": {
"skip": "건너뛰기", "skip": "건너뛰기",
@@ -27,13 +32,6 @@
"field": { "title": "입력하기", "desc": "URL 방식이라면 네이버 지도 공유 URL,\n업체명 방식이라면 업체명을 입력하고 목록에서 선택하세요." }, "field": { "title": "입력하기", "desc": "URL 방식이라면 네이버 지도 공유 URL,\n업체명 방식이라면 업체명을 입력하고 목록에서 선택하세요." },
"button": { "title": "브랜드 분석 시작", "desc": "버튼을 누르면 AI가 브랜드를 분석하기 시작해요." } "button": { "title": "브랜드 분석 시작", "desc": "버튼을 누르면 AI가 브랜드를 분석하기 시작해요." }
}, },
"analysis": {
"identity": { "title": "브랜드 정체성", "desc": "AI가 분석한 펜션의 핵심 가치와 시장 포지셔닝을 확인하세요." },
"selling": { "title": "주요 셀링 포인트", "desc": "펜션의 강점을 확인할 수 있어요." },
"persona": { "title": "주요 고객 유형", "desc": "어떤 고객이 이 펜션을 찾는지 분석했어요." },
"keywords": { "title": "추천 타겟 키워드", "desc": "고객이 검색할 가능성이 높은 키워드들이에요." },
"generate": { "title": "콘텐츠 생성", "desc": "분석 결과를 바탕으로 영상을 만들어 보세요.\n클릭하면 카카오 로그인으로 이동합니다." }
},
"asset": { "asset": {
"image": { "title": "이미지 목록", "desc": "네이버 Place에서 가져 온 사진이에요. \n더보기를 누르면 나머지 사진도 볼 수 있고 X를 눌러 삭제 할 수 있어요." }, "image": { "title": "이미지 목록", "desc": "네이버 Place에서 가져 온 사진이에요. \n더보기를 누르면 나머지 사진도 볼 수 있고 X를 눌러 삭제 할 수 있어요." },
"upload": { "title": "이미지 추가", "desc": "이미지를 자유롭게 추가 할 수 있어요." }, "upload": { "title": "이미지 추가", "desc": "이미지를 자유롭게 추가 할 수 있어요." },
@@ -41,14 +39,20 @@
"next": { "title": "다음 단계로", "desc": "설정이 완료되면 다음 단계로 진행하세요." } "next": { "title": "다음 단계로", "desc": "설정이 완료되면 다음 단계로 진행하세요." }
}, },
"sound": { "sound": {
"genre": { "title": "장르 선택", "desc": "영상에 어울리는 음악 장르를 선택하세요." }, "genre": { "title": "장르 선택", "desc": "영상에 어울리는 음악 장르를 선택하세요.", "note": "배경음악은 이후 오픈 예정입니다." },
"language": { "title": "언어 선택", "desc": "사운드의 언어를 선택할 수 있어요. \n이미 선택된 한국어로 진행해볼까요?" }, "language": { "title": "언어 선택", "desc": "음악의 언어를 선택할 수 있어요. \n이미 선택된 한국어로 진행해볼까요?" },
"generate": { "title": "사운드 생성", "desc": "버튼을 클릭하면 AI가 선택한 장르와 언어로 가사와 음악을 생성해요."}, "generate": { "title": "사운드 생성", "desc": "버튼을 클릭하면 AI가 가사와 음악을 생성해요."},
"lyrics": { "title": "가사 생성 완료", "desc": "AI가 선택한 언어로 가사를 만들었어요.\n생성된 가사를 확인하세요." }, "lyrics": { "title": "가사 생성 완료", "desc": "AI가 선택한 언어로 가사를 만들었어요.\n생성된 가사를 확인하세요." },
"lyricsWait": { "title": "음악 생성 중", "desc": "가사를 바탕으로 AI가 음악을 만들고 있어요.\n잠시만 기다려 주세요." }, "lyricsWait": { "title": "음악 생성 중", "desc": "가사를 바탕으로 AI가 음악을 만들고 있어요.\n잠시만 기다려 주세요." },
"audioPlayer": { "title": "음악 미리 듣기", "desc": "음악 생성이 완료되었어요.\n재생 버튼을 눌러 생성된 음악을 들어보세요." }, "audioPlayer": { "title": "음악 미리 듣기", "desc": "음악 생성이 완료되었어요.\n재생 버튼을 눌러 생성된 음악을 들어보세요." },
"video": { "title": "영상 생성", "desc": "버튼을 클릭해서 영상 생성을 시작하세요." } "video": { "title": "영상 생성", "desc": "버튼을 클릭해서 영상 생성을 시작하세요." }
}, },
"completion": {
"contentInfo": { "title": "콘텐츠 정보", "desc": "콘텐츠의 파일명, 장르, 규격, 가사를 확인하세요." },
"generating": { "title": "영상 제작 중", "desc": "AI가 영상을 만들고 있어요. \n잠시만 기다려 주세요." },
"completion": { "title": "영상 완성!", "desc": "영상 제작이 완료되었어요. \n영상을 확인해 볼까요?" },
"myInfo": { "title": "소셜 계정 연동", "desc": "영상을 유튜브에 업로드하려면 내 정보에서 소셜 계정을 연동해야 해요. \n클릭해서 이동하세요." }
},
"myInfo": { "myInfo": {
"myInfo": { "title": "내 정보", "desc": "내 정보에서는 소셜 연결과 연결된 계정을 확인 할 수 있어요." }, "myInfo": { "title": "내 정보", "desc": "내 정보에서는 소셜 연결과 연결된 계정을 확인 할 수 있어요." },
"connect": { "title": "연결하기", "desc": "YouTube 연결 버튼을 누르면 연결 페이지로 이동합니다.", "note": "Instargram 연결은 오픈 예정입니다." }, "connect": { "title": "연결하기", "desc": "YouTube 연결 버튼을 누르면 연결 페이지로 이동합니다.", "note": "Instargram 연결은 오픈 예정입니다." },
@@ -61,12 +65,6 @@
"delete": { "title": "삭제", "desc": "필요없는 영상을 삭제할 수 있어요." }, "delete": { "title": "삭제", "desc": "필요없는 영상을 삭제할 수 있어요." },
"upload": { "title": "소셜 업로드", "desc": "선택해서 소셜미디어에 업로드하세요." } "upload": { "title": "소셜 업로드", "desc": "선택해서 소셜미디어에 업로드하세요." }
}, },
"completion": {
"contentInfo": { "title": "콘텐츠 정보", "desc": "콘텐츠의 제목,장르,규격,가사를 확인하세요." },
"generating": { "title": "영상 제작 중", "desc": "AI가 영상을 만들고 있어요. \n잠시만 기다려 주세요." },
"completion": { "title": "영상 완성!", "desc": "영상 제작이 완료되었어요. \n영상을 확인해 볼까요?" },
"myInfo": { "title": "소셜 계정 연동", "desc": "영상을 유튜브에 업로드하려면 내 정보에서 소셜 계정을 연동해야 해요. \n클릭해서 이동하세요." }
},
"upload": { "upload": {
"seo": { "title": "제목 및 설명", "desc": "영상의 제목과 설명을 AI가 만들고 있어요. 잠시만 기다려 주세요." }, "seo": { "title": "제목 및 설명", "desc": "영상의 제목과 설명을 AI가 만들고 있어요. 잠시만 기다려 주세요." },
"required": { "title": "필수 항목", "desc": "영상을 업로드 하기 전 *는 필수 항목으로 \n반드시 확인해 주세요." }, "required": { "title": "필수 항목", "desc": "영상을 업로드 하기 전 *는 필수 항목으로 \n반드시 확인해 주세요." },
@@ -100,7 +98,9 @@
"headquarters": "본사 : 41593 대구광역시 북구 옥산로 111, 5층 유니콘랩 대구 A05호", "headquarters": "본사 : 41593 대구광역시 북구 옥산로 111, 5층 유니콘랩 대구 A05호",
"researchCenter": "연구소 : 13453 경기 성남시 수정구 금토로 32 (금토동) (주)KT 판교빌딩 504호~505호 (East)", "researchCenter": "연구소 : 13453 경기 성남시 수정구 금토로 32 (금토동) (주)KT 판교빌딩 504호~505호 (East)",
"phone": "전화 : 070-4260-8310 | 010-2755-6463", "phone": "전화 : 070-4260-8310 | 010-2755-6463",
"email": "이메일 : o2oteam@o2o.kr" "email": "이메일 : o2oteam@o2o.kr",
"privacyPolicy": "개인정보처리방침",
"termsOfService": "서비스 약관"
}, },
"social": { "social": {
"title": "소셜 미디어 포스팅", "title": "소셜 미디어 포스팅",
@@ -152,7 +152,8 @@
"viewOnYoutube": "YouTube에서 보기", "viewOnYoutube": "YouTube에서 보기",
"confirm": "확인", "confirm": "확인",
"close": "닫기", "close": "닫기",
"doNotClose": "업로드가 진행 중입니다. 창을 닫지 마세요." "doNotClose": "업로드가 진행 중입니다. 창을 닫지 마세요.",
"goToCalendar": "캘린더에서 확인"
}, },
"landing": { "landing": {
"hero": { "hero": {
@@ -207,7 +208,7 @@
"imageAlt": "이미지", "imageAlt": "이미지",
"uploadBadge": "업로드", "uploadBadge": "업로드",
"imageUpload": "이미지 업로드", "imageUpload": "이미지 업로드",
"dragAndDrop": "이미지를 드래그하여\n업로드", "dragAndDrop": "이미지를 끌어다 놓거나\n클릭하여 업로드",
"videoRatio": "영상 비율", "videoRatio": "영상 비율",
"minImages": "최소 5장", "minImages": "최소 5장",
"youtubeShorts": "유튜브 쇼츠", "youtubeShorts": "유튜브 쇼츠",
@@ -228,12 +229,15 @@
"genreLabel": "장르 선택", "genreLabel": "장르 선택",
"genreAuto": "자동 선택", "genreAuto": "자동 선택",
"genreBallad": "발라드", "genreBallad": "발라드",
"languageLabel": "언어", "languageLabel": "언어 선택",
"languageKorean": "한국어", "languageKorean": "한국어",
"lyricsColumn": "가사", "lyricsColumn": "가사",
"lyricsHint": "가사 영역을 선택해서 수정 가능해요", "lyricsHint": "가사 영역을 선택해서 수정 가능해요",
"lyricsPlaceholder": "사운드 생성 시 가사 표시됩니다.", "lyricsPlaceholder": "사운드 생성 시 가사 표시됩니다.",
"lyricsPlaceholderBGM": "배경음악은 가사 없이 생성됩니다.",
"generateButton": "사운드 생성", "generateButton": "사운드 생성",
"regenerateButton": "재생성 하기",
"regenerateHint": "재생성 버튼을 누르면 가사와 음악을 다시 만들 수 있어요.",
"generating": "생성 중...", "generating": "생성 중...",
"generateVideo": "영상 생성하기", "generateVideo": "영상 생성하기",
"videoGenerating": "영상 생성 중", "videoGenerating": "영상 생성 중",
@@ -251,7 +255,10 @@
"musicGenerationFailed": "음악 생성에 실패했습니다.", "musicGenerationFailed": "음악 생성에 실패했습니다.",
"multipleRetryFailed": "여러 번 시도했지만 음악 생성에 실패했습니다. 다시 시도해주세요.", "multipleRetryFailed": "여러 번 시도했지만 음악 생성에 실패했습니다. 다시 시도해주세요.",
"musicGenerationError": "음악 생성 중 오류가 발생했습니다.", "musicGenerationError": "음악 생성 중 오류가 발생했습니다.",
"songRegenerationError": "음악 재생성 중 오류가 발생했습니다." "songRegenerationError": "음악 재생성 중 오류가 발생했습니다.",
"creditsRemaining": "잔여 {{count}}",
"creditsExhausted": "크레딧이 부족합니다.",
"chargeCredits": "크레딧 충전하기"
}, },
"completion": { "completion": {
"back": "뒤로가기", "back": "뒤로가기",
@@ -292,7 +299,18 @@
"videoNotReady": "영상이 아직 준비되지 않았습니다.", "videoNotReady": "영상이 아직 준비되지 않았습니다.",
"youtubeUploadMessage": "YouTube 채널 \"{{channelName}}\"에 영상을 업로드합니다.\n\n(업로드 기능 준비 중)", "youtubeUploadMessage": "YouTube 채널 \"{{channelName}}\"에 영상을 업로드합니다.\n\n(업로드 기능 준비 중)",
"deployComingSoon": "선택한 소셜 채널에 배포 기능이 준비 중입니다.", "deployComingSoon": "선택한 소셜 채널에 배포 기능이 준비 중입니다.",
"youtubeExpiredAlert": "YouTube 인증이 만료되었습니다. 재연동 페이지로 이동합니다." "youtubeExpiredAlert": "YouTube 인증이 만료되었습니다. 재연동 페이지로 이동합니다.",
"contentComplete": "콘텐츠 제작 완료",
"contentCompleteDesc": "AI 분석 및 편집을 통해 최적화된 콘텐츠가 완성되었습니다",
"contentInfo": "파일명",
"genre": "장르",
"resolution": "규격",
"lyrics": "가사",
"sampleLyrics": "가사를 불러오는 중...",
"noLyricsBGM": "배경음악은 가사 없이 생성됩니다.",
"downloading": "다운로드 중...",
"download": "다운로드",
"uploadToSocial": "소셜 채널 업로드"
}, },
"dashboard": { "dashboard": {
"title": "대시보드", "title": "대시보드",
@@ -365,7 +383,38 @@
"stayIntroReel": "스테이 머뭄 소개 릴스", "stayIntroReel": "스테이 머뭄 소개 릴스",
"newYearEvent": "신년 특가 이벤트 안내", "newYearEvent": "신년 특가 이벤트 안내",
"nightTimelapse": "펜션 야경 타임랩스" "nightTimelapse": "펜션 야경 타임랩스"
} },
"metricTotalViews": "조회수",
"metricWatchTime": "시청시간",
"metricAvgViewDuration": "평균 시청시간",
"metricNewSubscribers": "신규 구독자",
"metricUploadedVideos": "업로드 영상",
"unitHours": "시간",
"unitMinutes": "분",
"noDataInPeriod": "이 기간에 데이터가 없습니다.",
"dataLoading": "데이터 로딩 중...",
"noUploadsTitle": "아직 업로드된 영상이 없습니다.",
"noUploadsDesc": "ADO2에서 영상을 업로드하면 실제 통계가 표시됩니다.",
"reconnectButton": "재연동하러 가기 →",
"connectButton": "연동하러 가기 →",
"retryButton": "재시도 →",
"selectAccount": "계정을 선택하세요",
"modeAnnual": "연간",
"modeMonthly": "월간",
"chartThisYear": "올해",
"chartLastYear": "작년",
"chartThisMonth": "이번달",
"chartLastMonth": "지난달",
"monthOverMonth": "전월 대비 성장",
"noAudienceData": "누적 데이터가 부족하여 실제 시청자 정보가 없습니다.",
"mockContentNotice": "현재 표시된 콘텐츠는 실제 데이터가 아닌 샘플 데이터입니다.",
"dataDelayTitle": "데이터 준비 중",
"dataDelayDesc": "유튜브 정책에 따라 분석 데이터는 영상 업로드 후 최대 48시간이 지나야 반영됩니다. 나중에 다시 확인해 주세요.",
"sampleHide": "Sample 숨기기",
"sampleShow": "Sample 보기",
"recentVideosDesc": "ADO2에서 업로드한 최근 30개의 영상 통계가 표시됩니다.",
"channelStatsDesc": "선택한 채널의 통계가 표시됩니다.",
"youtubeApiFailed": "YouTube Analytics API 호출에 실패했습니다."
}, },
"myInfo": { "myInfo": {
"title": "내 정보", "title": "내 정보",
@@ -386,7 +435,22 @@
"connected": "연결됨", "connected": "연결됨",
"disconnectAccount": "연결 해제", "disconnectAccount": "연결 해제",
"loadingAccounts": "계정 정보를 불러오는 중...", "loadingAccounts": "계정 정보를 불러오는 중...",
"youtubeExpiredAlert": "YouTube 인증이 만료되었습니다. 재연동 페이지로 이동합니다." "youtubeExpiredAlert": "YouTube 인증이 만료되었습니다. 재연동 페이지로 이동합니다.",
"creditsTitle": "크레딧 현황",
"creditsLoading": "로딩 중...",
"creditsLabel": "보유 크레딧",
"creditsUnit": "크레딧",
"creditsDesc": "크레딧이 부족하면 관리자에게 충전 요청할 수 있습니다.",
"creditsChargeBtn": "충전하기",
"chargePopupTitle": "크레딧 충전 요청",
"chargeAmountLabel": "충전 크레딧",
"chargeNoteLabel": "기타 내용",
"chargeNotePlaceholder": "관리자에게 전달할 내용을 입력해주세요",
"chargeCancel": "취소",
"chargeSubmit": "요청하기",
"chargeSubmitting": "요청 중...",
"chargeSuccess": "충전 요청이 완료 되었습니다!",
"chargeConfirm": "확인"
}, },
"ado2Contents": { "ado2Contents": {
"title": "ADO2 콘텐츠", "title": "ADO2 콘텐츠",
@@ -434,7 +498,11 @@
"generateContent": "콘텐츠 생성", "generateContent": "콘텐츠 생성",
"pageDescBefore": "을 통해 도출된 ", "pageDescBefore": "을 통해 도출된 ",
"pageDescAfter": "의 핵심 전략입니다.", "pageDescAfter": "의 핵심 전략입니다.",
"loadingTitle": "브랜드 분석 중" "loadingTitle": "브랜드 분석 중",
"loadingStep1": "브랜드 정보를 수집하는 중...",
"loadingStep2": "수집한 데이터를 분석하는 중...",
"loadingStep3": "핵심 전략을 도출하는 중...",
"loadingStep4": "결과를 정리하는 중..."
}, },
"common": { "common": {
"back": "뒤로가기", "back": "뒤로가기",
@@ -446,14 +514,44 @@
"required": "*", "required": "*",
"unknown": "알 수 없음" "unknown": "알 수 없음"
}, },
"contentCalendar": {
"title": "콘텐츠 캘린더",
"tabs": {
"all": "전체",
"completed": "완료",
"scheduled": "예약",
"failed": "실패"
},
"status": {
"completed": "완료",
"scheduled": "예약",
"failed": "실패"
},
"months": ["1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"],
"days": ["일","월","화","수","목","금","토"],
"yearMonth": "{{year}}년 {{month}}",
"monthDay": "{{month}} {{day}}일",
"loading": "불러오는 중...",
"noResults": "최근 결과 없음",
"noResultsDesc": "제작한 콘텐츠를 소셜 채널에 업로드해 보세요",
"ado2Contents": "ADO2 콘텐츠",
"cancel": "취소",
"retry": "재시도",
"cancelConfirm": "예약을 취소하시겠습니까?",
"cancelFailed": "취소에 실패했습니다.",
"retryFailed": "재시도에 실패했습니다.",
"completedCount": "완료 {{count}}",
"scheduledCount": "예약 {{count}}",
"failedCount": "실패 {{count}}"
},
"app": { "app": {
"loginProcessing": "로그인 처리 중...", "loginProcessing": "로그인 처리 중...",
"loginFailed": "로그인 처리에 실패했습니다. 다시 시도해주세요.", "loginFailed": "로그인 처리에 실패했습니다. 다시 시도해주세요.",
"kakaoLoginFailed": "카카오 로그인에 실패했습니다. 다시 시도해주세요.", "kakaoLoginFailed": "카카오 로그인에 실패했습니다. 다시 시도해주세요.",
"loginUrlFailed": "로그인 URL을 가져오는데 실패했습니다. 다시 시도해주세요.", "loginUrlFailed": "로그인 URL을 가져오는데 실패했습니다. 다시 시도해주세요.",
"invalidUrl": "유효하지 않은 URL입니다. 네이버 지도 URL을 입력해주세요.", "invalidUrl": "유효하지 않은 URL입니다. 네이버 지도 URL을 입력해주세요.",
"analysisError": "분석 중 오류가 발생했습니다. 다시 시도해주세요.", "analysisError": "검색 정보를 찾을 수 없습니다. 입력 정보를 다시 확인해주세요.",
"autocompleteError": "업체 정보 조회에 실패했습니다.", "autocompleteError": "검색 정보를 찾을 수 없습니다. 입력 정보를 다시 확인해주세요.",
"autocompleteGeneralError": "업체 정보 조회 중 오류가 발생했습니다. 다시 시도해주세요.", "autocompleteGeneralError": "업체 정보 조회 중 오류가 발생했습니다. 다시 시도해주세요.",
"pageComingSoon": "{{page}} 페이지 준비 중입니다." "pageComingSoon": "{{page}} 페이지 준비 중입니다."
} }
@@ -1,4 +1,3 @@
import React, { useEffect } from 'react'; import React, { useEffect } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { CrawlingResponse, TargetPersona } from '../../types/api'; import { CrawlingResponse, TargetPersona } from '../../types/api';
+54 -2
View File
@@ -1,9 +1,50 @@
import React from 'react'; import React, { useEffect, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
const LoadingSection: React.FC = () => { interface LoadingSectionProps {
onComplete?: () => void;
isComplete?: boolean;
}
const LoadingSection: React.FC<LoadingSectionProps> = ({ onComplete, isComplete }) => {
const { t } = useTranslation(); const { t } = useTranslation();
const [progress, setProgress] = useState(0);
const intervalRef = useRef<ReturnType<typeof setInterval> | null>(null);
useEffect(() => {
intervalRef.current = setInterval(() => {
setProgress(prev => {
if (prev >= 100) {
if (intervalRef.current) clearInterval(intervalRef.current);
return 100;
}
const increment = prev < 70 ? 0.5 : prev < 90 ? 0.2 : 0.1;
return Math.min(prev + increment, 100);
});
}, 100);
return () => {
if (intervalRef.current) clearInterval(intervalRef.current);
};
}, []);
useEffect(() => {
if (!isComplete) return;
if (intervalRef.current) clearInterval(intervalRef.current);
setProgress(100);
const timer = setTimeout(() => {
onComplete?.();
}, 400);
return () => clearTimeout(timer);
}, [isComplete]);
const getStepMessage = (p: number) => {
if (p < 30) return t('analysis.loadingStep1');
if (p < 50) return t('analysis.loadingStep2');
if (p < 80) return t('analysis.loadingStep3');
return t('analysis.loadingStep4');
};
return ( return (
<div className="loading-container"> <div className="loading-container">
<div className="loading-content"> <div className="loading-content">
@@ -23,6 +64,17 @@ const LoadingSection: React.FC = () => {
className="loading-spinner-icon" className="loading-spinner-icon"
/> />
</div> </div>
<div className="loading-progress-wrapper">
<div className="loading-progress-bar">
<div
className="loading-progress-fill"
style={{ width: `${progress}%` }}
/>
</div>
<span className="loading-progress-text">{Math.floor(progress)}%</span>
</div>
<p className="loading-step-message">{getStepMessage(progress)}</p>
</div> </div>
</div> </div>
</div> </div>
+82 -10
View File
@@ -1,15 +1,93 @@
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect, useRef, useCallback } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { getVideosList, deleteVideo } from '../../utils/api'; import { getVideosList, deleteVideo } from '../../utils/api';
import { VideoListItem } from '../../types/api'; import { VideoListItem } from '../../types/api';
import SocialPostingModal from '../../components/SocialPostingModal'; import SocialPostingModal from '../../components/SocialPostingModal';
const VideoPreviewCard: React.FC<{ src: string; className?: string }> = ({ src, className }) => {
const videoRef = useRef<HTMLVideoElement>(null);
const isPlayingRef = useRef(false);
const pendingPlayRef = useRef(false);
useEffect(() => {
const video = videoRef.current;
if (!video) return;
const observer = new IntersectionObserver(
([entry]) => {
if (entry.isIntersecting) {
video.preload = 'auto';
} else {
video.preload = 'none';
}
},
{ threshold: 0.1 }
);
observer.observe(video);
return () => observer.disconnect();
}, []);
const safePlay = useCallback((video: HTMLVideoElement) => {
const playPromise = video.play();
if (playPromise !== undefined) {
playPromise
.then(() => { isPlayingRef.current = true; })
.catch((error) => {
if (error.name !== 'AbortError') console.error(error);
});
}
}, []);
const handleCanPlay = useCallback(() => {
if (!pendingPlayRef.current || !videoRef.current) return;
pendingPlayRef.current = false;
safePlay(videoRef.current);
}, [safePlay]);
const handleMouseEnter = useCallback(() => {
const video = videoRef.current;
if (!video) return;
if (video.readyState >= 3) {
safePlay(video);
} else {
pendingPlayRef.current = true;
}
}, [safePlay]);
const handleMouseLeave = useCallback(() => {
const video = videoRef.current;
if (!video) return;
pendingPlayRef.current = false;
if (isPlayingRef.current) {
video.pause();
video.currentTime = 0;
isPlayingRef.current = false;
}
}, []);
return (
<video
ref={videoRef}
src={src}
className={className}
muted
playsInline
preload="none"
onCanPlay={handleCanPlay}
onMouseEnter={handleMouseEnter}
onMouseLeave={handleMouseLeave}
/>
);
};
interface ADO2ContentsPageProps { interface ADO2ContentsPageProps {
onBack: () => void; onBack: () => void;
onNavigate?: (item: string) => void;
} }
const ADO2ContentsPage: React.FC<ADO2ContentsPageProps> = ({ onBack }) => { const ADO2ContentsPage: React.FC<ADO2ContentsPageProps> = ({ onBack, onNavigate }) => {
const { t } = useTranslation(); const { t } = useTranslation();
const [videos, setVideos] = useState<VideoListItem[]>([]); const [videos, setVideos] = useState<VideoListItem[]>([]);
const [total, setTotal] = useState(0); const [total, setTotal] = useState(0);
@@ -165,16 +243,9 @@ const ADO2ContentsPage: React.FC<ADO2ContentsPageProps> = ({ onBack }) => {
{/* Video Thumbnail */} {/* Video Thumbnail */}
<div className="content-card-thumbnail"> <div className="content-card-thumbnail">
{video.result_movie_url ? ( {video.result_movie_url ? (
<video <VideoPreviewCard
src={video.result_movie_url} src={video.result_movie_url}
className="content-video-preview" className="content-video-preview"
muted
playsInline
onMouseEnter={(e) => e.currentTarget.play()}
onMouseLeave={(e) => {
e.currentTarget.pause();
e.currentTarget.currentTime = 0;
}}
/> />
) : ( ) : (
<div className="content-no-video"> <div className="content-no-video">
@@ -295,6 +366,7 @@ const ADO2ContentsPage: React.FC<ADO2ContentsPageProps> = ({ onBack }) => {
isOpen={uploadModalOpen} isOpen={uploadModalOpen}
onClose={handleUploadModalClose} onClose={handleUploadModalClose}
video={uploadTargetVideo} video={uploadTargetVideo}
onGoToCalendar={onNavigate ? () => onNavigate('콘텐츠 캘린더') : undefined}
/> />
</div> </div>
); );
+111 -20
View File
@@ -12,6 +12,7 @@ interface CompletionContentProps {
songTaskId: string | null; songTaskId: string | null;
onVideoStatusChange?: (status: 'idle' | 'generating' | 'complete' | 'error') => void; onVideoStatusChange?: (status: 'idle' | 'generating' | 'complete' | 'error') => void;
onVideoProgressChange?: (progress: number) => void; onVideoProgressChange?: (progress: number) => void;
onGoToCalendar?: () => void;
} }
type VideoStatus = 'idle' | 'generating' | 'polling' | 'complete' | 'error'; type VideoStatus = 'idle' | 'generating' | 'polling' | 'complete' | 'error';
@@ -32,7 +33,8 @@ const CompletionContent: React.FC<CompletionContentProps> = ({
onBack, onBack,
songTaskId, songTaskId,
onVideoStatusChange, onVideoStatusChange,
onVideoProgressChange onVideoProgressChange,
onGoToCalendar,
}) => { }) => {
const { t } = useTranslation(); const { t } = useTranslation();
const [videoStatus, setVideoStatus] = useState<VideoStatus>('idle'); const [videoStatus, setVideoStatus] = useState<VideoStatus>('idle');
@@ -40,21 +42,25 @@ const CompletionContent: React.FC<CompletionContentProps> = ({
const [errorMessage, setErrorMessage] = useState<string | null>(null); const [errorMessage, setErrorMessage] = useState<string | null>(null);
const [statusMessage, setStatusMessage] = useState(''); const [statusMessage, setStatusMessage] = useState('');
const [renderProgress, setRenderProgress] = useState(0); const [renderProgress, setRenderProgress] = useState(0);
const [displayProgress, setDisplayProgress] = useState(0);
const hasStartedGeneration = useRef(false); const hasStartedGeneration = useRef(false);
const displayIntervalRef = useRef<ReturnType<typeof setInterval> | null>(null);
const tutorial = useTutorial(); const tutorial = useTutorial();
const tutorialIsActiveRef = useRef(tutorial.isActive);
tutorialIsActiveRef.current = tutorial.isActive;
// 영상 생성 중 튜토리얼 트리거 (생성 상태 안내 -> 콘텐츠 정보 -> 내 정보 이동) // 영상 생성 중 튜토리얼 트리거 (생성 상태 안내 -> 콘텐츠 정보 -> 내 정보 이동)
useEffect(() => { useEffect(() => {
const isComplete = videoStatus === 'complete'; const isComplete = videoStatus === 'complete';
const isProcessing = videoStatus === 'generating' || videoStatus === 'polling'; const isProcessing = videoStatus === 'generating' || videoStatus === 'polling';
if (isProcessing && !tutorial.isActive && !tutorial.hasSeen(TUTORIAL_KEYS.GENERATING)) { if (isProcessing && !tutorialIsActiveRef.current && !tutorial.hasSeen(TUTORIAL_KEYS.GENERATING)) {
tutorial.startTutorial(TUTORIAL_KEYS.GENERATING); tutorial.startTutorial(TUTORIAL_KEYS.GENERATING);
} else if (isComplete && !tutorial.isActive && !tutorial.hasSeen(TUTORIAL_KEYS.COMPLETION)) { } else if (isComplete && !tutorialIsActiveRef.current && !tutorial.hasSeen(TUTORIAL_KEYS.COMPLETION)) {
tutorial.startTutorial(TUTORIAL_KEYS.COMPLETION); tutorial.startTutorial(TUTORIAL_KEYS.COMPLETION);
} }
}, [videoStatus, tutorial]); }, [videoStatus]);
// 소셜 미디어 포스팅 모달 // 소셜 미디어 포스팅 모달
const [showSocialModal, setShowSocialModal] = useState(false); const [showSocialModal, setShowSocialModal] = useState(false);
@@ -83,6 +89,31 @@ const CompletionContent: React.FC<CompletionContentProps> = ({
} }
}, [renderProgress, onVideoProgressChange]); }, [renderProgress, onVideoProgressChange]);
useEffect(() => {
if (displayIntervalRef.current) clearInterval(displayIntervalRef.current);
if (renderProgress === 100) {
setDisplayProgress(100);
return;
}
// renderProgress에 도달한 후에도 99%까지 서서히 크리핑
const CREEP_MAX = 99;
displayIntervalRef.current = setInterval(() => {
setDisplayProgress(prev => {
const target = Math.max(prev, renderProgress);
if (prev >= CREEP_MAX) return prev;
const increment = prev < 70 ? 0.2 : prev < 90 ? 0.04 : 0.01;
return Math.min(prev + increment, Math.max(target, Math.min(prev + increment, CREEP_MAX)));
});
}, 100);
return () => {
if (displayIntervalRef.current) clearInterval(displayIntervalRef.current);
};
}, [renderProgress]);
const saveToStorage = (videoTaskId: string, currentSongTaskId: string, status: VideoStatus, url: string | null, dbId?: number) => { const saveToStorage = (videoTaskId: string, currentSongTaskId: string, status: VideoStatus, url: string | null, dbId?: number) => {
const data: SavedVideoState = { const data: SavedVideoState = {
videoTaskId, videoTaskId,
@@ -254,6 +285,7 @@ const CompletionContent: React.FC<CompletionContentProps> = ({
setVideoUrl(completeVideo.videoUrl); setVideoUrl(completeVideo.videoUrl);
if (completeVideo.videoDbId) setVideoDbId(completeVideo.videoDbId); if (completeVideo.videoDbId) setVideoDbId(completeVideo.videoDbId);
setVideoStatus('complete'); setVideoStatus('complete');
setShowComplete(true);
hasStartedGeneration.current = true; hasStartedGeneration.current = true;
return; return;
} }
@@ -265,6 +297,7 @@ const CompletionContent: React.FC<CompletionContentProps> = ({
setVideoUrl(savedState.videoUrl); setVideoUrl(savedState.videoUrl);
if (savedState.videoDbId) setVideoDbId(savedState.videoDbId); if (savedState.videoDbId) setVideoDbId(savedState.videoDbId);
setVideoStatus('complete'); setVideoStatus('complete');
setShowComplete(true);
hasStartedGeneration.current = true; hasStartedGeneration.current = true;
} else if (savedState.status === 'polling') { } else if (savedState.status === 'polling') {
setVideoStatus('polling'); setVideoStatus('polling');
@@ -296,15 +329,32 @@ const CompletionContent: React.FC<CompletionContentProps> = ({
} }
}, []); }, []);
const handleDownload = () => { const [isDownloading, setIsDownloading] = useState(false);
if (videoUrl) {
const handleDownload = async () => {
if (!videoUrl || isDownloading) return;
setIsDownloading(true);
try {
const response = await fetch(videoUrl);
const blob = await response.blob();
const blobUrl = URL.createObjectURL(blob);
const link = document.createElement('a');
link.href = blobUrl;
link.download = getFileName();
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
URL.revokeObjectURL(blobUrl);
} catch {
const link = document.createElement('a'); const link = document.createElement('a');
link.href = videoUrl; link.href = videoUrl;
link.download = 'castad_video.mp4'; link.download = getFileName();
link.target = '_blank'; link.target = '_blank';
document.body.appendChild(link); document.body.appendChild(link);
link.click(); link.click();
document.body.removeChild(link); document.body.removeChild(link);
} finally {
setIsDownloading(false);
} }
}; };
@@ -321,11 +371,20 @@ const CompletionContent: React.FC<CompletionContentProps> = ({
setVideoStatus('idle'); setVideoStatus('idle');
setVideoUrl(null); setVideoUrl(null);
setErrorMessage(null); setErrorMessage(null);
setShowComplete(false);
clearStorage(); clearStorage();
startVideoGeneration(); startVideoGeneration();
}; };
const isLoading = videoStatus === 'generating' || videoStatus === 'polling'; const [showComplete, setShowComplete] = useState(false);
useEffect(() => {
if (displayProgress < 100) return;
const timer = setTimeout(() => setShowComplete(true), 500);
return () => clearTimeout(timer);
}, [displayProgress]);
const isLoading = videoStatus === 'generating' || videoStatus === 'polling' || (videoStatus === 'complete' && !showComplete);
// 비디오 해상도 계산 // 비디오 해상도 계산
const getVideoResolution = () => { const getVideoResolution = () => {
@@ -351,8 +410,8 @@ const CompletionContent: React.FC<CompletionContentProps> = ({
</div> </div>
<div className="comp2-title-row"> <div className="comp2-title-row">
<h1 className="comp2-page-title">{t('completion.contentComplete', { defaultValue: '콘텐츠 제작 완료' })}</h1> <h1 className="comp2-page-title">{t('completion.contentComplete')}</h1>
<p className="comp2-page-subtitle">{t('completion.contentCompleteDesc', { defaultValue: 'AI 분석 및 편집을 통해 최적화된 콘텐츠가 완성되었습니다' })}</p> <p className="comp2-page-subtitle">{t('completion.contentCompleteDesc')}</p>
</div> </div>
<div className="comp2-container"> <div className="comp2-container">
@@ -369,6 +428,15 @@ const CompletionContent: React.FC<CompletionContentProps> = ({
</div> </div>
</div> </div>
<p className="comp2-loading-text">{statusMessage}</p> <p className="comp2-loading-text">{statusMessage}</p>
<div className="loading-progress-wrapper">
<div className="loading-progress-bar">
<div
className="loading-progress-fill"
style={{ width: `${displayProgress}%` }}
/>
</div>
<span className="loading-progress-text">{Math.floor(displayProgress)}%</span>
</div>
</div> </div>
) : videoStatus === 'error' ? ( ) : videoStatus === 'error' ? (
<div className="comp2-video-error"> <div className="comp2-video-error">
@@ -397,7 +465,7 @@ const CompletionContent: React.FC<CompletionContentProps> = ({
{/* 오른쪽: 콘텐츠 정보 */} {/* 오른쪽: 콘텐츠 정보 */}
<div className="comp2-info-section"> <div className="comp2-info-section">
<div className="comp2-info-header"> <div className="comp2-info-header">
<span className="comp2-info-label">{t('completion.contentInfo', { defaultValue: '콘텐츠 정보' })}</span> <span className="comp2-info-label">{t('completion.contentInfo')}</span>
</div> </div>
<div className="comp2-info-content"> <div className="comp2-info-content">
<div className="comp2-file-info"> <div className="comp2-file-info">
@@ -406,18 +474,40 @@ const CompletionContent: React.FC<CompletionContentProps> = ({
</div> </div>
<div className="comp2-meta-grid"> <div className="comp2-meta-grid">
<div className="comp2-meta-item"> <div className="comp2-meta-item">
<span className="comp2-meta-label">{t('completion.genre', { defaultValue: '장르' })} : {songCompletionData?.genre || 'K-POP'}</span> <span className="comp2-meta-label">{t('completion.genre')} : {songCompletionData?.genre || 'K-POP'}</span>
</div> </div>
<div className="comp2-meta-divider"></div> <div className="comp2-meta-divider"></div>
<div className="comp2-meta-item"> <div className="comp2-meta-item">
<span className="comp2-meta-label">{t('completion.resolution', { defaultValue: '규격' })} : {getVideoResolution()}</span> <span className="comp2-meta-label">{t('completion.resolution')} : {getVideoResolution()}</span>
</div> </div>
<div className="comp2-meta-divider"></div> <div className="comp2-meta-divider"></div>
<div className="comp2-lyrics-section"> <div className="comp2-lyrics-section">
<span className="comp2-meta-label">{t('completion.lyrics', { defaultValue: '가사' })}</span> <span className="comp2-meta-label">{t('completion.lyrics')}</span>
<p className="comp2-lyrics-text"> {(() => {
{songCompletionData?.lyrics || t('completion.sampleLyrics', { defaultValue: '가사를 불러오는 중...' })} if (!songCompletionData) {
</p> return <p className="comp2-lyrics-text">{t('completion.sampleLyrics')}</p>;
}
if (!songCompletionData.lyrics) {
return <p className="comp2-lyrics-text">{t('completion.noLyricsBGM')}</p>;
}
const lines = songCompletionData.lyrics.split('\n').filter((l: string) => l.trim());
const size = Math.ceil(lines.length / 3);
const sections = [
{ tag: '[Verse]', lines: lines.slice(0, size) },
{ tag: '[Chorus]', lines: lines.slice(size, size * 2) },
{ tag: '[Outro]', lines: lines.slice(size * 2) },
].filter(s => s.lines.length > 0);
return (
<div className="comp2-lyrics-paragraphs">
{sections.map((section, i) => (
<div key={i} className="comp2-lyrics-para-section">
<span className="comp2-lyrics-tag">{section.tag}</span>
<p className="comp2-lyrics-text">{section.lines.join('\n')}</p>
</div>
))}
</div>
);
})()}
</div> </div>
</div> </div>
</div> </div>
@@ -425,17 +515,17 @@ const CompletionContent: React.FC<CompletionContentProps> = ({
<div className="comp2-buttons"> <div className="comp2-buttons">
<button <button
onClick={handleDownload} onClick={handleDownload}
disabled={videoStatus !== 'complete' || !videoUrl} disabled={videoStatus !== 'complete' || !videoUrl || isDownloading}
className="comp2-btn comp2-btn-secondary" className="comp2-btn comp2-btn-secondary"
> >
{t('completion.download', { defaultValue: '다운로드' })} {isDownloading ? t('completion.downloading') : t('completion.download')}
</button> </button>
<button <button
onClick={handleOpenSocialConnect} onClick={handleOpenSocialConnect}
disabled={videoStatus !== 'complete' || !videoDbId} disabled={videoStatus !== 'complete' || !videoDbId}
className="comp2-btn comp2-btn-primary" className="comp2-btn comp2-btn-primary"
> >
{t('completion.uploadToSocial', { defaultValue: '소셜 채널 업로드' })} {t('completion.uploadToSocial')}
</button> </button>
</div> </div>
</div> </div>
@@ -446,6 +536,7 @@ const CompletionContent: React.FC<CompletionContentProps> = ({
<SocialPostingModal <SocialPostingModal
isOpen={showSocialModal} isOpen={showSocialModal}
onClose={handleCloseSocialConnect} onClose={handleCloseSocialConnect}
onGoToCalendar={onGoToCalendar}
video={videoUrl && videoDbId ? { video={videoUrl && videoDbId ? {
video_id: videoDbId, video_id: videoDbId,
store_name: songCompletionData?.businessName || '', store_name: songCompletionData?.businessName || '',
+52 -34
View File
@@ -1,5 +1,6 @@
import React, { useState, useEffect, useCallback, useRef } from 'react'; import React, { useState, useEffect, useCallback, useRef } from 'react';
import { useTranslation } from 'react-i18next';
import { UploadHistoryItem } from '../../types/api'; import { UploadHistoryItem } from '../../types/api';
import { getUploadHistory, cancelUpload, retryUpload } from '../../utils/api'; import { getUploadHistory, cancelUpload, retryUpload } from '../../utils/api';
@@ -53,13 +54,13 @@ const statusColor = (status: UploadStatus) => {
} }
}; };
// 상태 라벨 // 상태 라벨 (컴포넌트 내부에서 t()로 처리)
const statusLabel = (status: UploadStatus) => { const statusLabelKey = (status: UploadStatus) => {
switch (status) { switch (status) {
case 'completed': return '완료'; case 'completed': return 'contentCalendar.status.completed';
case 'scheduled': case 'scheduled':
case 'pending': return '예약'; case 'pending': return 'contentCalendar.status.scheduled';
case 'failed': return '실패'; case 'failed': return 'contentCalendar.status.failed';
default: return status; default: return status;
} }
}; };
@@ -69,6 +70,7 @@ interface ContentCalendarContentProps {
} }
const ContentCalendarContent: React.FC<ContentCalendarContentProps> = ({ onNavigate }) => { const ContentCalendarContent: React.FC<ContentCalendarContentProps> = ({ onNavigate }) => {
const { t } = useTranslation();
const today = new Date(); const today = new Date();
const [year, setYear] = useState(today.getFullYear()); const [year, setYear] = useState(today.getFullYear());
const [month, setMonth] = useState(today.getMonth()); const [month, setMonth] = useState(today.getMonth());
@@ -203,7 +205,7 @@ const ContentCalendarContent: React.FC<ContentCalendarContentProps> = ({ onNavig
// 취소 // 취소
const handleCancel = async (uploadId: number) => { const handleCancel = async (uploadId: number) => {
if (!window.confirm('예약을 취소하시겠습니까?')) return; if (!window.confirm(t('contentCalendar.cancelConfirm'))) return;
// 낙관적 업데이트: 먼저 UI에서 제거 // 낙관적 업데이트: 먼저 UI에서 제거
setAllItems(prev => prev.filter(i => i.upload_id !== uploadId)); setAllItems(prev => prev.filter(i => i.upload_id !== uploadId));
setPanelItems(prev => prev.filter(i => i.upload_id !== uploadId)); setPanelItems(prev => prev.filter(i => i.upload_id !== uploadId));
@@ -212,7 +214,7 @@ const ContentCalendarContent: React.FC<ContentCalendarContentProps> = ({ onNavig
} catch { } catch {
// 실패 시 다시 불러오기 // 실패 시 다시 불러오기
refreshAll(); refreshAll();
alert('취소에 실패했습니다.'); alert(t('contentCalendar.cancelFailed'));
} }
}; };
@@ -222,7 +224,7 @@ const ContentCalendarContent: React.FC<ContentCalendarContentProps> = ({ onNavig
await retryUpload(uploadId); await retryUpload(uploadId);
refreshAll(); refreshAll();
} catch { } catch {
alert('재시도에 실패했습니다.'); alert(t('contentCalendar.retryFailed'));
} }
}; };
@@ -234,10 +236,11 @@ const ContentCalendarContent: React.FC<ContentCalendarContentProps> = ({ onNavig
return `${String(d.getHours()).padStart(2, '0')}:${String(d.getMinutes()).padStart(2, '0')}`; return `${String(d.getHours()).padStart(2, '0')}:${String(d.getMinutes()).padStart(2, '0')}`;
}; };
// 날짜 표시 (M월 D) // 날짜 표시
const formatDateLabel = (key: string) => { const formatDateLabel = (key: string) => {
const [, m, d] = key.split('-'); const [, m, d] = key.split('-');
return `${parseInt(m)}월 ${parseInt(d)}`; const months = t('contentCalendar.months', { returnObjects: true }) as string[];
return t('contentCalendar.monthDay', { month: months[parseInt(m) - 1], day: parseInt(d) });
}; };
const buildCalendarDays = (): CalendarDay[] => { const buildCalendarDays = (): CalendarDay[] => {
@@ -266,9 +269,15 @@ const ContentCalendarContent: React.FC<ContentCalendarContentProps> = ({ onNavig
}; };
const calendarDays = buildCalendarDays(); const calendarDays = buildCalendarDays();
const monthNames = ['1월','2월','3월','4월','5월','6월','7월','8월','9월','10월','11월','12월']; const monthNames = t('contentCalendar.months', { returnObjects: true }) as string[];
const dayLabels = ['일','월','화','수','목','금','토']; const dayLabels = t('contentCalendar.days', { returnObjects: true }) as string[];
const tabs: TabType[] = ['전체','완료','예약','실패']; const tabs: TabType[] = ['전체','완료','예약','실패'];
const tabLabels: Record<TabType, string> = {
'전체': t('contentCalendar.tabs.all'),
'완료': t('contentCalendar.tabs.completed'),
'예약': t('contentCalendar.tabs.scheduled'),
'실패': t('contentCalendar.tabs.failed'),
};
// ── 캘린더 그리드 ────────────────────────────────────────────── // ── 캘린더 그리드 ──────────────────────────────────────────────
const renderCalendarGrid = () => { const renderCalendarGrid = () => {
@@ -388,7 +397,7 @@ const ContentCalendarContent: React.FC<ContentCalendarContentProps> = ({ onNavig
<div style={{ display: 'flex', alignItems: 'center', gap: 4 }}> <div style={{ display: 'flex', alignItems: 'center', gap: 4 }}>
<div style={{ width: 8, height: 8, borderRadius: '50%', backgroundColor: '#1ba64f', flexShrink: 0 }} /> <div style={{ width: 8, height: 8, borderRadius: '50%', backgroundColor: '#1ba64f', flexShrink: 0 }} />
<span style={{ fontFamily: 'Pretendard, sans-serif', fontWeight: 500, fontSize: 11, color: '#01191a', lineHeight: 1, whiteSpace: 'nowrap' }}> <span style={{ fontFamily: 'Pretendard, sans-serif', fontWeight: 500, fontSize: 11, color: '#01191a', lineHeight: 1, whiteSpace: 'nowrap' }}>
완료 {summary.completed} {t('contentCalendar.completedCount', { count: summary.completed })}
</span> </span>
</div> </div>
)} )}
@@ -396,7 +405,7 @@ const ContentCalendarContent: React.FC<ContentCalendarContentProps> = ({ onNavig
<div style={{ display: 'flex', alignItems: 'center', gap: 4 }}> <div style={{ display: 'flex', alignItems: 'center', gap: 4 }}>
<div style={{ width: 8, height: 8, borderRadius: '50%', backgroundColor: '#2563eb', flexShrink: 0 }} /> <div style={{ width: 8, height: 8, borderRadius: '50%', backgroundColor: '#2563eb', flexShrink: 0 }} />
<span style={{ fontFamily: 'Pretendard, sans-serif', fontWeight: 500, fontSize: 11, color: '#01191a', lineHeight: 1, whiteSpace: 'nowrap' }}> <span style={{ fontFamily: 'Pretendard, sans-serif', fontWeight: 500, fontSize: 11, color: '#01191a', lineHeight: 1, whiteSpace: 'nowrap' }}>
예약 {summary.scheduled} {t('contentCalendar.scheduledCount', { count: summary.scheduled })}
</span> </span>
</div> </div>
)} )}
@@ -404,7 +413,7 @@ const ContentCalendarContent: React.FC<ContentCalendarContentProps> = ({ onNavig
<div style={{ display: 'flex', alignItems: 'center', gap: 4 }}> <div style={{ display: 'flex', alignItems: 'center', gap: 4 }}>
<div style={{ width: 8, height: 8, borderRadius: '50%', backgroundColor: '#e15252', flexShrink: 0 }} /> <div style={{ width: 8, height: 8, borderRadius: '50%', backgroundColor: '#e15252', flexShrink: 0 }} />
<span style={{ fontFamily: 'Pretendard, sans-serif', fontWeight: 500, fontSize: 11, color: '#01191a', lineHeight: 1, whiteSpace: 'nowrap' }}> <span style={{ fontFamily: 'Pretendard, sans-serif', fontWeight: 500, fontSize: 11, color: '#01191a', lineHeight: 1, whiteSpace: 'nowrap' }}>
실패 {summary.failed} {t('contentCalendar.failedCount', { count: summary.failed })}
</span> </span>
</div> </div>
)} )}
@@ -432,7 +441,7 @@ const ContentCalendarContent: React.FC<ContentCalendarContentProps> = ({ onNavig
letterSpacing: '-0.096px', lineHeight: '22px', whiteSpace: 'nowrap', letterSpacing: '-0.096px', lineHeight: '22px', whiteSpace: 'nowrap',
}} }}
> >
{tab} {tabLabels[tab]}
</button> </button>
))} ))}
</div> </div>
@@ -442,9 +451,9 @@ const ContentCalendarContent: React.FC<ContentCalendarContentProps> = ({ onNavig
const renderStats = () => ( const renderStats = () => (
<div style={{ display: 'flex', gap: 16, alignItems: 'center' }}> <div style={{ display: 'flex', gap: 16, alignItems: 'center' }}>
{[ {[
{ label: '예약', value: totalStats.scheduled }, { label: t('contentCalendar.tabs.scheduled'), value: totalStats.scheduled },
{ label: '완료', value: totalStats.completed }, { label: t('contentCalendar.tabs.completed'), value: totalStats.completed },
{ label: '실패', value: totalStats.failed }, { label: t('contentCalendar.tabs.failed'), value: totalStats.failed },
].map((item, idx) => ( ].map((item, idx) => (
<React.Fragment key={item.label}> <React.Fragment key={item.label}>
{idx > 0 && <div style={{ width: 0, height: 14, borderLeft: '1px solid #379599' }} />} {idx > 0 && <div style={{ width: 0, height: 14, borderLeft: '1px solid #379599' }} />}
@@ -483,7 +492,7 @@ const ContentCalendarContent: React.FC<ContentCalendarContentProps> = ({ onNavig
color: '#e5f1f2', letterSpacing: '-0.096px', lineHeight: '22px', color: '#e5f1f2', letterSpacing: '-0.096px', lineHeight: '22px',
margin: 0, whiteSpace: 'nowrap', margin: 0, whiteSpace: 'nowrap',
}}> }}>
{year}년 {monthNames[month]} {t('contentCalendar.yearMonth', { year, month: monthNames[month] })}
</p> </p>
<button <button
onClick={handleNextMonth} onClick={handleNextMonth}
@@ -529,7 +538,7 @@ const ContentCalendarContent: React.FC<ContentCalendarContentProps> = ({ onNavig
fontFamily: 'Pretendard, sans-serif', fontWeight: 500, fontSize: 13, fontFamily: 'Pretendard, sans-serif', fontWeight: 500, fontSize: 13,
color: statusColor(item.status as UploadStatus), lineHeight: 1, color: statusColor(item.status as UploadStatus), lineHeight: 1,
}}> }}>
{statusLabel(item.status as UploadStatus)} {t(statusLabelKey(item.status as UploadStatus))}
</span> </span>
<span style={{ <span style={{
fontFamily: 'Pretendard, sans-serif', fontWeight: 400, fontSize: 13, fontFamily: 'Pretendard, sans-serif', fontWeight: 400, fontSize: 13,
@@ -539,9 +548,19 @@ const ContentCalendarContent: React.FC<ContentCalendarContentProps> = ({ onNavig
</span> </span>
</div> </div>
{/* 채널 아이콘 + 제목 */} {/* 채널 아이콘 + 채널명 */}
<div style={{ display: 'flex', alignItems: 'center', gap: 8 }}> <div style={{ display: 'flex', alignItems: 'center', gap: 6 }}>
<PlatformIcon platform={item.platform} size={18} /> <PlatformIcon platform={item.platform} size={16} />
<span style={{
fontFamily: 'Pretendard, sans-serif', fontWeight: 500, fontSize: 12,
color: '#9bcacc', lineHeight: 1.4,
overflow: 'hidden', whiteSpace: 'nowrap', textOverflow: 'ellipsis',
}}>
{item.platform_username || item.platform_user_id || item.channel_name}
</span>
</div>
{/* 제목 */}
<span style={{ <span style={{
fontFamily: 'Pretendard, sans-serif', fontWeight: 600, fontSize: 14, fontFamily: 'Pretendard, sans-serif', fontWeight: 600, fontSize: 14,
color: '#e5f1f2', lineHeight: 1.4, color: '#e5f1f2', lineHeight: 1.4,
@@ -550,7 +569,6 @@ const ContentCalendarContent: React.FC<ContentCalendarContentProps> = ({ onNavig
}}> }}>
{item.title} {item.title}
</span> </span>
</div>
{/* 실패 메시지 */} {/* 실패 메시지 */}
{isFailed && item.error_message && ( {isFailed && item.error_message && (
@@ -575,7 +593,7 @@ const ContentCalendarContent: React.FC<ContentCalendarContentProps> = ({ onNavig
color: '#9bcacc', cursor: 'pointer', color: '#9bcacc', cursor: 'pointer',
}} }}
> >
취소 {t('contentCalendar.cancel')}
</button> </button>
)} )}
{isFailed && ( {isFailed && (
@@ -588,7 +606,7 @@ const ContentCalendarContent: React.FC<ContentCalendarContentProps> = ({ onNavig
color: '#ffffff', cursor: 'pointer', color: '#ffffff', cursor: 'pointer',
}} }}
> >
재시도 {t('contentCalendar.retry')}
</button> </button>
)} )}
</div> </div>
@@ -602,7 +620,7 @@ const ContentCalendarContent: React.FC<ContentCalendarContentProps> = ({ onNavig
if (panelLoading) { if (panelLoading) {
return ( return (
<div style={{ flex: 1, display: 'flex', alignItems: 'center', justifyContent: 'center' }}> <div style={{ flex: 1, display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
<span style={{ color: '#9bcacc', fontFamily: 'Pretendard, sans-serif', fontSize: 14 }}>불러오는 중...</span> <span style={{ color: '#9bcacc', fontFamily: 'Pretendard, sans-serif', fontSize: 14 }}>{t('contentCalendar.loading')}</span>
</div> </div>
); );
} }
@@ -617,13 +635,13 @@ const ContentCalendarContent: React.FC<ContentCalendarContentProps> = ({ onNavig
fontFamily: 'Pretendard, sans-serif', fontWeight: 700, fontSize: 16, fontFamily: 'Pretendard, sans-serif', fontWeight: 700, fontSize: 16,
color: '#e5f1f2', letterSpacing: '-0.096px', lineHeight: '22px', margin: 0, color: '#e5f1f2', letterSpacing: '-0.096px', lineHeight: '22px', margin: 0,
}}> }}>
최근 결과 없음 {t('contentCalendar.noResults')}
</p> </p>
<p style={{ <p style={{
fontFamily: 'Pretendard, sans-serif', fontWeight: 500, fontSize: 12, fontFamily: 'Pretendard, sans-serif', fontWeight: 500, fontSize: 12,
color: '#9bcacc', letterSpacing: '-0.072px', lineHeight: 1, margin: 0, color: '#9bcacc', letterSpacing: '-0.072px', lineHeight: 1, margin: 0,
}}> }}>
제작한 콘텐츠를 소셜 채널에 업로드해 보세요 {t('contentCalendar.noResultsDesc')}
</p> </p>
</div> </div>
<button <button
@@ -635,7 +653,7 @@ const ContentCalendarContent: React.FC<ContentCalendarContentProps> = ({ onNavig
color: '#ffffff', color: '#ffffff',
}} }}
> >
ADO2 콘텐츠 {t('contentCalendar.ado2Contents')}
</button> </button>
</div> </div>
); );
@@ -681,7 +699,7 @@ const ContentCalendarContent: React.FC<ContentCalendarContentProps> = ({ onNavig
fontFamily: 'Pretendard, sans-serif', fontWeight: 700, fontSize: 30, fontFamily: 'Pretendard, sans-serif', fontWeight: 700, fontSize: 30,
color: '#ffffff', letterSpacing: '-0.18px', lineHeight: 1.3, margin: 0, color: '#ffffff', letterSpacing: '-0.18px', lineHeight: 1.3, margin: 0,
}}> }}>
콘텐츠 캘린더 {t('contentCalendar.title')}
</p> </p>
</div> </div>
@@ -746,7 +764,7 @@ const ContentCalendarContent: React.FC<ContentCalendarContentProps> = ({ onNavig
fontFamily: 'Pretendard, sans-serif', fontWeight: 700, fontSize: 30, fontFamily: 'Pretendard, sans-serif', fontWeight: 700, fontSize: 30,
color: '#ffffff', letterSpacing: '-0.18px', lineHeight: 1.3, margin: 0, color: '#ffffff', letterSpacing: '-0.18px', lineHeight: 1.3, margin: 0,
}}> }}>
콘텐츠 캘린더 {t('contentCalendar.title')}
</p> </p>
</div> </div>
@@ -774,7 +792,7 @@ const ContentCalendarContent: React.FC<ContentCalendarContentProps> = ({ onNavig
</div> </div>
{loading ? ( {loading ? (
<div style={{ flex: 1, display: 'flex', alignItems: 'center', justifyContent: 'center' }}> <div style={{ flex: 1, display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
<span style={{ color: '#9bcacc', fontFamily: 'Pretendard, sans-serif', fontSize: 14 }}>불러오는 중...</span> <span style={{ color: '#9bcacc', fontFamily: 'Pretendard, sans-serif', fontSize: 14 }}>{t('contentCalendar.loading')}</span>
</div> </div>
) : renderCalendarGrid()} ) : renderCalendarGrid()}
</div> </div>
+79 -59
View File
@@ -81,29 +81,29 @@ interface ConnectedAccount {
// ===================================================== // =====================================================
const MOCK_CONTENT_METRICS: ContentMetric[] = [ const MOCK_CONTENT_METRICS: ContentMetric[] = [
{ id: 'total-views', label: '조회수', value: 240000, unit: 'count', trend: 3800, trendDirection: 'up' }, { id: 'total-views', label: 'dashboard.metricTotalViews', value: 240000, unit: 'count', trend: 3800, trendDirection: 'up' },
{ id: 'total-watch-time', label: '시청시간', value: 85.3, unit: 'hours', trend: 21.5, trendDirection: 'up' }, { id: 'total-watch-time', label: 'dashboard.metricWatchTime', value: 85.3, unit: 'hours', trend: 21.5, trendDirection: 'up' },
{ id: 'avg-view-duration',label: '평균 시청시간', value: 41, unit: 'minutes', trend: 2.4, trendDirection: 'up' }, { id: 'avg-view-duration',label: 'dashboard.metricAvgViewDuration', value: 41, unit: 'minutes', trend: 2.4, trendDirection: 'up' },
{ id: 'new-subscribers', label: '신규 구독자', value: 483, unit: 'count', trend: 50, trendDirection: 'up' }, { id: 'new-subscribers', label: 'dashboard.metricNewSubscribers', value: 483, unit: 'count', trend: 50, trendDirection: 'up' },
{ id: 'likes', label: '좋아요', value: 15800, unit: 'count', trend: 180, trendDirection: 'up' }, { id: 'likes', label: 'dashboard.metricLikes', value: 15800, unit: 'count', trend: 180, trendDirection: 'up' },
{ id: 'comments', label: '댓글', value: 2500, unit: 'count', trend: 50, trendDirection: 'down' }, { id: 'comments', label: 'dashboard.metricComments', value: 2500, unit: 'count', trend: 50, trendDirection: 'down' },
{ id: 'shares', label: '공유', value: 840, unit: 'count', trend: 15, trendDirection: 'up' }, { id: 'shares', label: 'dashboard.metricShares', value: 840, unit: 'count', trend: 15, trendDirection: 'up' },
{ id: 'uploaded-videos', label: '업로드 영상', value: 17, unit: 'count', trend: 4, trendDirection: 'up' }, { id: 'uploaded-videos', label: 'dashboard.metricUploadedVideos', value: 17, unit: 'count', trend: 4, trendDirection: 'up' },
]; ];
const MOCK_MONTHLY_DATA: MonthlyData[] = [ const MOCK_MONTHLY_DATA: MonthlyData[] = [
{ month: '1월', thisYear: 18000, lastYear: 14500 }, { month: 'dashboard.months.jan', thisYear: 18000, lastYear: 14500 },
{ month: '2월', thisYear: 19500, lastYear: 15800 }, { month: 'dashboard.months.feb', thisYear: 19500, lastYear: 15800 },
{ month: '3월', thisYear: 21000, lastYear: 17200 }, { month: 'dashboard.months.mar', thisYear: 21000, lastYear: 17200 },
{ month: '4월', thisYear: 18500, lastYear: 16800 }, { month: 'dashboard.months.apr', thisYear: 18500, lastYear: 16800 },
{ month: '5월', thisYear: 24000, lastYear: 19500 }, { month: 'dashboard.months.may', thisYear: 24000, lastYear: 19500 },
{ month: '6월', thisYear: 27500, lastYear: 21000 }, { month: 'dashboard.months.jun', thisYear: 27500, lastYear: 21000 },
{ month: '7월', thisYear: 32000, lastYear: 23500 }, { month: 'dashboard.months.jul', thisYear: 32000, lastYear: 23500 },
{ month: '8월', thisYear: 29500, lastYear: 24800 }, { month: 'dashboard.months.aug', thisYear: 29500, lastYear: 24800 },
{ month: '9월', thisYear: 31000, lastYear: 26200 }, { month: 'dashboard.months.sep', thisYear: 31000, lastYear: 26200 },
{ month: '10월', thisYear: 28500, lastYear: 25500 }, { month: 'dashboard.months.oct', thisYear: 28500, lastYear: 25500 },
{ month: '11월', thisYear: 34000, lastYear: 27800 }, { month: 'dashboard.months.nov', thisYear: 34000, lastYear: 27800 },
{ month: '12월', thisYear: 38000, lastYear: 29500 }, { month: 'dashboard.months.dec', thisYear: 38000, lastYear: 29500 },
]; ];
const MOCK_DAILY_DATA: DailyData[] = Array.from({ length: 30 }, (_, i) => { const MOCK_DAILY_DATA: DailyData[] = Array.from({ length: 30 }, (_, i) => {
@@ -201,18 +201,16 @@ const formatNumber = (num: number): string => {
return num.toString(); return num.toString();
}; };
// unit에 따라 value를 표시용 문자열로 변환 (언어별 suffix는 호출부에서 처리) const formatValue = (value: number, unit: string, unitHours: string, unitMinutes: string): string => {
const formatValue = (value: number, unit: string): string => { if (unit === 'hours') return value.toFixed(1) + unitHours;
if (unit === 'hours') return value.toFixed(1) + '시간'; if (unit === 'minutes') return Math.round(value) + unitMinutes;
if (unit === 'minutes') return Math.round(value) + '분';
return formatNumber(Math.round(value)); return formatNumber(Math.round(value));
}; };
// unit에 따라 trend 절댓값을 표시용 문자열로 변환 const formatTrend = (trend: number, unit: string, unitHours: string, unitMinutes: string): string => {
const formatTrend = (trend: number, unit: string): string => {
const abs = Math.abs(trend); const abs = Math.abs(trend);
if (unit === 'hours') return abs.toFixed(1) + '시간'; if (unit === 'hours') return abs.toFixed(1) + unitHours;
if (unit === 'minutes') return Math.round(abs) + '분'; if (unit === 'minutes') return Math.round(abs) + unitMinutes;
return formatNumber(Math.round(abs)); return formatNumber(Math.round(abs));
}; };
@@ -239,19 +237,22 @@ const TrendIcon: React.FC<{ direction: 'up' | 'down' }> = ({ direction }) => (
); );
const StatCard: React.FC<ContentMetric> = ({ label, value, unit, trend, trendDirection }) => { const StatCard: React.FC<ContentMetric> = ({ label, value, unit, trend, trendDirection }) => {
const { t } = useTranslation();
const unitHours = t('dashboard.unitHours');
const unitMinutes = t('dashboard.unitMinutes');
const isNeutral = trend === 0 || trendDirection === '-'; const isNeutral = trend === 0 || trendDirection === '-';
const isUp = trendDirection === 'up'; const isUp = trendDirection === 'up';
return ( return (
<div className="stat-card"> <div className="stat-card">
<span className="stat-label">{label}</span> <span className="stat-label">{t(label)}</span>
<h3 className="stat-value">{formatValue(value, unit)}</h3> <h3 className="stat-value">{formatValue(value, unit, unitHours, unitMinutes)}</h3>
<div className="stat-trend-wrapper"> <div className="stat-trend-wrapper">
{isNeutral ? ( {isNeutral ? (
<span className="stat-trend neutral">─</span> <span className="stat-trend neutral">─</span>
) : ( ) : (
<span className={`stat-trend ${isUp ? 'up' : 'down'}`}> <span className={`stat-trend ${isUp ? 'up' : 'down'}`}>
<TrendIcon direction={isUp ? 'up' : 'down'} /> <TrendIcon direction={isUp ? 'up' : 'down'} />
{isUp ? '+' : '-'}{formatTrend(trend, unit)} {isUp ? '+' : '-'}{formatTrend(trend, unit, unitHours, unitMinutes)}
</span> </span>
)} )}
</div> </div>
@@ -276,11 +277,12 @@ const YearOverYearChart: React.FC<{
currentLabel: string; currentLabel: string;
previousLabel: string; previousLabel: string;
mode: 'day' | 'month'; mode: 'day' | 'month';
}> = ({ data, currentLabel, previousLabel, mode }) => { noDataLabel: string;
}> = ({ data, currentLabel, previousLabel, mode, noDataLabel }) => {
if (data.length === 0) { if (data.length === 0) {
return ( return (
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', height: '200px', opacity: 0.4 }}> <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', height: '200px', opacity: 0.4 }}>
<span>이 기간에 데이터가 없습니다.</span> <span>{noDataLabel}</span>
</div> </div>
); );
} }
@@ -362,14 +364,14 @@ const YearOverYearChart: React.FC<{
// Icon Components // Icon Components
// ===================================================== // =====================================================
const YouTubeIcon: React.FC<{ className?: string }> = ({ className }) => ( const YouTubeIcon: React.FC<{ className?: string; style?: React.CSSProperties }> = ({ className, style }) => (
<svg className={className || "platform-tab-icon"} viewBox="0 0 24 24" fill="currentColor"> <svg className={className || "platform-tab-icon"} style={style} viewBox="0 0 24 24" fill="currentColor">
<path d="M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z" /> <path d="M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z" />
</svg> </svg>
); );
const InstagramIcon: React.FC<{ className?: string }> = ({ className }) => ( const InstagramIcon: React.FC<{ className?: string; style?: React.CSSProperties }> = ({ className, style }) => (
<svg className={className || "platform-tab-icon"} viewBox="0 0 24 24" fill="currentColor"> <svg className={className || "platform-tab-icon"} style={style} viewBox="0 0 24 24" fill="currentColor">
<path d="M12 2.163c3.204 0 3.584.012 4.85.07 3.252.148 4.771 1.691 4.919 4.919.058 1.265.069 1.645.069 4.849 0 3.205-.012 3.584-.069 4.849-.149 3.225-1.664 4.771-4.919 4.919-1.266.058-1.644.07-4.85.07-3.204 0-3.584-.012-4.849-.07-3.26-.149-4.771-1.699-4.919-4.92-.058-1.265-.07-1.644-.07-4.849 0-3.204.013-3.583.07-4.849.149-3.227 1.664-4.771 4.919-4.919 1.266-.057 1.645-.069 4.849-.069zM12 0C8.741 0 8.333.014 7.053.072 2.695.272.273 2.69.073 7.052.014 8.333 0 8.741 0 12c0 3.259.014 3.668.072 4.948.2 4.358 2.618 6.78 6.98 6.98C8.333 23.986 8.741 24 12 24c3.259 0 3.668-.014 4.948-.072 4.354-.2 6.782-2.618 6.979-6.98.059-1.28.073-1.689.073-4.948 0-3.259-.014-3.667-.072-4.947-.196-4.354-2.617-6.78-6.979-6.98C15.668.014 15.259 0 12 0zm0 5.838a6.162 6.162 0 1 0 0 12.324 6.162 6.162 0 0 0 0-12.324zM12 16a4 4 0 1 1 0-8 4 4 0 0 1 0 8zm6.406-11.845a1.44 1.44 0 1 0 0 2.881 1.44 1.44 0 0 0 0-2.881z" /> <path d="M12 2.163c3.204 0 3.584.012 4.85.07 3.252.148 4.771 1.691 4.919 4.919.058 1.265.069 1.645.069 4.849 0 3.205-.012 3.584-.069 4.849-.149 3.225-1.664 4.771-4.919 4.919-1.266.058-1.644.07-4.85.07-3.204 0-3.584-.012-4.849-.07-3.26-.149-4.771-1.699-4.919-4.92-.058-1.265-.07-1.644-.07-4.849 0-3.204.013-3.583.07-4.849.149-3.227 1.664-4.771 4.919-4.919 1.266-.057 1.645-.069 4.849-.069zM12 0C8.741 0 8.333.014 7.053.072 2.695.272.273 2.69.073 7.052.014 8.333 0 8.741 0 12c0 3.259.014 3.668.072 4.948.2 4.358 2.618 6.78 6.98 6.98C8.333 23.986 8.741 24 12 24c3.259 0 3.668-.014 4.948-.072 4.354-.2 6.782-2.618 6.979-6.98.059-1.28.073-1.689.073-4.948 0-3.259-.014-3.667-.072-4.947-.196-4.354-2.617-6.78-6.979-6.98C15.668.014 15.259 0 12 0zm0 5.838a6.162 6.162 0 1 0 0 12.324 6.162 6.162 0 0 0 0-12.324zM12 16a4 4 0 1 1 0-8 4 4 0 0 1 0 8zm6.406-11.845a1.44 1.44 0 1 0 0 2.881 1.44 1.44 0 0 0 0-2.881z" />
</svg> </svg>
); );
@@ -573,7 +575,7 @@ const DashboardContent: React.FC<DashboardContentProps> = ({ onNavigate }) => {
return; return;
} }
if (errorData.code === 'YOUTUBE_API_FAILED') { if (errorData.code === 'YOUTUBE_API_FAILED') {
setError({ code: 'YOUTUBE_API_FAILED', message: 'YouTube Analytics API 호출에 실패했습니다.' }); setError({ code: 'YOUTUBE_API_FAILED', message: t('dashboard.youtubeApiFailed') });
setDashboardData(null); setDashboardData(null);
return; return;
} }
@@ -606,7 +608,7 @@ const DashboardContent: React.FC<DashboardContentProps> = ({ onNavigate }) => {
if (isLoading) { if (isLoading) {
return ( return (
<div className="flex justify-center items-center h-screen"> <div className="flex justify-center items-center h-screen">
<div className="text-lg">{t('데이터 로딩 중...')}</div> <div className="text-lg">{t('dashboard.dataLoading')}</div>
</div> </div>
); );
} }
@@ -614,12 +616,13 @@ const DashboardContent: React.FC<DashboardContentProps> = ({ onNavigate }) => {
// hasUploads === false이고 error 없음: 업로드 영상 없음 → 전체 mock 데이터 표시 + 안내 배너 // hasUploads === false이고 error 없음: 업로드 영상 없음 → 전체 mock 데이터 표시 + 안내 배너
const isEmptyState = dashboardData?.hasUploads === false && !dashboardData?.error; const isEmptyState = dashboardData?.hasUploads === false && !dashboardData?.error;
// 블러 조건: 1)계정 미연결 2)업로드 영상 없음 3)데이터 없음 4)에러 있음
const isBlurred = accounts.length === 0 || isEmptyState || !dashboardData || !!error;
// showMockData=true면 전체 mock 강제, 아니면 API 우선 / isEmptyState 시 mock 폴백 // showMockData=true면 전체 mock 강제, 아니면 API 우선 / isEmptyState 시 mock 폴백
const useReal = !showMockData && !isEmptyState; const useReal = !showMockData && !isEmptyState;
const contentMetrics = (useReal && dashboardData?.contentMetrics?.length) ? dashboardData.contentMetrics : MOCK_CONTENT_METRICS; const hasRealContentMetrics = useReal && !!dashboardData?.contentMetrics?.some((m: ContentMetric) => m.value > 0);
const contentMetrics = hasRealContentMetrics ? dashboardData!.contentMetrics : MOCK_CONTENT_METRICS;
// 블러 조건: 1)계정 미연결 2)업로드 영상 없음 3)데이터 없음 4)에러 있음 5)실제 지표 없음
const isBlurred = accounts.length === 0 || isEmptyState || !dashboardData || !!error || !hasRealContentMetrics;
const topContent = (useReal && dashboardData?.topContent?.length) ? dashboardData.topContent : MOCK_TOP_CONTENT; const topContent = (useReal && dashboardData?.topContent?.length) ? dashboardData.topContent : MOCK_TOP_CONTENT;
const hasRealAgeGroups = useReal && !!dashboardData?.audienceData?.ageGroups?.some(g => g.percentage > 0); const hasRealAgeGroups = useReal && !!dashboardData?.audienceData?.ageGroups?.some(g => g.percentage > 0);
const hasRealGender = useReal && ((dashboardData?.audienceData?.gender?.male ?? 0) + (dashboardData?.audienceData?.gender?.female ?? 0)) > 0; const hasRealGender = useReal && ((dashboardData?.audienceData?.gender?.male ?? 0) + (dashboardData?.audienceData?.gender?.female ?? 0)) > 0;
@@ -631,15 +634,15 @@ const DashboardContent: React.FC<DashboardContentProps> = ({ onNavigate }) => {
const chartData: ChartDataPoint[] = mode === 'month' const chartData: ChartDataPoint[] = mode === 'month'
? ((useReal && dashboardData?.monthlyData?.length) ? ((useReal && dashboardData?.monthlyData?.length)
? dashboardData.monthlyData.map((d: MonthlyData) => ({ label: d.month, current: d.thisYear, previous: d.lastYear })) ? dashboardData.monthlyData.map((d: MonthlyData) => ({ label: d.month, current: d.thisYear, previous: d.lastYear }))
: MOCK_MONTHLY_DATA.map((d: MonthlyData) => ({ label: d.month, current: d.thisYear, previous: d.lastYear }))) : MOCK_MONTHLY_DATA.map((d: MonthlyData) => ({ label: t(d.month), current: d.thisYear, previous: d.lastYear })))
: ((useReal && dashboardData?.dailyData?.length) : ((useReal && dashboardData?.dailyData?.length)
? dashboardData.dailyData.map((d: DailyData) => ({ label: d.date, current: d.thisPeriod, previous: d.lastPeriod })) ? dashboardData.dailyData.map((d: DailyData) => ({ label: d.date, current: d.thisPeriod, previous: d.lastPeriod }))
: MOCK_DAILY_DATA.map((d: DailyData) => ({ label: d.date, current: d.thisPeriod, previous: d.lastPeriod }))); : MOCK_DAILY_DATA.map((d: DailyData) => ({ label: d.date, current: d.thisPeriod, previous: d.lastPeriod })));
// mode별 차트 레이블 // mode별 차트 레이블
const chartCurrentLabel = mode === 'month' ? '올해' : '이번달'; const chartCurrentLabel = mode === 'month' ? t('dashboard.chartThisYear') : t('dashboard.chartThisMonth');
const chartPreviousLabel = mode === 'month' ? '작년' : '지난달'; const chartPreviousLabel = mode === 'month' ? t('dashboard.chartLastYear') : t('dashboard.chartLastMonth');
const chartSectionTitle = mode === 'month' ? t('dashboard.yearOverYear') : '전월 대비 성장'; const chartSectionTitle = mode === 'month' ? t('dashboard.yearOverYear') : t('dashboard.monthOverMonth');
const lastUpdated = new Date().toLocaleDateString('ko-KR', { const lastUpdated = new Date().toLocaleDateString('ko-KR', {
year: 'numeric', year: 'numeric',
@@ -657,8 +660,24 @@ const DashboardContent: React.FC<DashboardContentProps> = ({ onNavigate }) => {
<path d="M15 10l4.553-2.069A1 1 0 0121 8.87v6.26a1 1 0 01-1.447.899L15 14M3 8a2 2 0 012-2h10a2 2 0 012 2v8a2 2 0 01-2 2H5a2 2 0 01-2-2V8z" strokeLinecap="round" strokeLinejoin="round" /> <path d="M15 10l4.553-2.069A1 1 0 0121 8.87v6.26a1 1 0 01-1.447.899L15 14M3 8a2 2 0 012-2h10a2 2 0 012 2v8a2 2 0 01-2 2H5a2 2 0 01-2-2V8z" strokeLinecap="round" strokeLinejoin="round" />
</svg> </svg>
<div> <div>
<p style={{ color: '#a6ffea', fontSize: '20px', fontWeight: 600, marginBottom: '2px' }}>아직 업로드된 영상이 없습니다.</p> <p style={{ color: '#a6ffea', fontSize: '20px', fontWeight: 600, marginBottom: '2px' }}>{t('dashboard.noUploadsTitle')}</p>
<p style={{ color: 'rgba(255,255,255,0.5)', fontSize: '16px' }}>ADO2에서 영상을 업로드하면 실제 통계가 표시됩니다.</p> <p style={{ color: 'rgba(255,255,255,0.5)', fontSize: '16px' }}>{t('dashboard.noUploadsDesc')}</p>
</div>
</div>
</div>
)}
{/* 48시간 지연 안내 배너 */}
{dashboardData && !isEmptyState && !hasRealContentMetrics && !showMockData && (
<div className="mb-4 p-4 border-l-4 rounded" style={{ background: 'rgba(255,210,100,0.06)', borderColor: '#ffd264' }}>
<div className="flex items-center gap-3">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#ffd264" strokeWidth="2" style={{ flexShrink: 0 }}>
<circle cx="12" cy="12" r="10" />
<path d="M12 6v6l4 2" strokeLinecap="round" strokeLinejoin="round" />
</svg>
<div>
<p style={{ color: '#ffd264', fontSize: '16px', fontWeight: 600, marginBottom: '2px' }}>{t('dashboard.dataDelayTitle')}</p>
<p style={{ color: 'rgba(255,255,255,0.5)', fontSize: '14px' }}>{t('dashboard.dataDelayDesc')}</p>
</div> </div>
</div> </div>
</div> </div>
@@ -679,7 +698,7 @@ const DashboardContent: React.FC<DashboardContentProps> = ({ onNavigate }) => {
onClick={() => onNavigate?.('내 정보')} onClick={() => onNavigate?.('내 정보')}
className="ml-4 px-4 py-2 bg-yellow-600 text-white rounded hover:bg-yellow-700 whitespace-nowrap" className="ml-4 px-4 py-2 bg-yellow-600 text-white rounded hover:bg-yellow-700 whitespace-nowrap"
> >
재연동하러 가기 → {t('dashboard.reconnectButton')}
</button> </button>
)} )}
{error.code === 'YOUTUBE_NOT_CONNECTED' && ( {error.code === 'YOUTUBE_NOT_CONNECTED' && (
@@ -687,7 +706,7 @@ const DashboardContent: React.FC<DashboardContentProps> = ({ onNavigate }) => {
onClick={() => onNavigate?.('내 정보')} onClick={() => onNavigate?.('내 정보')}
className="ml-4 px-4 py-2 bg-yellow-600 text-white rounded hover:bg-yellow-700 whitespace-nowrap" className="ml-4 px-4 py-2 bg-yellow-600 text-white rounded hover:bg-yellow-700 whitespace-nowrap"
> >
연동하러 가기 → {t('dashboard.connectButton')}
</button> </button>
)} )}
{(error.code === 'YOUTUBE_API_FAILED' || error.code === 'DASHBOARD_DATA_ERROR') && ( {(error.code === 'YOUTUBE_API_FAILED' || error.code === 'DASHBOARD_DATA_ERROR') && (
@@ -695,7 +714,7 @@ const DashboardContent: React.FC<DashboardContentProps> = ({ onNavigate }) => {
onClick={() => { setError(null); setRetryTrigger((n: number) => n + 1); }} onClick={() => { setError(null); setRetryTrigger((n: number) => n + 1); }}
className="ml-4 px-4 py-2 bg-yellow-600 text-white rounded hover:bg-yellow-700 whitespace-nowrap" className="ml-4 px-4 py-2 bg-yellow-600 text-white rounded hover:bg-yellow-700 whitespace-nowrap"
> >
재시도 → {t('dashboard.retryButton')}
</button> </button>
)} )}
</div> </div>
@@ -738,7 +757,7 @@ const DashboardContent: React.FC<DashboardContentProps> = ({ onNavigate }) => {
</span> </span>
</> </>
) : ( ) : (
<span style={{ flex: 1, color: 'rgba(255,255,255,0.4)' }}>계정을 선택하세요</span> <span style={{ flex: 1, color: 'rgba(255,255,255,0.4)' }}>{t('dashboard.selectAccount')}</span>
); );
})()} })()}
<svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="rgba(255,255,255,0.5)" strokeWidth="2" style={{ flexShrink: 0, marginLeft: 'auto' }}> <svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="rgba(255,255,255,0.5)" strokeWidth="2" style={{ flexShrink: 0, marginLeft: 'auto' }}>
@@ -800,20 +819,20 @@ const DashboardContent: React.FC<DashboardContentProps> = ({ onNavigate }) => {
<div className="flex items-center justify-between mb-4"> <div className="flex items-center justify-between mb-4">
<div> <div>
<h2 className="dashboard-section-title" style={{ marginBottom: '2px' }}>{t('dashboard.contentPerformance')}</h2> <h2 className="dashboard-section-title" style={{ marginBottom: '2px' }}>{t('dashboard.contentPerformance')}</h2>
<p style={{ fontSize: '14px', color: 'rgba(255,255,255,0.4)', margin: 0 }}>ADO2에서 업로드한 최근 30개의 영상 통계가 표시됩니다.</p> <p style={{ fontSize: '14px', color: 'rgba(255,255,255,0.4)', margin: 0 }}>{t('dashboard.recentVideosDesc')}</p>
</div> </div>
<div className="mode-toggle"> <div className="mode-toggle">
<button <button
className={`mode-btn ${mode === 'month' ? 'active' : ''}`} className={`mode-btn ${mode === 'month' ? 'active' : ''}`}
onClick={() => setMode('month')} onClick={() => setMode('month')}
> >
연간 {t('dashboard.modeAnnual')}
</button> </button>
<button <button
className={`mode-btn ${mode === 'day' ? 'active' : ''}`} className={`mode-btn ${mode === 'day' ? 'active' : ''}`}
onClick={() => setMode('day')} onClick={() => setMode('day')}
> >
월간 {t('dashboard.modeMonthly')}
</button> </button>
</div> </div>
</div> </div>
@@ -850,6 +869,7 @@ const DashboardContent: React.FC<DashboardContentProps> = ({ onNavigate }) => {
currentLabel={chartCurrentLabel} currentLabel={chartCurrentLabel}
previousLabel={chartPreviousLabel} previousLabel={chartPreviousLabel}
mode={mode} mode={mode}
noDataLabel={t('dashboard.noDataInPeriod')}
/> />
</div> </div>
</div> </div>
@@ -874,7 +894,7 @@ const DashboardContent: React.FC<DashboardContentProps> = ({ onNavigate }) => {
<AnimatedSection delay={1000} className="audience-section"> <AnimatedSection delay={1000} className="audience-section">
<div style={{ marginBottom: '16px' }}> <div style={{ marginBottom: '16px' }}>
<h2 className="dashboard-section-title" style={{ marginBottom: '2px' }}>{t('dashboard.audienceInsights')}</h2> <h2 className="dashboard-section-title" style={{ marginBottom: '2px' }}>{t('dashboard.audienceInsights')}</h2>
<p style={{ fontSize: '14px', color: 'rgba(255,255,255,0.4)', margin: 0 }}>선택한 채널의 통계가 표시됩니다.</p> <p style={{ fontSize: '14px', color: 'rgba(255,255,255,0.4)', margin: 0 }}>{t('dashboard.channelStatsDesc')}</p>
</div> </div>
<div style={{ position: 'relative' }}> <div style={{ position: 'relative' }}>
<div className="audience-cards" style={!hasRealAudienceData && !showMockData ? { filter: 'blur(4px)', pointerEvents: 'none', userSelect: 'none' } : {}}> <div className="audience-cards" style={!hasRealAudienceData && !showMockData ? { filter: 'blur(4px)', pointerEvents: 'none', userSelect: 'none' } : {}}>
@@ -907,7 +927,7 @@ const DashboardContent: React.FC<DashboardContentProps> = ({ onNavigate }) => {
padding: '20px 28px', padding: '20px 28px',
}}> }}>
<p style={{ color: 'rgba(255,255,255,0.85)', fontSize: '16px', fontWeight: 500, margin: 0, textAlign: 'center' }}> <p style={{ color: 'rgba(255,255,255,0.85)', fontSize: '16px', fontWeight: 500, margin: 0, textAlign: 'center' }}>
누적 데이터가 부족하여 실제 시청자 정보가 없습니다. {t('dashboard.noAudienceData')}
</p> </p>
</div> </div>
</div> </div>
@@ -943,7 +963,7 @@ const DashboardContent: React.FC<DashboardContentProps> = ({ onNavigate }) => {
: <><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/><circle cx="12" cy="12" r="3"/></> : <><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/><circle cx="12" cy="12" r="3"/></>
} }
</svg> </svg>
{showMockData ? 'Sample 숨기기' : 'Sample 보기'} {showMockData ? t('dashboard.sampleHide') : t('dashboard.sampleShow')}
</button> </button>
</div> </div>
); );
+64 -32
View File
@@ -1,5 +1,5 @@
import React, { useEffect, useRef, useState } from 'react'; import React, { useCallback, useEffect, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import Sidebar from '../../components/Sidebar'; import Sidebar from '../../components/Sidebar';
import AssetManagementContent from './AssetManagementContent'; import AssetManagementContent from './AssetManagementContent';
@@ -14,7 +14,7 @@ import ContentCalendarContent from './ContentCalendarContent';
import LoadingSection from '../Analysis/LoadingSection'; import LoadingSection from '../Analysis/LoadingSection';
import AnalysisResultSection from '../Analysis/AnalysisResultSection'; import AnalysisResultSection from '../Analysis/AnalysisResultSection';
import { ImageItem, CrawlingResponse, UserMeResponse } from '../../types/api'; import { ImageItem, CrawlingResponse, UserMeResponse } from '../../types/api';
import { crawlUrl, autocomplete, AutocompleteRequest, getUserMe, clearTokens } from '../../utils/api'; import { crawlUrl, autocomplete, AutocompleteRequest, getUserMe, getUserCredits, clearTokens } from '../../utils/api';
import { useTutorial } from '../../components/Tutorial/useTutorial'; import { useTutorial } from '../../components/Tutorial/useTutorial';
import { TUTORIAL_KEYS } from '../../components/Tutorial/tutorialSteps'; import { TUTORIAL_KEYS } from '../../components/Tutorial/tutorialSteps';
import TutorialOverlay, { TutorialRestartPopup } from '../../components/Tutorial/TutorialOverlay'; import TutorialOverlay, { TutorialRestartPopup } from '../../components/Tutorial/TutorialOverlay';
@@ -24,6 +24,7 @@ const ACTIVE_ITEM_KEY = 'castad_active_item';
const SONG_TASK_ID_KEY = 'castad_song_task_id'; const SONG_TASK_ID_KEY = 'castad_song_task_id';
const IMAGE_TASK_ID_KEY = 'castad_image_task_id'; const IMAGE_TASK_ID_KEY = 'castad_image_task_id';
const ANALYSIS_DATA_KEY = 'castad_analysis_data'; const ANALYSIS_DATA_KEY = 'castad_analysis_data';
import { saveSearchHistory } from '../../components/SearchHistory/useSearchHistory';
// 다른 컴포넌트에서 사용하는 storage key들 (초기화용) // 다른 컴포넌트에서 사용하는 storage key들 (초기화용)
const SONG_GENERATION_KEY = 'castad_song_generation'; const SONG_GENERATION_KEY = 'castad_song_generation';
@@ -114,15 +115,28 @@ const GenerationFlow: React.FC<GenerationFlowProps> = ({
const [videoGenerationProgress, setVideoGenerationProgress] = useState(0); const [videoGenerationProgress, setVideoGenerationProgress] = useState(0);
const [analysisData, setAnalysisData] = useState<CrawlingResponse | null>(parseAnalysisData()); const [analysisData, setAnalysisData] = useState<CrawlingResponse | null>(parseAnalysisData());
const [analysisError, setAnalysisError] = useState<string | null>(null); const [analysisError, setAnalysisError] = useState<string | null>(null);
const [isAnalysisComplete, setIsAnalysisComplete] = useState(false);
const [userInfo, setUserInfo] = useState<UserMeResponse | null>(null); const [userInfo, setUserInfo] = useState<UserMeResponse | null>(null);
const [credits, setCredits] = useState<number | null>(null);
const [myInfoInitialTab, setMyInfoInitialTab] = useState<'basic' | 'payment' | 'business' | undefined>(undefined);
const tutorial = useTutorial(); const tutorial = useTutorial();
// 로그인 직후 사용자 정보 조회 const refreshCredits = useCallback(async () => {
try {
const { credits } = await getUserCredits();
setCredits(credits);
} catch (e) {
console.error('Failed to refresh credits:', e);
}
}, []);
// 로그인 직후 사용자 정보 + 크레딧 조회
useEffect(() => { useEffect(() => {
const fetchUserInfo = async () => { const fetchUserInfo = async () => {
try { try {
const data = await getUserMe(); const [data, creditsData] = await Promise.all([getUserMe(), getUserCredits()]);
setUserInfo(data); setUserInfo(data);
setCredits(creditsData.credits);
} catch (error) { } catch (error) {
console.error('Failed to fetch user info:', error); console.error('Failed to fetch user info:', error);
} }
@@ -208,6 +222,7 @@ const GenerationFlow: React.FC<GenerationFlowProps> = ({
// 업체명 자동완성으로 분석 시작 // 업체명 자동완성으로 분석 시작
const handleAutocomplete = async (request: AutocompleteRequest) => { const handleAutocomplete = async (request: AutocompleteRequest) => {
goToWizardStep(-1); // 로딩 상태로 goToWizardStep(-1); // 로딩 상태로
setIsAnalysisComplete(false);
setAnalysisError(null); setAnalysisError(null);
try { try {
@@ -215,11 +230,11 @@ const GenerationFlow: React.FC<GenerationFlowProps> = ({
console.log('[Autocomplete] Response m_id:', data.m_id); console.log('[Autocomplete] Response m_id:', data.m_id);
// 기본값 보장 // 기본값 보장
if (data.marketing_analysis) { // if (data.marketing_analysis) {
data.marketing_analysis.tags = data.marketing_analysis.tags || []; // data.marketing_analysis.tags = data.marketing_analysis.tags || [];
data.marketing_analysis.facilities = data.marketing_analysis.facilities || []; // data.marketing_analysis.facilities = data.marketing_analysis.facilities || [];
data.marketing_analysis.report = data.marketing_analysis.report || ''; // data.marketing_analysis.report = data.marketing_analysis.report || '';
} // }
if (data.processed_info) { if (data.processed_info) {
data.processed_info.customer_name = data.processed_info.customer_name || '알 수 없음'; data.processed_info.customer_name = data.processed_info.customer_name || '알 수 없음';
data.processed_info.region = data.processed_info.region || ''; data.processed_info.region = data.processed_info.region || '';
@@ -229,10 +244,11 @@ const GenerationFlow: React.FC<GenerationFlowProps> = ({
setAnalysisData(data); setAnalysisData(data);
localStorage.setItem(ANALYSIS_DATA_KEY, JSON.stringify(data)); localStorage.setItem(ANALYSIS_DATA_KEY, JSON.stringify(data));
goToWizardStep(0); // 브랜드 분석 결과로 saveSearchHistory({ type: 'name', value: request.title.replace(/<[^>]*>/g, ''), address: request.address, roadAddress: request.roadAddress });
setIsAnalysisComplete(true);
} catch (err) { } catch (err) {
console.error('Autocomplete error:', err); console.error('Autocomplete error:', err);
setAnalysisError(err instanceof Error ? err.message : t('app.autocompleteError')); setAnalysisError(t('app.autocompleteError'));
goToWizardStep(-2); // URL 입력으로 돌아가기 goToWizardStep(-2); // URL 입력으로 돌아가기
} }
}; };
@@ -275,6 +291,7 @@ const GenerationFlow: React.FC<GenerationFlowProps> = ({
if (!url.trim()) return; if (!url.trim()) return;
goToWizardStep(-1); // 로딩 상태로 goToWizardStep(-1); // 로딩 상태로
setIsAnalysisComplete(false);
setAnalysisError(null); setAnalysisError(null);
try { try {
@@ -282,11 +299,11 @@ const GenerationFlow: React.FC<GenerationFlowProps> = ({
console.log('[Crawl] Response m_id:', data.m_id); console.log('[Crawl] Response m_id:', data.m_id);
// 기본값 보장 // 기본값 보장
if (data.marketing_analysis) { // if (data.marketing_analysis) {
data.marketing_analysis.tags = data.marketing_analysis.tags || []; // data.marketing_analysis.tags = data.marketing_analysis.tags || [];
data.marketing_analysis.facilities = data.marketing_analysis.facilities || []; // data.marketing_analysis.facilities = data.marketing_analysis.facilities || [];
data.marketing_analysis.report = data.marketing_analysis.report || ''; // data.marketing_analysis.report = data.marketing_analysis.report || '';
} // }
if (data.processed_info) { if (data.processed_info) {
data.processed_info.customer_name = data.processed_info.customer_name || '알 수 없음'; data.processed_info.customer_name = data.processed_info.customer_name || '알 수 없음';
data.processed_info.region = data.processed_info.region || ''; data.processed_info.region = data.processed_info.region || '';
@@ -296,11 +313,11 @@ const GenerationFlow: React.FC<GenerationFlowProps> = ({
setAnalysisData(data); setAnalysisData(data);
localStorage.setItem(ANALYSIS_DATA_KEY, JSON.stringify(data)); localStorage.setItem(ANALYSIS_DATA_KEY, JSON.stringify(data));
goToWizardStep(0); // 브랜드 분석 결과로 saveSearchHistory({ type: 'url', value: url });
setIsAnalysisComplete(true);
} catch (err) { } catch (err) {
console.error('Crawling failed:', err); console.error('Crawling failed:', err);
const errorMessage = err instanceof Error ? err.message : t('app.analysisError'); setAnalysisError(t('app.analysisError'));
setAnalysisError(errorMessage);
goToWizardStep(-2); // URL 입력으로 돌아가기 goToWizardStep(-2); // URL 입력으로 돌아가기
} }
}; };
@@ -349,8 +366,15 @@ const GenerationFlow: React.FC<GenerationFlowProps> = ({
} }
}, [activeItem]); }, [activeItem]);
// 결제 탭으로 바로 이동하는 핸들러 (크레딧 충전하기 버튼용)
const handleGoToPayment = () => {
setMyInfoInitialTab('payment');
setActiveItem('내 정보');
};
// 네비게이션 핸들러 - "새 프로젝트 만들기" 클릭 시 기존 프로젝트 데이터 초기화 // 네비게이션 핸들러 - "새 프로젝트 만들기" 클릭 시 기존 프로젝트 데이터 초기화
const handleNavigate = (item: string) => { const handleNavigate = (item: string) => {
setMyInfoInitialTab(undefined);
if (item === '새 프로젝트 만들기') { if (item === '새 프로젝트 만들기') {
// 기존 프로젝트 데이터 초기화 // 기존 프로젝트 데이터 초기화
clearAllProjectStorage(); clearAllProjectStorage();
@@ -367,6 +391,7 @@ const GenerationFlow: React.FC<GenerationFlowProps> = ({
setAnalysisError(null); setAnalysisError(null);
} }
setActiveItem(item); setActiveItem(item);
refreshCredits();
}; };
// 새 프로젝트 만들기 - 단계별 컨텐츠 렌더링 // 새 프로젝트 만들기 - 단계별 컨텐츠 렌더링
@@ -384,7 +409,12 @@ const GenerationFlow: React.FC<GenerationFlowProps> = ({
); );
case -1: case -1:
// 로딩 단계 // 로딩 단계
return <LoadingSection />; return (
<LoadingSection
isComplete={isAnalysisComplete}
onComplete={() => goToWizardStep(0)}
/>
);
case 0: case 0:
// 브랜드 분석 결과 단계 // 브랜드 분석 결과 단계
if (!analysisData) { if (!analysisData) {
@@ -432,6 +462,7 @@ const GenerationFlow: React.FC<GenerationFlowProps> = ({
mId={analysisData?.m_id ?? 0} mId={analysisData?.m_id ?? 0}
videoGenerationStatus={videoGenerationStatus} videoGenerationStatus={videoGenerationStatus}
videoGenerationProgress={videoGenerationProgress} videoGenerationProgress={videoGenerationProgress}
onGoToPayment={handleGoToPayment}
onStatusChange={(status: string) => { onStatusChange={(status: string) => {
if (status === 'generating_song' && !tutorial.hasSeen(TUTORIAL_KEYS.SOUND_LYRICS)) { if (status === 'generating_song' && !tutorial.hasSeen(TUTORIAL_KEYS.SOUND_LYRICS)) {
setTimeout(() => tutorial.startTutorial(TUTORIAL_KEYS.SOUND_LYRICS), 400); setTimeout(() => tutorial.startTutorial(TUTORIAL_KEYS.SOUND_LYRICS), 400);
@@ -456,6 +487,7 @@ const GenerationFlow: React.FC<GenerationFlowProps> = ({
songTaskId={songTaskId} songTaskId={songTaskId}
onVideoStatusChange={setVideoGenerationStatus} onVideoStatusChange={setVideoGenerationStatus}
onVideoProgressChange={setVideoGenerationProgress} onVideoProgressChange={setVideoGenerationProgress}
onGoToCalendar={() => handleNavigate('콘텐츠 캘린더')}
/> />
); );
default: default:
@@ -473,12 +505,13 @@ const GenerationFlow: React.FC<GenerationFlowProps> = ({
return ( return (
<ADO2ContentsPage <ADO2ContentsPage
onBack={() => setActiveItem('새 프로젝트 만들기')} onBack={() => setActiveItem('새 프로젝트 만들기')}
onNavigate={handleNavigate}
/> />
); );
case '콘텐츠 캘린더': case '콘텐츠 캘린더':
return <ContentCalendarContent onNavigate={handleNavigate} />; return <ContentCalendarContent onNavigate={handleNavigate} />;
case '내 정보': case '내 정보':
return <MyInfoContent />; return <MyInfoContent initialTab={myInfoInitialTab} />;
case '새 프로젝트 만들기': case '새 프로젝트 만들기':
// 브랜드 분석(0)과 로딩(-1)은 전체 화면으로 표시 // 브랜드 분석(0)과 로딩(-1)은 전체 화면으로 표시
if (wizardStep === 0 || wizardStep === -1) { if (wizardStep === 0 || wizardStep === -1) {
@@ -519,23 +552,22 @@ const GenerationFlow: React.FC<GenerationFlowProps> = ({
return null; return null;
}; };
const handleTutorialRestart = () => {
tutorial.showRestartPopup(getCurrentTutorialKey()!);
};
const tutorialUI = ( const tutorialUI = (
<> <>
{getCurrentTutorialKey() && ( {getCurrentTutorialKey() && (
<button <button
className="tutorial-restart-fab" className={`tutorial-toggle-fab ${tutorial.isEnabled ? 'active' : ''}`}
onClick={handleTutorialRestart} onClick={() => tutorial.toggleTutorial(getCurrentTutorialKey())}
title={t('sidebar.tutorialRestart')} title={tutorial.isEnabled ? t('sidebar.tutorialOff') : t('sidebar.tutorialOn')}
> >
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5"> <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5">
<circle cx="12" cy="12" r="10"/> <circle cx="12" cy="12" r="10"/>
<path d="M12 8v4l3 3"/> <path d="M12 8v4l3 3"/>
</svg> </svg>
<span>{t('sidebar.tutorialRestart')}</span> <span>{t('sidebar.tutorial')}</span>
<span className={`tutorial-toggle-badge ${tutorial.isEnabled ? 'on' : 'off'}`}>
{tutorial.isEnabled ? 'ON' : 'OFF'}
</span>
</button> </button>
)} )}
{tutorial.isActive && ( {tutorial.isActive && (
@@ -562,7 +594,7 @@ const GenerationFlow: React.FC<GenerationFlowProps> = ({
return ( return (
<div className="analysis-page-wrapper"> <div className="analysis-page-wrapper">
{showSidebar && ( {showSidebar && (
<Sidebar activeItem={activeItem} onNavigate={handleNavigate} onHome={handleHome} userInfo={userInfo} onLogout={handleLogout} /> <Sidebar activeItem={activeItem} onNavigate={handleNavigate} onHome={handleHome} userInfo={userInfo} onLogout={handleLogout} credits={credits} />
)} )}
<main className="analysis-page-main"> <main className="analysis-page-main">
{renderContent()} {renderContent()}
@@ -575,7 +607,7 @@ const GenerationFlow: React.FC<GenerationFlowProps> = ({
return ( return (
<div className={`flex w-full bg-[#002224] text-white ${needsScroll ? 'min-h-[100dvh]' : 'h-[100dvh] overflow-hidden'}`}> <div className={`flex w-full bg-[#002224] text-white ${needsScroll ? 'min-h-[100dvh]' : 'h-[100dvh] overflow-hidden'}`}>
{showSidebar && ( {showSidebar && (
<Sidebar activeItem={activeItem} onNavigate={handleNavigate} onHome={handleHome} userInfo={userInfo} onLogout={handleLogout} /> <Sidebar activeItem={activeItem} onNavigate={handleNavigate} onHome={handleHome} userInfo={userInfo} onLogout={handleLogout} credits={credits} />
)} )}
{tutorialUI} {tutorialUI}
<div className={`flex-1 relative pl-0 md:pl-0 ${needsScroll ? 'overflow-auto' : 'h-full overflow-hidden'}`}> <div className={`flex-1 relative pl-0 md:pl-0 ${needsScroll ? 'overflow-auto' : 'h-full overflow-hidden'}`}>
+129 -4
View File
@@ -1,18 +1,53 @@
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { getSocialAccounts, getYouTubeConnectUrl, disconnectSocialAccount, TokenExpiredError, handleSocialReconnect } from '../../utils/api'; import { getSocialAccounts, getYouTubeConnectUrl, disconnectSocialAccount, TokenExpiredError, handleSocialReconnect, getUserCredits, requestCreditCharge } from '../../utils/api';
import { SocialAccount } from '../../types/api'; import { SocialAccount } from '../../types/api';
type TabType = 'basic' | 'payment' | 'business'; type TabType = 'basic' | 'payment' | 'business';
const MyInfoContent: React.FC = () => { interface MyInfoContentProps {
initialTab?: TabType;
}
const MyInfoContent: React.FC<MyInfoContentProps> = ({ initialTab }) => {
const { t } = useTranslation(); const { t } = useTranslation();
const [activeTab, setActiveTab] = useState<TabType>('business'); const [activeTab, setActiveTab] = useState<TabType>(initialTab || 'business');
const [businessUrl, setBusinessUrl] = useState(''); const [businessUrl, setBusinessUrl] = useState('');
const [socialAccounts, setSocialAccounts] = useState<SocialAccount[]>([]); const [socialAccounts, setSocialAccounts] = useState<SocialAccount[]>([]);
const [isLoadingAccounts, setIsLoadingAccounts] = useState(false); const [isLoadingAccounts, setIsLoadingAccounts] = useState(false);
const [isConnecting, setIsConnecting] = useState<string | null>(null); const [isConnecting, setIsConnecting] = useState<string | null>(null);
const [credits, setCredits] = useState<number | null>(null);
const [isLoadingCredits, setIsLoadingCredits] = useState(false);
const [showChargePopup, setShowChargePopup] = useState(false);
const [chargeAmount, setChargeAmount] = useState('');
const [chargeNote, setChargeNote] = useState('');
const [isRequesting, setIsRequesting] = useState(false);
const [chargeSuccess, setChargeSuccess] = useState(false);
// initialTab 변경 시 탭 업데이트
useEffect(() => {
if (initialTab) setActiveTab(initialTab);
}, [initialTab]);
// 크레딧 로드
useEffect(() => {
if (activeTab === 'payment') {
loadCredits();
}
}, [activeTab]);
const loadCredits = async () => {
setIsLoadingCredits(true);
try {
const data = await getUserCredits();
setCredits(data.credits);
} catch (error) {
console.error('Failed to load credits:', error);
} finally {
setIsLoadingCredits(false);
}
};
// 소셜 계정 목록 로드 // 소셜 계정 목록 로드
useEffect(() => { useEffect(() => {
@@ -84,6 +119,74 @@ const MyInfoContent: React.FC = () => {
]; ];
return ( return (
<>
{showChargePopup && (
<div className="myinfo-popup-overlay" onClick={() => { setShowChargePopup(false); setChargeSuccess(false); setChargeAmount(''); setChargeNote(''); }}>
<div className="myinfo-popup" onClick={e => e.stopPropagation()}>
{chargeSuccess ? (
<>
<p className="myinfo-popup-message">{t('myInfo.chargeSuccess')}</p>
<button className="myinfo-popup-close" onClick={() => { setShowChargePopup(false); setChargeSuccess(false); setChargeAmount(''); setChargeNote(''); }}>{t('myInfo.chargeConfirm')}</button>
</>
) : (
<>
<h3 className="myinfo-popup-title">{t('myInfo.chargePopupTitle')}</h3>
<div className="myinfo-popup-field">
<label className="myinfo-popup-label">{t('myInfo.chargeAmountLabel')}</label>
<div className="myinfo-popup-counter">
<button
className="myinfo-popup-counter-btn"
onClick={() => setChargeAmount(v => String(Math.max(1, Number(v || 0) - 1)))}
>−</button>
<input
type="number"
className="myinfo-popup-input myinfo-popup-input--center"
placeholder="0"
value={chargeAmount}
onChange={e => setChargeAmount(e.target.value.replace(/[^0-9]/g, ''))}
min={1}
/>
<button
className="myinfo-popup-counter-btn"
onClick={() => setChargeAmount(v => String(Number(v || 0) + 1))}
>+</button>
</div>
</div>
<div className="myinfo-popup-field">
<label className="myinfo-popup-label">{t('myInfo.chargeNoteLabel')}</label>
<textarea
className="myinfo-popup-textarea"
placeholder={t('myInfo.chargeNotePlaceholder')}
value={chargeNote}
onChange={e => setChargeNote(e.target.value)}
rows={3}
/>
</div>
<div className="myinfo-popup-actions">
<button className="myinfo-popup-cancel" onClick={() => { setShowChargePopup(false); setChargeAmount(''); setChargeNote(''); }}>{t('myInfo.chargeCancel')}</button>
<button
className="myinfo-popup-close"
disabled={!chargeAmount || isRequesting}
onClick={async () => {
setIsRequesting(true);
try {
await requestCreditCharge(Number(chargeAmount), chargeNote);
} catch (e) {
console.error('Charge request failed:', e);
} finally {
setIsRequesting(false);
setChargeSuccess(true);
}
}}
>
{isRequesting ? t('myInfo.chargeSubmitting') : t('myInfo.chargeSubmit')}
</button>
</div>
</>
)}
</div>
</div>
)}
<main className="myinfo-page"> <main className="myinfo-page">
<h1 className="myinfo-title">{t('myInfo.title')}</h1> <h1 className="myinfo-title">{t('myInfo.title')}</h1>
@@ -110,7 +213,28 @@ const MyInfoContent: React.FC = () => {
{activeTab === 'payment' && ( {activeTab === 'payment' && (
<div className="myinfo-section"> <div className="myinfo-section">
<p className="myinfo-placeholder">{t('myInfo.paymentPlaceholder')}</p> <h2 className="myinfo-section-title">{t('myInfo.creditsTitle')}</h2>
<div className="myinfo-credits-card">
{isLoadingCredits ? (
<p className="myinfo-placeholder">{t('myInfo.creditsLoading')}</p>
) : (
<>
<div className="myinfo-credits-row">
<span className="myinfo-credits-label">{t('myInfo.creditsLabel')}</span>
<span className="myinfo-credits-value">{credits !== null ? credits.toLocaleString() : '-'} {t('myInfo.creditsUnit')}</span>
</div>
<div className="myinfo-credits-row">
<p className="myinfo-credits-desc">{t('myInfo.creditsDesc')}</p>
<button
className="myinfo-credits-charge-btn"
onClick={() => setShowChargePopup(true)}
>
{t('myInfo.creditsChargeBtn')}
</button>
</div>
</>
)}
</div>
</div> </div>
)} )}
@@ -250,6 +374,7 @@ const MyInfoContent: React.FC = () => {
)} )}
</div> </div>
</main> </main>
</>
); );
}; };
+95 -79
View File
@@ -19,6 +19,7 @@ interface SoundStudioContentProps {
onStatusChange?: (status: string) => void; onStatusChange?: (status: string) => void;
videoGenerationStatus?: 'idle' | 'generating' | 'complete' | 'error'; videoGenerationStatus?: 'idle' | 'generating' | 'complete' | 'error';
videoGenerationProgress?: number; videoGenerationProgress?: number;
onGoToPayment?: () => void;
} }
type GenerationStatus = 'idle' | 'generating_lyric' | 'generating_song' | 'polling' | 'complete' | 'error'; type GenerationStatus = 'idle' | 'generating_lyric' | 'generating_song' | 'polling' | 'complete' | 'error';
@@ -42,7 +43,8 @@ const SoundStudioContent: React.FC<SoundStudioContentProps> = ({
mId, mId,
onStatusChange, onStatusChange,
videoGenerationStatus = 'idle', videoGenerationStatus = 'idle',
videoGenerationProgress = 0 videoGenerationProgress = 0,
onGoToPayment,
}) => { }) => {
const { t } = useTranslation(); const { t } = useTranslation();
const [selectedType, setSelectedType] = useState('보컬'); const [selectedType, setSelectedType] = useState('보컬');
@@ -60,11 +62,8 @@ const SoundStudioContent: React.FC<SoundStudioContentProps> = ({
const [statusMessage, setStatusMessage] = useState(''); const [statusMessage, setStatusMessage] = useState('');
const [retryCount, setRetryCount] = useState(0); const [retryCount, setRetryCount] = useState(0);
const [songTaskId, setSongTaskId] = useState<string | null>(null); const [songTaskId, setSongTaskId] = useState<string | null>(null);
const [isLanguageDropdownOpen, setIsLanguageDropdownOpen] = useState(false);
const progressBarRef = useRef<HTMLDivElement>(null); const progressBarRef = useRef<HTMLDivElement>(null);
const audioRef = useRef<HTMLAudioElement>(null); const audioRef = useRef<HTMLAudioElement>(null);
const languageDropdownRef = useRef<HTMLDivElement>(null);
// 완료 데이터를 localStorage에 저장 // 완료 데이터를 localStorage에 저장
const saveSongCompletionData = () => { const saveSongCompletionData = () => {
@@ -78,22 +77,6 @@ const SoundStudioContent: React.FC<SoundStudioContentProps> = ({
}; };
// Close language dropdown when clicking outside // Close language dropdown when clicking outside
useEffect(() => {
const handleClickOutside = (event: MouseEvent) => {
if (languageDropdownRef.current && !languageDropdownRef.current.contains(event.target as Node)) {
setIsLanguageDropdownOpen(false);
}
};
if (isLanguageDropdownOpen) {
document.addEventListener('mousedown', handleClickOutside);
}
return () => {
document.removeEventListener('mousedown', handleClickOutside);
};
}, [isLanguageDropdownOpen]);
// Auto-navigate to next page when video generation is complete // Auto-navigate to next page when video generation is complete
useEffect(() => { useEffect(() => {
if (videoGenerationStatus === 'complete' && songTaskId) { if (videoGenerationStatus === 'complete' && songTaskId) {
@@ -293,6 +276,7 @@ const SoundStudioContent: React.FC<SoundStudioContentProps> = ({
try { try {
const language = LANGUAGE_MAP[selectedLang] || 'Korean'; const language = LANGUAGE_MAP[selectedLang] || 'Korean';
const isInstrumental = selectedType === '배경음악';
// 1. 가사 생성 요청 // 1. 가사 생성 요청
console.log('[SoundStudio] Sending m_id:', mId); console.log('[SoundStudio] Sending m_id:', mId);
@@ -304,12 +288,27 @@ const SoundStudioContent: React.FC<SoundStudioContentProps> = ({
region: businessInfo.region, region: businessInfo.region,
task_id: imageTaskId, task_id: imageTaskId,
orientation, orientation,
...(isInstrumental && { instrumental: true }),
}); });
if (!lyricResponse.success || !lyricResponse.task_id) { if (!lyricResponse.success || !lyricResponse.task_id) {
throw new Error(lyricResponse.error_message || t('soundStudio.lyricGenerationFailed')); throw new Error(lyricResponse.error_message || t('soundStudio.lyricGenerationFailed'));
} }
const genreMap: Record<string, string> = {
'자동 선택': 'pop',
'K-POP': 'kpop',
'발라드': 'ballad',
'Hip-Hop': 'hip-hop',
'R&B': 'rnb',
'EDM': 'edm',
'JAZZ': 'jazz',
'ROCK': 'rock',
};
let songLyrics: string | undefined;
if (!isInstrumental) {
// 2. 가사 생성 상태 폴링 → 완료 시 상세 조회 // 2. 가사 생성 상태 폴링 → 완료 시 상세 조회
setStatusMessage(t('soundStudio.generatingLyrics')); setStatusMessage(t('soundStudio.generatingLyrics'));
const lyricDetailResponse = await waitForLyricComplete( const lyricDetailResponse = await waitForLyricComplete(
@@ -331,25 +330,15 @@ const SoundStudioContent: React.FC<SoundStudioContentProps> = ({
} }
setLyrics(lyricDetailResponse.lyric_result); setLyrics(lyricDetailResponse.lyric_result);
songLyrics = lyricDetailResponse.lyric_result;
}
setStatus('generating_song'); setStatus('generating_song');
setStatusMessage(t('soundStudio.generatingSong')); setStatusMessage(t('soundStudio.generatingSong'));
const genreMap: Record<string, string> = {
'자동 선택': 'pop',
'K-POP': 'kpop',
'발라드': 'ballad',
'Hip-Hop': 'hip-hop',
'R&B': 'rnb',
'EDM': 'edm',
'JAZZ': 'jazz',
'ROCK': 'rock',
};
const songResponse = await generateSong(imageTaskId, { const songResponse = await generateSong(imageTaskId, {
genre: genreMap[selectedGenre] || 'pop', genre: genreMap[selectedGenre] || 'pop',
language, ...(isInstrumental ? { instrumental: true, lyrics: '' } : { language, lyrics: songLyrics }),
lyrics: lyricDetailResponse.lyric_result,
}); });
if (!songResponse.success) { if (!songResponse.success) {
@@ -368,7 +357,7 @@ const SoundStudioContent: React.FC<SoundStudioContentProps> = ({
setStatus('polling'); setStatus('polling');
setStatusMessage(t('soundStudio.generatingSong')); setStatusMessage(t('soundStudio.generatingSong'));
await resumePolling(songResponse.task_id, songResponse.song_id, lyricDetailResponse.lyric_result, 0); await resumePolling(songResponse.task_id, songResponse.song_id, songLyrics ?? '', 0);
} catch (error) { } catch (error) {
console.error('Music generation failed:', error); console.error('Music generation failed:', error);
@@ -428,14 +417,15 @@ const SoundStudioContent: React.FC<SoundStudioContentProps> = ({
<label className="input-label">{t('soundStudio.soundTypeLabel')}</label> <label className="input-label">{t('soundStudio.soundTypeLabel')}</label>
<div className="sound-type-grid"> <div className="sound-type-grid">
{[ {[
{ key: '보컬', label: t('soundStudio.soundTypeVocal') }, { key: '보컬', label: t('soundStudio.soundTypeVocal'), disabled: false },
{ key: '배경음악', label: t('soundStudio.soundTypeBGM') }, { key: '배경음악', label: t('soundStudio.soundTypeBGM'), disabled: false },
].map(({ key, label }) => ( ].map(({ key, label, disabled }) => (
<button <button
key={key} key={key}
onClick={() => !isGenerating && setSelectedType(key)} onClick={() => !isGenerating && !disabled && setSelectedType(key)}
disabled={isGenerating} disabled={isGenerating || disabled}
className={`sound-type-btn ${selectedType === key ? 'active' : ''}`} className={`sound-type-btn ${selectedType === key ? 'active' : ''}`}
title={disabled ? t('soundStudio.comingSoon', { defaultValue: '이후 오픈 예정입니다' }) : undefined}
> >
{label} {label}
</button> </button>
@@ -494,39 +484,31 @@ const SoundStudioContent: React.FC<SoundStudioContentProps> = ({
{/* Language Selection */} {/* Language Selection */}
<div className="sound-studio-section"> <div className="sound-studio-section">
<label className="input-label">{t('soundStudio.languageLabel')}</label> <label className="input-label">{t('soundStudio.languageLabel')}</label>
<div className="language-selector-wrapper" ref={languageDropdownRef}> <div className="genre-grid language-grid">
<button <div className="genre-row">
onClick={() => setIsLanguageDropdownOpen(!isLanguageDropdownOpen)} {['한국어', 'English', '中文'].map((lang) => (
disabled={isGenerating}
className="language-selector"
>
<div className="language-display">
<span className="language-flag">{LANGUAGE_FLAGS[selectedLang]}</span>
<span className="language-name">{selectedLang}</span>
</div>
<img
src="/assets/images/icon-dropdown.svg"
alt=""
className={`language-dropdown-icon ${isLanguageDropdownOpen ? 'open' : ''}`}
/>
</button>
{isLanguageDropdownOpen && (
<div className="language-dropdown-menu">
{Object.keys(LANGUAGE_MAP).map((lang) => (
<button <button
key={lang} key={lang}
onClick={() => { onClick={() => !isGenerating && selectedType !== '배경음악' && setSelectedLang(lang)}
setSelectedLang(lang); disabled={isGenerating || selectedType === '배경음악'}
setIsLanguageDropdownOpen(false); className={`genre-btn ${selectedLang === lang ? 'active' : ''}`}
}}
className={`language-dropdown-item ${selectedLang === lang ? 'active' : ''}`}
> >
<span className="language-flag">{LANGUAGE_FLAGS[lang]}</span> <span>{LANGUAGE_FLAGS[lang]}</span> {lang}
<span className="language-name">{lang}</span> </button>
))}
</div>
<div className="genre-row">
{['日本語', 'ไทย', 'Tiếng Việt'].map((lang) => (
<button
key={lang}
onClick={() => !isGenerating && selectedType !== '배경음악' && setSelectedLang(lang)}
disabled={isGenerating || selectedType === '배경음악'}
className={`genre-btn ${selectedLang === lang ? 'active' : ''}`}
>
<span>{LANGUAGE_FLAGS[lang]}</span> {lang}
</button> </button>
))} ))}
</div> </div>
)}
</div> </div>
</div> </div>
@@ -539,6 +521,16 @@ const SoundStudioContent: React.FC<SoundStudioContentProps> = ({
</svg> </svg>
{statusMessage} {statusMessage}
</div> </div>
) : status === 'complete' ? (
<>
<button
onClick={handleRegenerate}
className="btn-generate-sound"
>
{t('soundStudio.regenerateButton')}
</button>
<p className="regenerate-hint">{t('soundStudio.regenerateHint')}</p>
</>
) : ( ) : (
<button <button
onClick={handleGenerateMusic} onClick={handleGenerateMusic}
@@ -549,18 +541,30 @@ const SoundStudioContent: React.FC<SoundStudioContentProps> = ({
</button> </button>
)} )}
{errorMessage && ( {errorMessage && (() => {
const isCreditsError = errorMessage.includes('credit');
return (
<div className="error-message-new"> <div className="error-message-new">
{errorMessage} {isCreditsError ? t('soundStudio.creditsExhausted') : errorMessage}
</div> {isCreditsError && (
<a
href=""
className="charge-credits-link"
onClick={e => { e.preventDefault(); onGoToPayment?.(); }}
>
{t('soundStudio.chargeCredits')}
</a>
)} )}
</div> </div>
);
})()}
</div>
{/* Right Column - Lyrics */} {/* Right Column - Lyrics */}
<div className="lyrics-column"> <div className="lyrics-column">
<div className="lyrics-header"> <div className="lyrics-header">
<h3 className="column-title">{t('soundStudio.lyricsColumn')}</h3> <h3 className="column-title">{t('soundStudio.lyricsColumn')}</h3>
<p className="lyrics-subtitle">{t('soundStudio.lyricsHint')}</p> {/* <p className="lyrics-subtitle">{t('soundStudio.lyricsHint')}</p> */}
</div> </div>
{/* Audio Player */} {/* Audio Player */}
@@ -600,16 +604,28 @@ const SoundStudioContent: React.FC<SoundStudioContentProps> = ({
{/* Lyrics Display */} {/* Lyrics Display */}
<div className="lyrics-display"> <div className="lyrics-display">
{lyrics ? ( {lyrics ? (() => {
<textarea const lines = lyrics.split('\n').filter(l => l.trim());
value={lyrics} const size = Math.ceil(lines.length / 3);
onChange={(e) => setLyrics(e.target.value)} const outroLines = lines.slice(size * 2).slice(0, 2);
className="lyrics-textarea" const sections = [
placeholder={t('soundStudio.lyricsPlaceholder')} { tag: '[Verse]', lines: lines.slice(0, size) },
/> { tag: '[Chorus]', lines: lines.slice(size, size * 2) },
) : ( { tag: '[Outro]', lines: outroLines },
].filter(s => s.lines.length > 0);
return (
<div className="lyrics-paragraphs">
{sections.map((section, i) => (
<div key={i} className="lyrics-section">
<span className="lyrics-tag">{section.tag}</span>
<p className="lyrics-paragraph">{section.lines.join('\n')}</p>
</div>
))}
</div>
);
})() : (
<div className="lyrics-placeholder"> <div className="lyrics-placeholder">
{t('soundStudio.lyricsPlaceholder')} {selectedType === '배경음악' ? t('soundStudio.lyricsPlaceholderBGM') : t('soundStudio.lyricsPlaceholder')}
</div> </div>
)} )}
</div> </div>
+44 -10
View File
@@ -1,8 +1,9 @@
import React, { useState, useRef, useCallback } from 'react'; import React, { useState, useRef, useCallback } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { searchAccommodation, AccommodationSearchItem, AutocompleteRequest } from '../../utils/api'; import { searchAccommodation, AccommodationSearchItem, AutocompleteRequest } from '../../utils/api';
import { CrawlingResponse } from '../../types/api'; import { CrawlingResponse } from '../../types/api';
import { useSearchHistory } from '../../components/SearchHistory/useSearchHistory';
import SearchHistoryDropdown from '../../components/SearchHistory/SearchHistoryDropdown';
type SearchType = 'url' | 'name'; type SearchType = 'url' | 'name';
@@ -26,6 +27,23 @@ const UrlInputContent: React.FC<UrlInputContentProps> = ({ onAnalyze, onAutocomp
const [showAutocomplete, setShowAutocomplete] = useState(false); const [showAutocomplete, setShowAutocomplete] = useState(false);
const [selectedItem, setSelectedItem] = useState<AccommodationSearchItem | null>(null); const [selectedItem, setSelectedItem] = useState<AccommodationSearchItem | null>(null);
const [isLoadingTest, setIsLoadingTest] = useState(false); const [isLoadingTest, setIsLoadingTest] = useState(false);
const { filteredHistory, showHistory, openHistory, closeHistory, hideOnInput, deleteItem } = useSearchHistory(searchType);
const handleSelectHistory = (item: { type: 'url' | 'name'; value: string; address?: string; roadAddress?: string }) => {
closeHistory();
if (item.type === 'url') {
setSearchType('url');
setInputValue(item.value);
} else {
setSearchType('name');
setInputValue(item.value);
setSelectedItem({
title: item.value,
address: item.address || '',
roadAddress: item.roadAddress || '',
});
}
};
// 테스트 데이터 로드 핸들러 // 테스트 데이터 로드 핸들러
const handleTestData = async () => { const handleTestData = async () => {
@@ -96,6 +114,11 @@ const UrlInputContent: React.FC<UrlInputContentProps> = ({ onAnalyze, onAutocomp
// 키보드 네비게이션 핸들러 // 키보드 네비게이션 핸들러
const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => { const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {
if (e.key === 'Enter') {
e.preventDefault();
return;
}
if (!showAutocomplete || autocompleteResults.length === 0) return; if (!showAutocomplete || autocompleteResults.length === 0) return;
switch (e.key) { switch (e.key) {
@@ -111,12 +134,6 @@ const UrlInputContent: React.FC<UrlInputContentProps> = ({ onAnalyze, onAutocomp
prev > 0 ? prev - 1 : autocompleteResults.length - 1 prev > 0 ? prev - 1 : autocompleteResults.length - 1
); );
break; break;
case 'Enter':
if (highlightedIndex >= 0 && highlightedIndex < autocompleteResults.length) {
e.preventDefault();
handleSelectAutocomplete(autocompleteResults[highlightedIndex]);
}
break;
case 'Escape': case 'Escape':
setShowAutocomplete(false); setShowAutocomplete(false);
setHighlightedIndex(-1); setHighlightedIndex(-1);
@@ -138,16 +155,21 @@ const UrlInputContent: React.FC<UrlInputContentProps> = ({ onAnalyze, onAutocomp
// 폼 제출 처리 // 폼 제출 처리
const handleSubmit = (e: React.FormEvent) => { const handleSubmit = (e: React.FormEvent) => {
e.preventDefault(); e.preventDefault();
};
const handleAnalyzeClick = () => {
if (!inputValue.trim()) return; if (!inputValue.trim()) return;
if (searchType === 'name' && selectedItem && onAutocomplete) { if (searchType === 'name') {
// 업체명 검색인 경우 autocomplete API 호출 if (selectedItem && onAutocomplete) {
const request: AutocompleteRequest = { const request: AutocompleteRequest = {
address: selectedItem.address, address: selectedItem.address,
roadAddress: selectedItem.roadAddress, roadAddress: selectedItem.roadAddress,
title: selectedItem.title, title: selectedItem.title,
}; };
onAutocomplete(request); onAutocomplete(request);
}
// selectedItem 없으면 아무것도 하지 않음 (드롭다운에서 선택 필요)
} else { } else {
// URL 검색인 경우 기존 로직 // URL 검색인 경우 기존 로직
onAnalyze(inputValue.trim(), searchType); onAnalyze(inputValue.trim(), searchType);
@@ -221,6 +243,7 @@ const UrlInputContent: React.FC<UrlInputContentProps> = ({ onAnalyze, onAutocomp
} }
setInputValue(value); setInputValue(value);
hideOnInput(value);
// 업체명 검색일 때 자동완성 검색 (디바운스) // 업체명 검색일 때 자동완성 검색 (디바운스)
if (searchType === 'name') { if (searchType === 'name') {
@@ -237,11 +260,22 @@ const UrlInputContent: React.FC<UrlInputContentProps> = ({ onAnalyze, onAutocomp
if (searchType === 'name' && autocompleteResults.length > 0) { if (searchType === 'name' && autocompleteResults.length > 0) {
setShowAutocomplete(true); setShowAutocomplete(true);
} }
openHistory(inputValue);
}} }}
onBlur={() => setTimeout(() => closeHistory(), 150)}
placeholder={getPlaceholder()} placeholder={getPlaceholder()}
className="url-input-field" className="url-input-field"
/> />
{/* 최근 검색 히스토리 */}
{showHistory && !showAutocomplete && (
<SearchHistoryDropdown
items={filteredHistory}
onSelect={handleSelectHistory}
onDelete={(e, value) => { e.preventDefault(); e.stopPropagation(); deleteItem(value); }}
/>
)}
{/* 자동완성 결과 */} {/* 자동완성 결과 */}
{showAutocomplete && searchType === 'name' && ( {showAutocomplete && searchType === 'name' && (
<div className="url-input-autocomplete-dropdown"> <div className="url-input-autocomplete-dropdown">
@@ -279,7 +313,7 @@ const UrlInputContent: React.FC<UrlInputContentProps> = ({ onAnalyze, onAutocomp
)} )}
{/* 검색 버튼 */} {/* 검색 버튼 */}
<button type="submit" className="url-input-button"> <button type="button" onClick={handleAnalyzeClick} className="url-input-button">
{t('landing.hero.analyzeButton')} {t('landing.hero.analyzeButton')}
</button> </button>
</form> </form>
+3 -3
View File
@@ -11,9 +11,9 @@ const DisplaySection: React.FC<DisplaySectionProps> = ({ onStartClick }) => {
const { t } = useTranslation(); const { t } = useTranslation();
// YouTube Shorts 영상 ID들 // YouTube Shorts 영상 ID들
const videos = [ const videos = [
{ id: 1, videoId: 'OZJ8X4P82OA' }, { id: 1, videoId: 'trnN0SQBTiI' },
{ id: 2, videoId: 'hNzMO21O40c' }, { id: 2, videoId: '96HO497HsQI' },
{ id: 3, videoId: 'dM8_d6Aud68' }, { id: 3, videoId: 'XziImxVICIk' },
]; ];
return ( return (
+32 -8
View File
@@ -6,6 +6,8 @@ import { CrawlingResponse } from '../../types/api';
import { useTutorial } from '../../components/Tutorial/useTutorial'; import { useTutorial } from '../../components/Tutorial/useTutorial';
import { TUTORIAL_KEYS } from '../../components/Tutorial/tutorialSteps'; import { TUTORIAL_KEYS } from '../../components/Tutorial/tutorialSteps';
import TutorialOverlay from '../../components/Tutorial/TutorialOverlay'; import TutorialOverlay from '../../components/Tutorial/TutorialOverlay';
import { useSearchHistory } from '../../components/SearchHistory/useSearchHistory';
import SearchHistoryDropdown from '../../components/SearchHistory/SearchHistoryDropdown';
type SearchType = 'url' | 'name'; type SearchType = 'url' | 'name';
@@ -84,6 +86,7 @@ const HeroSection: React.FC<HeroSectionProps> = ({ onAnalyze, onAutocomplete, on
setIsLoadingTest(false); setIsLoadingTest(false);
} }
}; };
const { filteredHistory, showHistory, openHistory, closeHistory, hideOnInput, deleteItem } = useSearchHistory(searchType);
const [isFocused, setIsFocused] = useState(false); const [isFocused, setIsFocused] = useState(false);
const [autocompleteResults, setAutocompleteResults] = useState<AccommodationSearchItem[]>([]); const [autocompleteResults, setAutocompleteResults] = useState<AccommodationSearchItem[]>([]);
const [isAutocompleteLoading, setIsAutocompleteLoading] = useState(false); const [isAutocompleteLoading, setIsAutocompleteLoading] = useState(false);
@@ -155,10 +158,6 @@ const HeroSection: React.FC<HeroSectionProps> = ({ onAnalyze, onAutocomplete, on
setShowAutocomplete(false); setShowAutocomplete(false);
setAutocompleteResults([]); setAutocompleteResults([]);
setHighlightedIndex(-1); setHighlightedIndex(-1);
// LANDING_NAME 튜토리얼 진행 중이면 다음 힌트로 이동
if (tutorial.isActive && tutorial.tutorialKey === TUTORIAL_KEYS.LANDING_NAME) {
tutorial.nextHint();
}
}; };
// 키보드 네비게이션 핸들러 // 키보드 네비게이션 핸들러
@@ -192,8 +191,8 @@ const HeroSection: React.FC<HeroSectionProps> = ({ onAnalyze, onAutocomplete, on
} }
} }
// 업체명 검색 모드에서 Enter 키 입력 시 기본 동작 방지 (폼 제출 방지) // Enter 키 입력 시 기본 동작 방지 (폼 제출 방지)
if (e.key === 'Enter' && searchType === 'name') { if (e.key === 'Enter') {
e.preventDefault(); e.preventDefault();
} }
}; };
@@ -405,7 +404,8 @@ const HeroSection: React.FC<HeroSectionProps> = ({ onAnalyze, onAutocomplete, on
} }
setInputValue(value); setInputValue(value);
setHighlightedIndex(-1); // 입력 시 하이라이트 초기화 setHighlightedIndex(-1);
hideOnInput(value);
if (localError) setLocalError(''); if (localError) setLocalError('');
// 업체명 검색일 때 자동완성 검색 (디바운스) // 업체명 검색일 때 자동완성 검색 (디바운스)
@@ -433,13 +433,37 @@ const HeroSection: React.FC<HeroSectionProps> = ({ onAnalyze, onAutocomplete, on
if (searchType === 'name' && autocompleteResults.length > 0) { if (searchType === 'name' && autocompleteResults.length > 0) {
setShowAutocomplete(true); setShowAutocomplete(true);
} }
openHistory(inputValue);
}} }}
onBlur={() => setIsFocused(false)} onBlur={() => { setIsFocused(false); setTimeout(() => closeHistory(), 150); }}
onKeyDown={handleKeyDown} onKeyDown={handleKeyDown}
placeholder={getPlaceholder()} placeholder={getPlaceholder()}
className={`hero-input ${inputValue ? 'has-value' : ''}`} className={`hero-input ${inputValue ? 'has-value' : ''}`}
/> />
{/* 최근 검색 히스토리 */}
{showHistory && !showAutocomplete && (
<SearchHistoryDropdown
items={filteredHistory}
onSelect={(item) => {
closeHistory();
if (item.type === 'url') {
setSearchType('url');
setInputValue(item.value);
} else {
setSearchType('name');
setInputValue(item.value);
setSelectedItem({ title: item.value, address: item.address || '', roadAddress: item.roadAddress || '' });
}
}}
onDelete={(e, value) => { e.preventDefault(); e.stopPropagation(); deleteItem(value); }}
className="hero-autocomplete-dropdown"
itemClassName="hero-autocomplete-item"
titleClassName="hero-autocomplete-title"
addressClassName="hero-autocomplete-address"
/>
)}
{/* 자동완성 결과 */} {/* 자동완성 결과 */}
{showAutocomplete && searchType === 'name' && ( {showAutocomplete && searchType === 'name' && (
<div className="hero-autocomplete-dropdown"> <div className="hero-autocomplete-dropdown">
+10 -2
View File
@@ -68,6 +68,7 @@ export interface LyricGenerateRequest {
region: string; region: string;
task_id: string; task_id: string;
orientation?: 'vertical' | 'horizontal'; orientation?: 'vertical' | 'horizontal';
instrumental?: boolean;
} }
// 가사 생성 응답 // 가사 생성 응답
@@ -103,8 +104,9 @@ export interface LyricDetailResponse {
// 노래 생성 요청 // 노래 생성 요청
export interface SongGenerateRequest { export interface SongGenerateRequest {
genre: string; genre: string;
language: string; language?: string;
lyrics: string; lyrics?: string;
instrumental?: boolean;
} }
// 노래 생성 응답 // 노래 생성 응답
@@ -254,6 +256,10 @@ export interface UserMeResponse {
created_at: string; created_at: string;
} }
export interface UserCreditsResponse {
credits: number;
}
// 비디오 목록 아이템 // 비디오 목록 아이템
export interface VideoListItem { export interface VideoListItem {
video_id: number; video_id: number;
@@ -375,6 +381,8 @@ export interface UploadHistoryItem {
status: 'pending' | 'uploading' | 'completed' | 'failed' | 'scheduled' | 'cancelled'; status: 'pending' | 'uploading' | 'completed' | 'failed' | 'scheduled' | 'cancelled';
title: string; title: string;
channel_name: string; channel_name: string;
platform_user_id: string | null;
platform_username: string | null;
scheduled_at: string | null; scheduled_at: string | null;
uploaded_at: string | null; uploaded_at: string | null;
created_at: string; created_at: string;
+39 -5
View File
@@ -28,6 +28,7 @@ import {
TokenExpiredErrorResponse, TokenExpiredErrorResponse,
YTAutoSeoRequest, YTAutoSeoRequest,
YTAutoSeoResponse, YTAutoSeoResponse,
UserCreditsResponse,
} from '../types/api'; } from '../types/api';
export const API_URL = import.meta.env.VITE_API_URL || 'http://40.82.133.44'; export const API_URL = import.meta.env.VITE_API_URL || 'http://40.82.133.44';
@@ -161,6 +162,8 @@ export async function generateSong(taskId: string, request: SongGenerateRequest)
}); });
if (!response.ok) { if (!response.ok) {
const errorBody = await response.json().catch(() => null);
console.error('[generateSong] 422 detail:', JSON.stringify(errorBody));
throw new Error(`HTTP error! status: ${response.status}`); throw new Error(`HTTP error! status: ${response.status}`);
} }
@@ -476,14 +479,20 @@ export async function authenticatedFetch(
let response = await fetch(url, { ...options, headers }); let response = await fetch(url, { ...options, headers });
// 401 에러 시 토큰 갱신 시도 // 401 에러 시 에러 코드에 따라 처리
if (response.status === 401) { if (response.status === 401) {
const errorBody = await response.json().catch(() => null);
const errorCode = errorBody?.detail?.code;
if (errorCode !== 'TOKEN_EXPIRED') {
// INVALID_TOKEN 등 갱신으로 해결 불가한 경우 즉시 로그인 이동
redirectToLogin();
throw new Error(errorCode ?? 'Unauthorized');
}
try { try {
// 이미 갱신 중이면 기존 Promise 재사용 (중복 요청 방지)
// refreshPromise가 존재하면 재사용, 없으면 새로 생성
if (!refreshPromise) { if (!refreshPromise) {
refreshPromise = refreshAccessToken().finally(() => { refreshPromise = refreshAccessToken().finally(() => {
// 성공/실패 상관없이 Promise 초기화 (다음 갱신을 위해)
refreshPromise = null; refreshPromise = null;
}); });
} }
@@ -500,7 +509,6 @@ export async function authenticatedFetch(
response = await fetch(url, { ...options, headers: newHeaders }); response = await fetch(url, { ...options, headers: newHeaders });
} catch (refreshError) { } catch (refreshError) {
console.error('Token refresh failed:', refreshError); console.error('Token refresh failed:', refreshError);
// 토큰 갱신 실패 시 로그인 페이지로 리다이렉트
redirectToLogin(); redirectToLogin();
throw refreshError; throw refreshError;
} }
@@ -651,6 +659,32 @@ export async function getUserMe(): Promise<UserMeResponse> {
return response.json(); return response.json();
} }
// 사용자 크레딧 조회
export async function getUserCredits(): Promise<UserCreditsResponse> {
const response = await authenticatedFetch(`${API_URL}/user/auth/me/credits`, {
method: 'GET',
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
return response.json();
}
// 크레딧 충전 요청
export async function requestCreditCharge(amount: number, note: string): Promise<void> {
const response = await authenticatedFetch(`${API_URL}/user/credits/charge-requests`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ requested_amount: amount, message: note }),
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
}
// 로그인 여부 확인 // 로그인 여부 확인
export function isLoggedIn(): boolean { export function isLoggedIn(): boolean {
return !!getAccessToken(); return !!getAccessToken();