Compare commits
15
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3660290f1b | ||
|
|
8d7d0a74a6 | ||
|
|
b18dd7aa4d | ||
|
|
7f1e2b83a9 | ||
|
|
1d855fd14c | ||
|
|
0ea14da748 | ||
|
|
f3195628d2 | ||
|
|
9910d0146c | ||
|
|
9697c40ed2 | ||
|
|
bf5fc05a25 | ||
|
|
d3502fd421 | ||
|
|
f8ae482a16 | ||
|
|
8a60d69467 | ||
|
|
0a055a605c | ||
|
|
a155a98767 |
No files matched your search
@@ -5,6 +5,14 @@
|
|||||||
<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>ADO2</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>
|
||||||
@@ -28,6 +36,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
<script src="https://t1.kakaocdn.net/kakao_js_sdk/2.7.4/kakao.min.js" crossorigin="anonymous"></script>
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;700&family=Playfair+Display:ital,wght@0,700;1,700&display=swap" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;700&family=Playfair+Display:ital,wght@0,700;1,700&display=swap" rel="stylesheet">
|
||||||
|
|||||||
@@ -0,0 +1,60 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 660.69 145.69">
|
||||||
|
<!-- Generator: Adobe Illustrator 30.5.1, SVG Export Plug-In . SVG Version: 2.1.4 Build 3) -->
|
||||||
|
<defs>
|
||||||
|
<style>
|
||||||
|
.st0 {
|
||||||
|
fill: #fff;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</defs>
|
||||||
|
<g>
|
||||||
|
<g>
|
||||||
|
<path class="st0" d="M53.46,93.51l11.28-12.51h64.08l-31.22-63.81L32.69,93.51H15.09L90.17,5.91c2.48-2.89,6.19-5.64,10.73-5.64s7.29,2.48,8.8,5.64l43.45,87.6H53.46Z"/>
|
||||||
|
<path class="st0" d="M162.65,93.51l10.04-57.34h14.99l-7.84,44.83h42.22c23.38,0,43.18-16.78,43.18-38.5,0-16.64-12.51-28.33-31.35-28.33h-57.21l11.83-12.65h47.58c26.68,0,44.14,15.68,44.14,38.5,0,29.84-27.5,53.49-60.37,53.49h-57.21Z"/>
|
||||||
|
<path class="st0" d="M343.75,95.02c-36.17,0-54.45-12.1-54.45-38.37,0-38.09,23.24-56.65,71.23-56.65,36.17,0,54.46,11.96,54.46,38.23,0,38.09-23.1,56.79-71.23,56.79ZM358.33,12.51c-39.6,0-53.9,12.24-53.9,42.63,0,19.94,13.2,27.36,41.53,27.36,39.47,0,53.91-12.38,53.91-42.77,0-19.94-13.2-27.23-41.53-27.23Z"/>
|
||||||
|
<path class="st0" d="M417.47,93.51l4.81-27.23c2.89-16.5,15.68-24.48,36.58-24.48h40.15c16.91,0,23.79-5.78,23.79-15.68,0-9.08-9.08-11.96-26.4-11.96h-59.54l11.96-12.65h55.97c23.51,0,32.73,8.66,32.73,21.59,0,16.91-11,29.7-39.05,29.7h-40.15c-12.65,0-19.8,3.99-21.59,13.34l-2.47,14.85h94.75l-11.83,12.51h-99.7Z"/>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
<path class="st0" d="M542.35,92.89c-2.38,0-4.15-1.38-4.15-3.61,0-3.07,2.69-4.84,5.68-4.84,2.46,0,4.3,1.31,4.3,3.53,0,3.07-2.69,4.92-5.84,4.92Z"/>
|
||||||
|
<path class="st0" d="M577.37,92.2l6.3-6.99h35.79l-17.43-35.63-36.25,42.62h-9.83l41.93-48.92c1.38-1.61,3.46-3.15,5.99-3.15s4.07,1.38,4.92,3.15l24.27,48.92h-55.68Z"/>
|
||||||
|
<path class="st0" d="M643.26,92.2l9.14-51.38h8.29l-9.14,51.38h-8.29Z"/>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
<path class="st0" d="M.43,125.73c1.34-5.83,5.61-10.49,11.96-10.49,5.4,0,8.98,3.3,9.1,8.33,0,.17-.08.25-.23.25h-2.56c-.15,0-.23-.08-.23-.23-.17-3.74-2.48-5.9-6.18-5.9-4.69,0-7.56,3.67-8.65,8.31-1.31,5.71.33,11.09,6.32,11.09,3.43,0,6.17-1.81,7.52-6.23.03-.13.13-.2.27-.2h2.61c.17,0,.25.12.2.3-1.66,5.75-5.58,8.58-10.76,8.58-8.23,0-10.96-6.85-9.37-13.81Z"/>
|
||||||
|
<path class="st0" d="M25.26,129.28c1.02-4.34,4.26-7.77,9.1-7.77,5.75,0,8.31,4.74,7.04,10.19-1.02,4.34-4.24,7.77-9.08,7.77-5.76,0-8.33-4.74-7.05-10.19ZM38.31,131.48c.97-4.12-.25-7.86-4.07-7.86-3.17,0-5.13,2.61-5.9,5.88-.97,4.12.25,7.86,4.07,7.86,3.17,0,5.13-2.61,5.9-5.88Z"/>
|
||||||
|
<path class="st0" d="M44.55,138.85l1.83-7.57,2.08-9.2c.03-.15.13-.22.27-.22h2.5c.17,0,.25.1.22.27l-.7,2.76c1.24-1.86,3.43-3.43,6.01-3.43,3.38,0,5.7,2.48,4.66,7.04l-.74,3.25-1.61,7.15c-.03.15-.13.22-.27.22h-2.63c-.17,0-.25-.1-.2-.27l1.64-6.82.74-3.3c.74-3.3-.5-4.94-2.8-4.94-2.63,0-4.49,2.43-5.63,5.19l-.72,3.08-1.51,6.84c-.03.15-.13.22-.27.22h-2.66c-.15,0-.25-.1-.2-.27Z"/>
|
||||||
|
<path class="st0" d="M66.61,134.4l2.4-10.29h-1.96c-.17,0-.25-.1-.22-.29l.4-1.74c.03-.15.13-.22.27-.22h2.01l.89-4.1c.03-.15.13-.22.27-.22h2.66c.17,0,.25.1.22.27l-.99,4.05h3.97c.17,0,.25.1.22.27l-.42,1.76c-.03.13-.13.22-.27.22h-4.04l-2.35,10.22c-.45,1.98.08,2.78,1.56,2.78.59,0,1.26-.08,1.78-.2.18-.05.28.05.23.24l-.37,1.62c-.03.13-.1.2-.2.23-.75.22-1.71.38-2.58.38-2.35,0-4.37-1.26-3.48-4.99Z"/>
|
||||||
|
<path class="st0" d="M78.34,129.22c.92-4.04,3.95-7.71,8.98-7.71s7.96,3.69,6.8,9.15c-.02.13-.12.2-.25.2h-12.78c-.37,3.18.57,6.5,4.51,6.5,2.35,0,4.21-1.12,5.09-3.94.05-.13.15-.2.28-.2h2.41c.17,0,.25.12.2.29-1.17,3.99-4.07,5.96-8.01,5.96-6.68,0-8.38-5.39-7.24-10.25ZM91.3,128.82c.47-3-1.14-5.21-4.15-5.21-3.17,0-4.98,2.43-5.71,5.21h9.87Z"/>
|
||||||
|
<path class="st0" d="M97.15,138.85l1.83-7.57,2.08-9.2c.03-.15.13-.22.27-.22h2.5c.17,0,.25.1.22.27l-.7,2.76c1.24-1.86,3.43-3.43,6.01-3.43,3.38,0,5.7,2.48,4.66,7.04l-.74,3.25-1.61,7.15c-.03.15-.13.22-.27.22h-2.63c-.17,0-.25-.1-.2-.27l1.64-6.82.74-3.3c.74-3.3-.5-4.94-2.8-4.94-2.63,0-4.49,2.43-5.63,5.19l-.72,3.08-1.51,6.84c-.03.15-.13.22-.27.22h-2.66c-.15,0-.25-.1-.2-.27Z"/>
|
||||||
|
<path class="st0" d="M119.21,134.4l2.4-10.29h-1.96c-.17,0-.25-.1-.22-.29l.4-1.74c.03-.15.13-.22.27-.22h2.01l.89-4.1c.03-.15.13-.22.27-.22h2.66c.17,0,.25.1.22.27l-.99,4.05h3.97c.17,0,.25.1.22.27l-.42,1.76c-.03.13-.13.22-.27.22h-4.04l-2.35,10.22c-.45,1.98.08,2.78,1.56,2.78.59,0,1.26-.08,1.78-.2.18-.05.28.05.23.24l-.37,1.62c-.03.13-.1.2-.2.23-.75.22-1.71.38-2.58.38-2.35,0-4.37-1.26-3.48-4.99Z"/>
|
||||||
|
<path class="st0" d="M138.69,138.85l2.7-11.23,2.63-11.75c.03-.15.13-.22.27-.22h3.48c.15,0,.23.08.25.22l2.25,14.38.77,4.94,3.05-5.01,8.73-14.36c.07-.12.17-.17.3-.17h3.84c.15,0,.25.1.2.27l-2.76,11.69-2.53,11.28c-.03.15-.13.22-.27.22h-2.66c-.17,0-.25-.1-.22-.27l2.13-9.05,2.4-9.94-11.64,19.08c-.07.12-.17.17-.29.17h-2.11c-.15,0-.23-.08-.27-.22l-3.03-19.33-2.23,10.24-2.08,9.1c-.03.15-.13.22-.27.22h-2.41c-.17,0-.25-.1-.22-.27Z"/>
|
||||||
|
<path class="st0" d="M168.95,129.55c1.01-4.36,3.89-7.96,8.36-7.96,2.85,0,4.49,1.47,5.21,3.55l.67-3.07c.03-.15.13-.22.27-.22h2.6c.17,0,.25.1.22.27l-1.96,8.23-1.91,8.54c-.03.15-.13.22-.27.22h-2.51c-.15,0-.25-.1-.2-.27l.54-2.13c-1.36,1.59-3.15,2.65-5.34,2.65-4.99,0-6.87-4.66-5.66-9.82ZM181.38,130.98c.85-3.72.13-7.27-3.57-7.27-3.2,0-5.04,2.71-5.81,5.95-.92,4,.03,7.61,3.52,7.61,3,0,5.04-2.78,5.86-6.28Z"/>
|
||||||
|
<path class="st0" d="M187.85,138.85l2.04-8.54,1.83-8.23c.03-.15.13-.22.27-.22h2.56c.15,0,.25.1.2.27l-.79,3.07c1.74-2.29,4.07-3.5,6.42-3.5.37,0,.72.03,1.02.12.15.03.2.13.17.28l-.44,1.88c-.03.15-.13.2-.28.18-.27-.07-.59-.08-.9-.08-2.76,0-5.55,1.93-6.89,5.38l-2.14,9.45c-.03.15-.13.22-.27.22h-2.58c-.17,0-.27-.1-.22-.27Z"/>
|
||||||
|
<path class="st0" d="M202.32,138.87l2.71-11.38,2.58-11.61c.03-.15.13-.22.27-.22h2.58c.17,0,.27.1.22.27l-3.08,12.9,7.81-6.85c.1-.07.18-.12.3-.12h3.32c.22,0,.28.15.12.3l-7.04,5.93,3.94,10.74c.05.18-.02.29-.2.29h-2.68c-.13,0-.22-.05-.27-.2l-.8-2.51-2.33-6.4-2.98,2.61-1.39,6.3c-.03.15-.13.22-.27.22h-2.58c-.17,0-.25-.1-.22-.27Z"/>
|
||||||
|
<path class="st0" d="M219.82,129.22c.92-4.04,3.95-7.71,8.98-7.71s7.96,3.69,6.8,9.15c-.02.13-.12.2-.25.2h-12.78c-.37,3.18.57,6.5,4.51,6.5,2.35,0,4.21-1.12,5.09-3.94.05-.13.15-.2.28-.2h2.41c.17,0,.25.12.2.29-1.17,3.99-4.07,5.96-8.01,5.96-6.68,0-8.38-5.39-7.24-10.25ZM232.79,128.82c.47-3-1.14-5.21-4.15-5.21-3.17,0-4.98,2.43-5.71,5.21h9.87Z"/>
|
||||||
|
<path class="st0" d="M240.64,134.4l2.4-10.29h-1.96c-.17,0-.25-.1-.22-.29l.4-1.74c.03-.15.13-.22.27-.22h2.01l.89-4.1c.03-.15.13-.22.27-.22h2.66c.17,0,.25.1.22.27l-.99,4.05h3.97c.17,0,.25.1.22.27l-.42,1.76c-.03.13-.13.22-.27.22h-4.04l-2.35,10.22c-.45,1.98.08,2.78,1.56,2.78.59,0,1.26-.08,1.78-.2.18-.05.28.05.23.24l-.37,1.62c-.03.13-.1.2-.2.23-.75.22-1.71.38-2.58.38-2.35,0-4.37-1.26-3.48-4.99Z"/>
|
||||||
|
<path class="st0" d="M251.75,138.85l2.04-8.65,1.83-8.13c.03-.15.13-.22.27-.22h2.65c.17,0,.25.1.22.27l-1.94,8.06-1.94,8.71c-.02.15-.13.22-.27.22h-2.63c-.17,0-.25-.1-.22-.27ZM256.2,119.55l.65-2.73c.03-.15.13-.22.27-.22h2.61c.17,0,.25.1.22.27l-.64,2.75c-.03.13-.13.22-.27.22h-2.63c-.17,0-.25-.12-.22-.28Z"/>
|
||||||
|
<path class="st0" d="M260.47,138.85l1.83-7.57,2.08-9.2c.03-.15.13-.22.27-.22h2.5c.17,0,.25.1.22.27l-.7,2.76c1.24-1.86,3.43-3.43,6.01-3.43,3.38,0,5.7,2.48,4.66,7.04l-.74,3.25-1.61,7.15c-.03.15-.13.22-.27.22h-2.63c-.17,0-.25-.1-.2-.27l1.64-6.82.74-3.3c.74-3.3-.5-4.94-2.8-4.94-2.63,0-4.49,2.43-5.63,5.19l-.72,3.08-1.51,6.84c-.03.15-.13.22-.27.22h-2.66c-.15,0-.25-.1-.2-.27Z"/>
|
||||||
|
<path class="st0" d="M279.79,140.28c0-.15.1-.25.25-.25h2.58c.15,0,.23.08.25.25.03,2.09,1.71,3.28,4.04,3.28,3.1,0,4.71-1.78,5.63-5.71l.28-1.26c-1.34,1.56-3.12,2.58-5.31,2.58-5.06,0-6.85-4.72-5.7-9.68.99-4.31,3.89-7.89,8.34-7.89,2.88,0,4.54,1.44,5.26,3.54l.65-3.05c.03-.15.13-.22.27-.22h2.58c.17,0,.25.1.22.27l-2.04,8.63-1.61,7.12c-1.21,5.26-4,7.81-8.73,7.81-4.04,0-6.97-2.14-6.97-5.41ZM294.28,130.83c.82-3.6.13-7.12-3.59-7.12-3.23,0-5.08,2.7-5.83,5.93-.87,3.77-.02,7.42,3.54,7.42,3.02,0,5.09-2.78,5.88-6.23Z"/>
|
||||||
|
<path class="st0" d="M307.42,138.82l13.57-22.99c.07-.12.15-.17.28-.17h3.69c.15,0,.23.07.25.23l2.85,22.95c.02.17-.08.27-.23.27h-2.56c-.15,0-.23-.08-.25-.23l-.79-6.85h-9.53l-3.95,6.92c-.07.12-.15.17-.29.17h-2.88c-.18,0-.25-.12-.15-.3ZM323.99,129.52l-1.31-11.61-6.62,11.61h7.92Z"/>
|
||||||
|
<path class="st0" d="M332.8,132.49l.74-3.25,1.61-7.15c.03-.15.13-.22.27-.22h2.63c.17,0,.25.1.2.27l-1.64,6.82-.72,3.3c-.75,3.3.49,4.94,2.78,4.94,2.63,0,4.49-2.43,5.63-5.19l.72-3.08,1.51-6.84c.03-.15.13-.22.27-.22h2.66c.17,0,.25.1.22.27l-1.84,7.57-2.08,9.2c-.02.15-.12.22-.25.22h-2.51c-.15,0-.25-.1-.2-.27l.69-2.76c-1.24,1.86-3.43,3.43-6.01,3.43-3.38,0-5.71-2.48-4.66-7.04Z"/>
|
||||||
|
<path class="st0" d="M353.75,134.4l2.4-10.29h-1.96c-.17,0-.25-.1-.22-.29l.4-1.74c.03-.15.13-.22.27-.22h2.01l.89-4.1c.03-.15.13-.22.27-.22h2.66c.17,0,.25.1.22.27l-.99,4.05h3.97c.17,0,.25.1.22.27l-.42,1.76c-.03.13-.13.22-.27.22h-4.04l-2.35,10.22c-.45,1.98.08,2.78,1.56,2.78.59,0,1.26-.08,1.78-.2.18-.05.28.05.23.24l-.37,1.62c-.03.13-.1.2-.2.23-.75.22-1.71.38-2.58.38-2.35,0-4.37-1.26-3.49-4.99Z"/>
|
||||||
|
<path class="st0" d="M365.46,129.28c1.02-4.34,4.25-7.77,9.1-7.77,5.75,0,8.31,4.74,7.04,10.19-1.02,4.34-4.24,7.77-9.08,7.77-5.76,0-8.33-4.74-7.05-10.19ZM378.51,131.48c.97-4.12-.25-7.86-4.07-7.86-3.17,0-5.13,2.61-5.9,5.88-.97,4.12.25,7.86,4.07,7.86,3.17,0,5.13-2.61,5.9-5.88Z"/>
|
||||||
|
<path class="st0" d="M384.76,138.85l1.83-7.57,2.08-9.2c.03-.15.13-.22.27-.22h2.5c.17,0,.25.1.22.27l-.7,2.76c1.19-1.84,3.22-3.43,5.71-3.43,2.18,0,3.85,1.17,4.31,3.45,1.27-1.84,3.42-3.45,5.93-3.45,3.25,0,5.55,2.45,4.51,7.04l-.75,3.25-1.61,7.15c-.02.15-.12.22-.25.22h-2.63c-.17,0-.25-.1-.22-.27l1.64-6.82.74-3.3c.79-3.47-.49-4.94-2.46-4.94-2.24,0-3.84,2.04-4.98,4.52-.02.25-.05.55-.12.84l-.6,2.6-1.61,7.15c-.03.15-.13.22-.27.22h-2.63c-.15,0-.25-.1-.2-.27l1.64-6.82.74-3.3c.77-3.47-.49-4.94-2.48-4.94-2.41,0-4.09,2.41-5.23,5.19l-.72,3.08-1.51,6.84c-.03.15-.13.22-.27.22h-2.66c-.15,0-.25-.1-.2-.27Z"/>
|
||||||
|
<path class="st0" d="M415.88,129.55c1-4.36,3.89-7.96,8.36-7.96,2.85,0,4.49,1.47,5.21,3.55l.67-3.07c.03-.15.13-.22.27-.22h2.6c.17,0,.25.1.22.27l-1.96,8.23-1.91,8.54c-.03.15-.13.22-.27.22h-2.51c-.15,0-.25-.1-.2-.27l.54-2.13c-1.36,1.59-3.15,2.65-5.34,2.65-4.99,0-6.87-4.66-5.66-9.82ZM428.31,130.98c.85-3.72.13-7.27-3.57-7.27-3.2,0-5.04,2.71-5.81,5.95-.92,4,.03,7.61,3.52,7.61,3,0,5.04-2.78,5.86-6.28Z"/>
|
||||||
|
<path class="st0" d="M437.29,134.4l2.4-10.29h-1.96c-.17,0-.25-.1-.22-.29l.4-1.74c.03-.15.13-.22.27-.22h2.01l.89-4.1c.03-.15.13-.22.27-.22h2.66c.17,0,.25.1.22.27l-.99,4.05h3.97c.17,0,.25.1.22.27l-.42,1.76c-.03.13-.13.22-.27.22h-4.04l-2.35,10.22c-.45,1.98.08,2.78,1.56,2.78.59,0,1.26-.08,1.78-.2.18-.05.28.05.23.24l-.37,1.62c-.03.13-.1.2-.2.23-.75.22-1.71.38-2.58.38-2.35,0-4.37-1.26-3.49-4.99Z"/>
|
||||||
|
<path class="st0" d="M448.39,138.85l2.04-8.65,1.83-8.13c.03-.15.13-.22.27-.22h2.65c.17,0,.25.1.22.27l-1.94,8.06-1.94,8.71c-.02.15-.13.22-.27.22h-2.63c-.17,0-.25-.1-.22-.27ZM452.85,119.55l.65-2.73c.03-.15.13-.22.27-.22h2.61c.17,0,.25.1.22.27l-.64,2.75c-.03.13-.13.22-.27.22h-2.63c-.17,0-.25-.12-.22-.28Z"/>
|
||||||
|
<path class="st0" d="M458.71,129.28c1.02-4.34,4.25-7.77,9.1-7.77,5.75,0,8.31,4.74,7.04,10.19-1.02,4.34-4.24,7.77-9.08,7.77-5.76,0-8.33-4.74-7.05-10.19ZM471.76,131.48c.97-4.12-.25-7.86-4.07-7.86-3.17,0-5.13,2.61-5.9,5.88-.97,4.12.25,7.86,4.07,7.86,3.17,0,5.13-2.61,5.9-5.88Z"/>
|
||||||
|
<path class="st0" d="M478,138.85l1.83-7.57,2.08-9.2c.03-.15.13-.22.27-.22h2.5c.17,0,.25.1.22.27l-.7,2.76c1.24-1.86,3.43-3.43,6.01-3.43,3.38,0,5.7,2.48,4.66,7.04l-.74,3.25-1.61,7.15c-.03.15-.13.22-.27.22h-2.63c-.17,0-.25-.1-.2-.27l1.64-6.82.74-3.3c.74-3.3-.5-4.94-2.8-4.94-2.63,0-4.49,2.43-5.63,5.19l-.72,3.08-1.51,6.84c-.03.15-.13.22-.27.22h-2.66c-.15,0-.25-.1-.2-.27Z"/>
|
||||||
|
<path class="st0" d="M506.33,138.85l2.81-11.76,2.5-11.21c.03-.15.13-.22.27-.22h7.04c5.68,0,8.44,3.43,7.37,8.13-.9,3.89-4.31,6.28-9.6,6.28h-5.23l-1.98,8.83c-.03.15-.13.22-.27.22h-2.7c-.17,0-.25-.1-.22-.27ZM516.95,127.74c3.6,0,5.7-1.62,6.3-4.22.7-3.08-.79-5.51-4.52-5.51h-4.41l-2.33,9.73h4.96Z"/>
|
||||||
|
<path class="st0" d="M527.7,138.85l2.78-11.61,2.53-11.36c.03-.15.13-.22.27-.22h2.56c.17,0,.25.1.22.27l-2.7,11.28-2.61,11.69c-.03.15-.13.22-.27.22h-2.56c-.17,0-.27-.1-.22-.27Z"/>
|
||||||
|
<path class="st0" d="M537.92,129.55c1-4.36,3.89-7.96,8.36-7.96,2.85,0,4.49,1.47,5.21,3.55l.67-3.07c.03-.15.13-.22.27-.22h2.6c.17,0,.25.1.22.27l-1.96,8.23-1.91,8.54c-.03.15-.13.22-.27.22h-2.51c-.15,0-.25-.1-.2-.27l.54-2.13c-1.36,1.59-3.15,2.65-5.34,2.65-4.99,0-6.87-4.66-5.66-9.82ZM550.35,130.98c.85-3.72.13-7.27-3.57-7.27-3.2,0-5.04,2.71-5.81,5.95-.92,4,.03,7.61,3.52,7.61,3,0,5.04-2.78,5.86-6.28Z"/>
|
||||||
|
<path class="st0" d="M559.32,134.4l2.4-10.29h-1.96c-.17,0-.25-.1-.22-.29l.4-1.74c.03-.15.13-.22.27-.22h2.01l.89-4.1c.03-.15.13-.22.27-.22h2.66c.17,0,.25.1.22.27l-.99,4.05h3.97c.17,0,.25.1.22.27l-.42,1.76c-.03.13-.13.22-.27.22h-4.04l-2.35,10.22c-.45,1.98.08,2.78,1.56,2.78.59,0,1.26-.08,1.78-.2.18-.05.28.05.23.24l-.37,1.62c-.03.13-.1.2-.2.23-.75.22-1.71.38-2.58.38-2.35,0-4.37-1.26-3.49-4.99Z"/>
|
||||||
|
<path class="st0" d="M572.12,138.85l1.83-7.52,1.71-7.22h-2.45c-.17,0-.25-.1-.22-.29l.42-1.74c.03-.15.13-.22.27-.22h2.5l.37-1.56c.85-3.77,3.32-5.09,5.71-5.09.8,0,1.64.12,2.23.25.15.05.22.15.18.3l-.4,1.69c-.03.17-.13.22-.3.17-.45-.12-.97-.17-1.57-.17-1.36,0-2.4.85-2.9,3.08l-.32,1.32h3.79c.17,0,.25.1.22.27l-.4,1.76c-.03.13-.13.22-.27.22h-3.85l-1.66,7.22-1.64,7.57c-.03.15-.13.22-.27.22h-2.75c-.17,0-.25-.1-.22-.27Z"/>
|
||||||
|
<path class="st0" d="M584.65,129.28c1.02-4.34,4.25-7.77,9.1-7.77,5.75,0,8.31,4.74,7.04,10.19-1.02,4.34-4.24,7.77-9.08,7.77-5.76,0-8.33-4.74-7.05-10.19ZM597.7,131.48c.97-4.12-.25-7.86-4.07-7.86-3.17,0-5.13,2.61-5.9,5.88-.97,4.12.25,7.86,4.07,7.86,3.17,0,5.13-2.61,5.9-5.88Z"/>
|
||||||
|
<path class="st0" d="M603.95,138.85l2.04-8.54,1.83-8.23c.03-.15.13-.22.27-.22h2.56c.15,0,.25.1.2.27l-.79,3.07c1.74-2.29,4.07-3.5,6.42-3.5.37,0,.72.03,1.02.12.15.03.2.13.17.28l-.44,1.88c-.03.15-.13.2-.29.18-.27-.07-.59-.08-.9-.08-2.76,0-5.55,1.93-6.89,5.38l-2.14,9.45c-.03.15-.13.22-.27.22h-2.58c-.17,0-.27-.1-.22-.27Z"/>
|
||||||
|
<path class="st0" d="M618.42,138.85l1.83-7.57,2.08-9.2c.03-.15.13-.22.27-.22h2.5c.17,0,.25.1.22.27l-.7,2.76c1.19-1.84,3.22-3.43,5.71-3.43,2.18,0,3.85,1.17,4.31,3.45,1.27-1.84,3.42-3.45,5.93-3.45,3.25,0,5.55,2.45,4.51,7.04l-.75,3.25-1.61,7.15c-.02.15-.12.22-.25.22h-2.63c-.17,0-.25-.1-.22-.27l1.64-6.82.74-3.3c.79-3.47-.49-4.94-2.46-4.94-2.25,0-3.84,2.04-4.98,4.52-.02.25-.05.55-.12.84l-.6,2.6-1.61,7.15c-.03.15-.13.22-.27.22h-2.63c-.15,0-.25-.1-.2-.27l1.64-6.82.74-3.3c.77-3.47-.49-4.94-2.48-4.94-2.41,0-4.09,2.41-5.23,5.19l-.72,3.08-1.51,6.84c-.03.15-.13.22-.27.22h-2.66c-.15,0-.25-.1-.2-.27Z"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 14 KiB |
+38
-17
@@ -17,55 +17,76 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>개인정보처리방침 (Privacy Policy)</h1>
|
<h1>개인정보처리방침 (Privacy Policy)</h1>
|
||||||
<p class="updated"><strong>시행일:</strong> 2026년 5월 7일 | <strong>최종 수정일:</strong> 2026년 5월 7일</p>
|
<p class="updated"><strong>시행일:</strong> 2026년 5월 7일 | <strong>최종 수정일:</strong> 2026년 5월 27일</p>
|
||||||
|
|
||||||
<p>㈜에이아이오투오(이하 "회사")는 AI 마케팅 자동화 서비스 ADO2(이하 "서비스")를 제공함에 있어 사용자의 개인정보를 중요시하며, 「개인정보 보호법」 등 관련 법령을 성실히 준수합니다.</p>
|
<p>㈜에이아이오투오(이하 "회사")는 AI 마케팅 자동화 서비스 ADO2(이하 "서비스")를 제공함에 있어 사용자의 개인정보를 중요시하며, 「개인정보 보호법」 등 관련 법령을 성실히 준수합니다.</p>
|
||||||
|
|
||||||
<h2>1. 수집하는 개인정보 항목 및 수집 방법</h2>
|
<h2>1. 수집하는 개인정보 항목 및 수집 방법</h2>
|
||||||
<p>회사는 서비스 제공을 위해 아래와 같은 개인정보를 수집합니다.</p>
|
<p>회사는 서비스 제공을 위해 아래와 같은 개인정보를 수집합니다.</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li><strong>Google OAuth를 통한 수집:</strong> 이름, 이메일 주소, 프로필 사진</li>
|
<li><strong>카카오 로그인을 통한 수집:</strong> 이름, 이메일 주소, 프로필 사진 — 서비스 회원 가입 및 로그인에 사용</li>
|
||||||
<li><strong>마케팅 자동화 서비스 제공용 (해당 권한 동의 시):</strong> YouTube 채널 데이터, Google 광고 계정 데이터 등 연동된 마케팅 채널 데이터</li>
|
<li><strong>Google 사용자 프로필 :</strong> YouTube 채널 연동 시 연결된 구글 계정의 이름 및 프로필 사진 확인 — 채널 소유자 식별 목적으로만 사용</li>
|
||||||
|
<li><strong>YouTube Data API :</strong> 채널 정보, 동영상 목록, 재생목록 등 YouTube 계정 데이터 (읽기 전용)</li>
|
||||||
|
<li><strong>YouTube Data API :</strong> AI가 생성한 콘텐츠를 YouTube에 업로드하기 위한 동영상 관리 권한</li>
|
||||||
|
<li><strong>YouTube Analytics API :</strong> 채널 및 동영상의 조회수, 시청 시간 등 성과 지표 데이터 (읽기 전용)</li>
|
||||||
<li><strong>서비스 이용 과정에서 자동 수집:</strong> 접속 IP, 쿠키, 서비스 이용 기록</li>
|
<li><strong>서비스 이용 과정에서 자동 수집:</strong> 접속 IP, 쿠키, 서비스 이용 기록</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<h2>2. 개인정보의 수집 및 이용 목적</h2>
|
<h2>2. Google 사용자 데이터의 수집 및 이용 목적</h2>
|
||||||
|
<p>회사가 접근하는 Google 사용자 데이터는 아래 목적으로만 사용되며, 명시된 목적 외에는 사용하지 않습니다.</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>AI 마케팅 콘텐츠 자동 생성 및 배포 서비스 제공</li>
|
<li><strong>Google 사용자 프로필:</strong> YouTube 채널 연동 과정에서 연결 대상 구글 계정을 식별하는 용도로만 사용하며, 서비스 로그인에는 사용되지 않습니다.</li>
|
||||||
<li>계정 연동 및 사용자 식별·본인 인증</li>
|
<li><strong>YouTube 계정 데이터 (읽기):</strong> 기존 채널 정보·동영상 현황을 분석하여 AI 콘텐츠 전략 수립에 활용합니다.</li>
|
||||||
<li>서비스 품질 개선 및 통계 분석</li>
|
<li><strong>YouTube 동영상 업로드:</strong> AI가 생성한 영상을 사용자의 YouTube 채널에 업로드합니다. 업로드는 반드시 사용자의 명시적 요청에 의해서만 실행됩니다.</li>
|
||||||
<li>공지사항 전달 및 고객 상담</li>
|
<li><strong>YouTube 분석 데이터:</strong> 채널 성과 지표를 분석하여 AI 마케팅 전략 수립 및 콘텐츠 최적화에 활용합니다.</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div class="google-policy">
|
<div class="google-policy">
|
||||||
<p><strong>[Google API 서비스 사용자 데이터 정책 준수]</strong><br><br>
|
<p><strong>[Google API 서비스 사용자 데이터 정책 준수]</strong><br><br>
|
||||||
㈜에이아이오투오가 운영하는 ADO2 서비스가 Google API로부터 수신한 정보의 사용 및 타 앱으로의 전송은,
|
㈜에이아이오투오가 운영하는 ADO2 서비스가 Google API로부터 수신한 정보의 사용 및 타 앱으로의 전송은,
|
||||||
<a href="https://developers.google.com/terms/api-services-user-data-policy" target="_blank">Google API 서비스 사용자 데이터 정책</a>의
|
<a href="https://developers.google.com/terms/api-services-user-data-policy" target="_blank">Google API 서비스 사용자 데이터 정책</a>의
|
||||||
제한적 사용(Limited Use) 요건을 포함한 모든 정책을 엄격히 준수합니다.</p>
|
제한적 사용(Limited Use) 요건을 포함한 모든 정책을 엄격히 준수합니다.<br><br>
|
||||||
|
특히, Google API로부터 수신한 데이터는 <strong>AI·ML 모델 학습에 사용되지 않으며</strong>, 사용자가 명시적으로 요청한 서비스 기능 제공 목적 외에는 사용·전송·공유되지 않습니다.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h2>3. 개인정보의 보유 및 이용 기간</h2>
|
<h2>3. Google 사용자 데이터의 제3자 공유</h2>
|
||||||
|
<p>회사는 Google API로부터 수신한 사용자 데이터를 아래 경우를 제외하고 어떠한 제3자에게도 판매하거나 공유하지 않습니다.</p>
|
||||||
|
<ul>
|
||||||
|
<li><strong>AI 콘텐츠 생성 처리:</strong> 서비스 제공에 필수적인 AI 생성 기능 수행을 위해 처리 서버로 전달될 수 있으며, 해당 처리는 서비스 제공 목적으로만 사용됩니다.</li>
|
||||||
|
<li><strong>법적 요구:</strong> 관련 법령에 의거한 수사기관 등의 적법한 요청이 있는 경우</li>
|
||||||
|
</ul>
|
||||||
|
<p>Google 사용자 데이터는 광고, 마케팅, 프로파일링 목적으로 사용되지 않습니다.</p>
|
||||||
|
|
||||||
|
<h2>4. Google 사용자 데이터의 저장 및 보안</h2>
|
||||||
|
<ul>
|
||||||
|
<li>Google OAuth 액세스 토큰 및 리프레시 토큰은 암호화된 상태로 보관됩니다.</li>
|
||||||
|
<li>Google API를 통해 읽어온 데이터는 서비스 기능 처리에 필요한 최소한의 시간 동안만 임시 보유하며, 처리 완료 후 삭제됩니다.</li>
|
||||||
|
<li>서버와의 모든 통신은 TLS(HTTPS)를 통해 암호화됩니다.</li>
|
||||||
|
<li>데이터 접근 권한은 서비스 운영에 필요한 최소 인원에게만 부여됩니다.</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2>5. 개인정보의 보유 및 이용 기간 / 데이터 삭제</h2>
|
||||||
<p>원칙적으로 회원 탈퇴 또는 개인정보 수집·이용 목적이 달성된 후에는 해당 정보를 지체 없이 파기합니다. 단, 관련 법령에 따라 보존이 필요한 경우 해당 기간 동안 보관합니다.</p>
|
<p>원칙적으로 회원 탈퇴 또는 개인정보 수집·이용 목적이 달성된 후에는 해당 정보를 지체 없이 파기합니다. 단, 관련 법령에 따라 보존이 필요한 경우 해당 기간 동안 보관합니다.</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>전자상거래 관련 기록: 5년 (전자상거래 등에서의 소비자보호에 관한 법률)</li>
|
<li>전자상거래 관련 기록: 5년 (전자상거래 등에서의 소비자보호에 관한 법률)</li>
|
||||||
<li>접속 로그 기록: 3개월 (통신비밀보호법)</li>
|
<li>접속 로그 기록: 3개월 (통신비밀보호법)</li>
|
||||||
|
<li>Google 연동 토큰: 연동 해제 또는 회원 탈퇴 즉시 삭제</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
<p><strong>데이터 삭제 요청 방법:</strong> 아래 이메일(<a href="mailto:o2oteam@o2o.kr">o2oteam@o2o.kr</a>)로 요청하시면 <strong>영업일 기준 7일 이내</strong>에 처리 결과를 안내해 드립니다. Google 계정 연동 해제는 서비스 내 계정 설정에서 직접 처리하실 수 있으며, 해제 즉시 관련 토큰이 삭제됩니다.</p>
|
||||||
|
|
||||||
<h2>4. 개인정보의 제3자 제공</h2>
|
<h2>6. 정보주체의 권리 및 행사 방법</h2>
|
||||||
<p>회사는 사용자의 사전 동의 없이 개인정보를 외부에 제공하지 않습니다. 다만, 법령에 의거한 수사기관 등의 적법한 요청이 있는 경우는 예외로 합니다.</p>
|
|
||||||
|
|
||||||
<h2>5. 정보주체의 권리 및 행사 방법</h2>
|
|
||||||
<p>사용자는 언제든지 자신의 개인정보에 대한 열람, 수정, 삭제, 처리 정지를 요청할 수 있습니다. 서비스 내 계정 설정에서 직접 처리하거나 아래 문의처로 연락해 주시기 바랍니다.</p>
|
<p>사용자는 언제든지 자신의 개인정보에 대한 열람, 수정, 삭제, 처리 정지를 요청할 수 있습니다. 서비스 내 계정 설정에서 직접 처리하거나 아래 문의처로 연락해 주시기 바랍니다.</p>
|
||||||
|
<p>또한, <a href="https://myaccount.google.com/permissions" target="_blank">Google 계정 권한 관리 페이지</a>에서 ADO2 앱의 Google 데이터 접근 권한을 언제든지 직접 취소하실 수 있습니다.</p>
|
||||||
|
|
||||||
<h2>6. 개인정보 보호책임자 및 문의처</h2>
|
<h2>7. 개인정보 보호책임자 및 문의처</h2>
|
||||||
<p>개인정보 보호와 관련된 불만 처리 및 피해 구제에 관한 사항은 아래로 문의해 주시기 바랍니다.</p>
|
<p>개인정보 보호와 관련된 불만 처리 및 피해 구제에 관한 사항은 아래로 문의해 주시기 바랍니다.</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li><strong>회사명:</strong> ㈜에이아이오투오</li>
|
<li><strong>회사명:</strong> ㈜에이아이오투오</li>
|
||||||
<li><strong>서비스명:</strong> ADO2</li>
|
<li><strong>서비스명:</strong> ADO2</li>
|
||||||
<li><strong>이메일:</strong> o2oteam@o2o.kr</li>
|
<li><strong>이메일:</strong> <a href="mailto:o2oteam@o2o.kr">o2oteam@o2o.kr</a></li>
|
||||||
<li><strong>웹사이트:</strong> https://demo.castad.net</li>
|
<li><strong>웹사이트:</strong> https://demo.castad.net</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<p style="margin-top:40px; font-size:14px; color:#999;">본 방침은 2026년 5월 7일부터 시행됩니다.</p>
|
<p style="margin-top:40px; font-size:14px; color:#999;">본 방침은 2026년 5월 7일부터 시행됩니다. 최종 수정일: 2026년 5월 27일</p>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
+3
-2
@@ -15,7 +15,7 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>서비스 이용약관 (Terms of Service)</h1>
|
<h1>서비스 이용약관 (Terms of Service)</h1>
|
||||||
<p class="updated"><strong>시행일:</strong> 2026년 5월 7일 | <strong>최종 수정일:</strong> 2026년 5월 7일</p>
|
<p class="updated"><strong>시행일:</strong> 2026년 5월 7일 | <strong>최종 수정일:</strong> 2026년 5월 21일</p>
|
||||||
|
|
||||||
<h2>제 1 조 (목적)</h2>
|
<h2>제 1 조 (목적)</h2>
|
||||||
<p>본 약관은 ㈜에이아이오투오(이하 "회사")가 제공하는 AI 마케팅 자동화 서비스 ADO2(이하 "서비스")의 이용과 관련하여, 회사와 이용자(이하 "회원") 간의 권리, 의무 및 책임사항을 규정함을 목적으로 합니다.</p>
|
<p>본 약관은 ㈜에이아이오투오(이하 "회사")가 제공하는 AI 마케팅 자동화 서비스 ADO2(이하 "서비스")의 이용과 관련하여, 회사와 이용자(이하 "회원") 간의 권리, 의무 및 책임사항을 규정함을 목적으로 합니다.</p>
|
||||||
@@ -41,7 +41,8 @@
|
|||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<h2>제 6 조 (외부 API 연동 및 데이터 활용)</h2>
|
<h2>제 6 조 (외부 API 연동 및 데이터 활용)</h2>
|
||||||
<p>서비스는 Google, YouTube, Naver 등의 제3자 API를 활용하여 마케팅 자동화 기능을 제공합니다. 회원은 각 외부 서비스의 이용약관 및 정책을 준수할 의무가 있으며, 외부 API 제공사의 정책 변경으로 인한 서비스 제한에 대해 회사는 면책됩니다.</p>
|
<p>서비스는 Google, YouTube, Naver 등의 제3자 API를 활용하여 마케팅 자동화 기능을 제공합니다. 특히 YouTube 서비스 연동을 위해 YouTube Data API 및 YouTube Analytics API를 사용하며, 이를 통해 수집·처리되는 데이터는 <a href="/privacy.html">개인정보처리방침</a>에 따라 관리됩니다. 회원은 각 외부 서비스의 이용약관 및 정책을 준수할 의무가 있으며, 외부 API 제공사의 정책 변경으로 인한 서비스 제한에 대해 회사는 면책됩니다.</p>
|
||||||
|
<p>YouTube API 서비스 이용과 관련하여 <a href="https://www.youtube.com/t/terms" target="_blank">YouTube 이용약관</a> 및 <a href="https://policies.google.com/privacy" target="_blank">Google 개인정보처리방침</a>이 함께 적용됩니다.</p>
|
||||||
|
|
||||||
<h2>제 7 조 (AI 생성 콘텐츠의 권리)</h2>
|
<h2>제 7 조 (AI 생성 콘텐츠의 권리)</h2>
|
||||||
<p>서비스 내에서 AI가 생성한 콘텐츠에 대한 권리 관계는 관련 법령 및 회사의 별도 정책에 따릅니다. 회원이 직접 입력한 정보(매장 URL, 상호명 등)를 기반으로 생성된 콘텐츠에 대한 책임은 회원에게 있습니다.</p>
|
<p>서비스 내에서 AI가 생성한 콘텐츠에 대한 권리 관계는 관련 법령 및 회사의 별도 정책에 따릅니다. 회원이 직접 입력한 정보(매장 URL, 상호명 등)를 기반으로 생성된 콘텐츠에 대한 책임은 회원에게 있습니다.</p>
|
||||||
|
|||||||
+65
-7
@@ -12,7 +12,9 @@ import GenerationFlow from './pages/Dashboard/GenerationFlow';
|
|||||||
import SocialConnectSuccess from './pages/Social/SocialConnectSuccess';
|
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 ADO2ContentsPage from './pages/Dashboard/ADO2ContentsPage';
|
||||||
|
import VideoDetailPage from './components/VideoDetailPage';
|
||||||
|
import { crawlUrl, autocomplete, marketingAnalysis, kakaoCallback, isLoggedIn, saveTokens, getVideosList, AutocompleteRequest } from './utils/api';
|
||||||
import { saveSearchHistory } from './components/SearchHistory/useSearchHistory';
|
import { saveSearchHistory } from './components/SearchHistory/useSearchHistory';
|
||||||
import { CrawlingResponse } from './types/api';
|
import { CrawlingResponse } from './types/api';
|
||||||
|
|
||||||
@@ -98,8 +100,26 @@ const App: React.FC = () => {
|
|||||||
);
|
);
|
||||||
const [error, setError] = useState<string | null>(null);
|
const [error, setError] = useState<string | null>(null);
|
||||||
const [isAnalysisComplete, setIsAnalysisComplete] = useState(false);
|
const [isAnalysisComplete, setIsAnalysisComplete] = useState(false);
|
||||||
|
const [afterLoadTarget, setAfterLoadTarget] = useState<ViewMode>('analysis');
|
||||||
const [scrollProgress, setScrollProgress] = useState(0);
|
const [scrollProgress, setScrollProgress] = useState(0);
|
||||||
const [isProcessingCallback, setIsProcessingCallback] = useState(false);
|
const [isProcessingCallback, setIsProcessingCallback] = useState(false);
|
||||||
|
const tutorialVideoCheckedRef = useRef(false);
|
||||||
|
|
||||||
|
// generation_flow 진입 시 영상 보유 여부 확인 → 있으면 튜토리얼 자동 off
|
||||||
|
useEffect(() => {
|
||||||
|
if (viewMode !== 'generation_flow') return;
|
||||||
|
if (tutorialVideoCheckedRef.current) return;
|
||||||
|
tutorialVideoCheckedRef.current = true;
|
||||||
|
const ENABLED_KEY = 'ado2_tutorial_enabled';
|
||||||
|
if (localStorage.getItem(ENABLED_KEY) !== null) return;
|
||||||
|
getVideosList(1, 1).then(response => {
|
||||||
|
const hasVideos = response.items.some(v => v.result_movie_url?.trim());
|
||||||
|
if (hasVideos) {
|
||||||
|
localStorage.setItem(ENABLED_KEY, 'false');
|
||||||
|
window.dispatchEvent(new Event('ado2-tutorial-auto-disable'));
|
||||||
|
}
|
||||||
|
}).catch(() => {});
|
||||||
|
}, [viewMode]);
|
||||||
|
|
||||||
// 카카오 로그인 콜백 처리 (URL에서 토큰 또는 code 파라미터 확인)
|
// 카카오 로그인 콜백 처리 (URL에서 토큰 또는 code 파라미터 확인)
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -144,6 +164,12 @@ const App: React.FC = () => {
|
|||||||
localStorage.removeItem('castad_wizard_step');
|
localStorage.removeItem('castad_wizard_step');
|
||||||
localStorage.removeItem('castad_active_item');
|
localStorage.removeItem('castad_active_item');
|
||||||
}
|
}
|
||||||
|
const redirectPath = sessionStorage.getItem('castad_login_redirect');
|
||||||
|
sessionStorage.removeItem('castad_login_redirect');
|
||||||
|
if (redirectPath && redirectPath !== '/') {
|
||||||
|
window.location.href = redirectPath;
|
||||||
|
return;
|
||||||
|
}
|
||||||
setInitialTab('새 프로젝트 만들기');
|
setInitialTab('새 프로젝트 만들기');
|
||||||
setViewMode('generation_flow');
|
setViewMode('generation_flow');
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -257,6 +283,7 @@ const App: React.FC = () => {
|
|||||||
const handleStartAnalysis = async (url: string) => {
|
const handleStartAnalysis = async (url: string) => {
|
||||||
if (!url.trim()) return;
|
if (!url.trim()) return;
|
||||||
|
|
||||||
|
setAfterLoadTarget('analysis');
|
||||||
setViewMode('loading');
|
setViewMode('loading');
|
||||||
setIsAnalysisComplete(false);
|
setIsAnalysisComplete(false);
|
||||||
setError(null);
|
setError(null);
|
||||||
@@ -275,14 +302,14 @@ const App: React.FC = () => {
|
|||||||
setIsAnalysisComplete(true);
|
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');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 업체명 자동완성으로 분석 시작
|
// 업체명 자동완성으로 분석 시작
|
||||||
const handleAutocomplete = async (request: AutocompleteRequest) => {
|
const handleAutocomplete = async (request: AutocompleteRequest) => {
|
||||||
|
setAfterLoadTarget('analysis');
|
||||||
setViewMode('loading');
|
setViewMode('loading');
|
||||||
setIsAnalysisComplete(false);
|
setIsAnalysisComplete(false);
|
||||||
setError(null);
|
setError(null);
|
||||||
@@ -301,9 +328,32 @@ const App: React.FC = () => {
|
|||||||
setIsAnalysisComplete(true);
|
setIsAnalysisComplete(true);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Autocomplete failed:', err);
|
console.error('Autocomplete failed:', err);
|
||||||
const is404 = err instanceof Error && err.message.includes('status: 404');
|
setError(t('app.autocompleteError'));
|
||||||
const errorMessage = is404 ? t('app.autocompleteError') : (err instanceof Error ? err.message : t('app.autocompleteGeneralError'));
|
setViewMode('landing');
|
||||||
setError(errorMessage);
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 업체명·주소 수동 입력으로 마케팅 분석 API 호출
|
||||||
|
const handleManualInput = async (businessName: string, address: string) => {
|
||||||
|
setAfterLoadTarget('generation_flow');
|
||||||
|
setViewMode('loading');
|
||||||
|
setIsAnalysisComplete(false);
|
||||||
|
setError(null);
|
||||||
|
|
||||||
|
try {
|
||||||
|
const data = await marketingAnalysis(businessName, address);
|
||||||
|
|
||||||
|
if (!validateCrawlingResponse(data)) {
|
||||||
|
throw new Error(t('app.autocompleteError'));
|
||||||
|
}
|
||||||
|
|
||||||
|
setAnalysisData(data);
|
||||||
|
localStorage.setItem(ANALYSIS_DATA_KEY, JSON.stringify(data));
|
||||||
|
saveSearchHistory({ type: 'name', value: businessName, address, roadAddress: address });
|
||||||
|
setIsAnalysisComplete(true);
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Marketing analysis failed:', err);
|
||||||
|
setError(t('app.autocompleteError'));
|
||||||
setViewMode('landing');
|
setViewMode('landing');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -390,6 +440,13 @@ const App: React.FC = () => {
|
|||||||
return <SocialConnectError />;
|
return <SocialConnectError />;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 영상 상세 페이지 (/video/{id}) — 인증 게이트는 VideoDetailPage 내부에서 처리
|
||||||
|
const videoDetailMatch = pathname.match(/^\/video\/([^/]+)$/);
|
||||||
|
if (videoDetailMatch) {
|
||||||
|
return <VideoDetailPage videoId={videoDetailMatch[1]} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 카카오 콜백 처리 중 로딩 화면 표시
|
// 카카오 콜백 처리 중 로딩 화면 표시
|
||||||
if (isProcessingCallback) {
|
if (isProcessingCallback) {
|
||||||
return (
|
return (
|
||||||
@@ -405,7 +462,7 @@ const App: React.FC = () => {
|
|||||||
return (
|
return (
|
||||||
<LoadingSection
|
<LoadingSection
|
||||||
isComplete={isAnalysisComplete}
|
isComplete={isAnalysisComplete}
|
||||||
onComplete={() => setViewMode('analysis')}
|
onComplete={() => setViewMode(afterLoadTarget)}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -449,6 +506,7 @@ const App: React.FC = () => {
|
|||||||
<HeroSection
|
<HeroSection
|
||||||
onAnalyze={handleStartAnalysis}
|
onAnalyze={handleStartAnalysis}
|
||||||
onAutocomplete={handleAutocomplete}
|
onAutocomplete={handleAutocomplete}
|
||||||
|
onManualInput={handleManualInput}
|
||||||
onTestData={handleTestData}
|
onTestData={handleTestData}
|
||||||
onNext={() => scrollToSection(1)}
|
onNext={() => scrollToSection(1)}
|
||||||
error={error}
|
error={error}
|
||||||
|
|||||||
@@ -0,0 +1,135 @@
|
|||||||
|
import React, { useState, useEffect } from 'react';
|
||||||
|
import { createPortal } from 'react-dom';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import CitySelectModal, { REGIONS } from './CitySelectModal';
|
||||||
|
|
||||||
|
interface BusinessNameInputModalProps {
|
||||||
|
onClose: () => void;
|
||||||
|
onSubmit: (businessName: string, address: string) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
const BusinessNameInputModal: React.FC<BusinessNameInputModalProps> = ({ onClose, onSubmit }) => {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const [businessName, setBusinessName] = useState('');
|
||||||
|
const [selectedCity, setSelectedCity] = useState('');
|
||||||
|
const [detailAddress, setDetailAddress] = useState('');
|
||||||
|
const [isCityModalOpen, setIsCityModalOpen] = useState(false);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
document.body.style.overflow = 'hidden';
|
||||||
|
|
||||||
|
const handleKeyDown = (e: KeyboardEvent) => {
|
||||||
|
if (e.key === 'Escape') onClose();
|
||||||
|
};
|
||||||
|
document.addEventListener('keydown', handleKeyDown);
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
document.body.style.overflow = '';
|
||||||
|
document.removeEventListener('keydown', handleKeyDown);
|
||||||
|
};
|
||||||
|
}, [onClose]);
|
||||||
|
|
||||||
|
const handleCitySelect = (city: string) => {
|
||||||
|
const region = REGIONS.find(r => r.cities.includes(city));
|
||||||
|
// 특별시/광역시는 도 이름 없이 도시명만 사용
|
||||||
|
const prefix = region && region.label !== '특별시 / 광역시' ? `${region.label} ` : '';
|
||||||
|
setSelectedCity(`${prefix}${city}`);
|
||||||
|
};
|
||||||
|
|
||||||
|
const isValid = businessName.trim().length > 0 && selectedCity.length > 0 && detailAddress.trim().length > 0;
|
||||||
|
|
||||||
|
const handleSubmit = () => {
|
||||||
|
if (!isValid) return;
|
||||||
|
const fullAddress = `${selectedCity} ${detailAddress.trim()}`;
|
||||||
|
onSubmit(businessName.trim(), fullAddress);
|
||||||
|
onClose();
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleKeyDown = (e: React.KeyboardEvent) => {
|
||||||
|
if (e.key === 'Enter' && isValid) handleSubmit();
|
||||||
|
};
|
||||||
|
|
||||||
|
// CitySelectModal의 selected prop용 — 도시명만 추출
|
||||||
|
const cityOnly = selectedCity.split(' ').pop() ?? '';
|
||||||
|
|
||||||
|
return createPortal(
|
||||||
|
<>
|
||||||
|
<div className="manual-modal-backdrop" onClick={onClose}>
|
||||||
|
<div className="manual-modal" onClick={e => e.stopPropagation()}>
|
||||||
|
<div className="manual-modal-header">
|
||||||
|
<span className="manual-modal-title">{t('landing.hero.manualModalTitle')}</span>
|
||||||
|
<button className="manual-modal-close" onClick={onClose}>✕</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="manual-modal-body">
|
||||||
|
<div className="manual-modal-field">
|
||||||
|
<label className="manual-modal-label">{t('landing.hero.manualLabelName')}</label>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
className="manual-modal-input"
|
||||||
|
placeholder={t('landing.hero.manualPlaceholderName')}
|
||||||
|
value={businessName}
|
||||||
|
onChange={e => setBusinessName(e.target.value)}
|
||||||
|
onKeyDown={handleKeyDown}
|
||||||
|
maxLength={50}
|
||||||
|
autoFocus
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="manual-modal-field">
|
||||||
|
<label className="manual-modal-label">{t('landing.hero.manualLabelRegion')}</label>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className={`manual-modal-city-btn ${selectedCity ? 'selected' : ''}`}
|
||||||
|
onClick={() => setIsCityModalOpen(true)}
|
||||||
|
>
|
||||||
|
<span>{selectedCity || t('landing.hero.manualPlaceholderRegion')}</span>
|
||||||
|
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
|
||||||
|
<path d="M6 9l6 6 6-6" />
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="manual-modal-field">
|
||||||
|
<label className="manual-modal-label">{t('landing.hero.manualLabelDetail')}</label>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
className="manual-modal-input"
|
||||||
|
placeholder={t('landing.hero.manualPlaceholderDetail')}
|
||||||
|
value={detailAddress}
|
||||||
|
onChange={e => setDetailAddress(e.target.value)}
|
||||||
|
onKeyDown={handleKeyDown}
|
||||||
|
maxLength={100}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="manual-modal-actions">
|
||||||
|
<button type="button" className="manual-modal-cancel" onClick={onClose}>
|
||||||
|
{t('common.cancel')}
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="manual-modal-submit"
|
||||||
|
onClick={handleSubmit}
|
||||||
|
disabled={!isValid}
|
||||||
|
>
|
||||||
|
{t('landing.hero.analyzeButton')}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{isCityModalOpen && (
|
||||||
|
<CitySelectModal
|
||||||
|
selected={cityOnly}
|
||||||
|
onSelect={(city) => { handleCitySelect(city); setIsCityModalOpen(false); }}
|
||||||
|
onClose={() => setIsCityModalOpen(false)}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</>,
|
||||||
|
document.body
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default BusinessNameInputModal;
|
||||||
@@ -0,0 +1,159 @@
|
|||||||
|
import React, { useState, useEffect } from 'react';
|
||||||
|
|
||||||
|
export const REGIONS: { label: string; cities: string[] }[] = [
|
||||||
|
{
|
||||||
|
label: '특별시 / 광역시',
|
||||||
|
cities: ['서울시', '부산시', '대구시', '인천시', '광주시', '대전시', '울산시', '세종시'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '경기도',
|
||||||
|
cities: [
|
||||||
|
'수원시', '성남시', '고양시', '용인시', '부천시', '안산시', '안양시', '남양주시',
|
||||||
|
'화성시', '평택시', '의정부시', '시흥시', '파주시', '김포시', '광주시', '광명시',
|
||||||
|
'군포시', '하남시', '오산시', '이천시', '안성시', '구리시', '양주시', '포천시',
|
||||||
|
'여주시', '동두천시', '과천시', '가평군', '양평군', '연천군',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '강원도',
|
||||||
|
cities: [
|
||||||
|
'춘천시', '원주시', '강릉시', '동해시', '태백시', '속초시', '삼척시',
|
||||||
|
'홍천군', '횡성군', '영월군', '평창군', '정선군', '철원군', '화천군',
|
||||||
|
'양구군', '인제군', '고성군', '양양군',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '충청북도',
|
||||||
|
cities: [
|
||||||
|
'청주시', '충주시', '제천시',
|
||||||
|
'보은군', '옥천군', '영동군', '증평군', '진천군', '괴산군', '음성군', '단양군',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '충청남도',
|
||||||
|
cities: [
|
||||||
|
'천안시', '공주시', '보령시', '아산시', '서산시', '논산시', '계룡시', '당진시',
|
||||||
|
'금산군', '부여군', '서천군', '청양군', '홍성군', '예산군', '태안군',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '전라북도',
|
||||||
|
cities: [
|
||||||
|
'전주시', '군산시', '익산시', '정읍시', '남원시', '김제시',
|
||||||
|
'완주군', '진안군', '무주군', '장수군', '임실군', '순창군', '고창군', '부안군',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '전라남도',
|
||||||
|
cities: [
|
||||||
|
'목포시', '여수시', '순천시', '나주시', '광양시',
|
||||||
|
'담양군', '곡성군', '구례군', '고흥군', '보성군', '화순군', '장흥군', '강진군',
|
||||||
|
'해남군', '영암군', '무안군', '함평군', '영광군', '장성군', '완도군', '진도군', '신안군',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '경상북도',
|
||||||
|
cities: [
|
||||||
|
'포항시', '경주시', '김천시', '안동시', '구미시', '영주시', '영천시', '상주시', '문경시', '경산시',
|
||||||
|
'의성군', '청송군', '영양군', '영덕군', '청도군', '고령군', '성주군', '칠곡군',
|
||||||
|
'예천군', '봉화군', '울진군', '울릉군',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '경상남도',
|
||||||
|
cities: [
|
||||||
|
'창원시', '진주시', '통영시', '사천시', '김해시', '밀양시', '거제시', '양산시',
|
||||||
|
'의령군', '함안군', '창녕군', '고성군', '남해군', '하동군', '산청군', '함양군', '거창군', '합천군',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '제주도',
|
||||||
|
cities: ['제주시', '서귀포시'],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
interface CitySelectModalProps {
|
||||||
|
selected: string;
|
||||||
|
onSelect: (city: string) => void;
|
||||||
|
onClose: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
const CitySelectModal: React.FC<CitySelectModalProps> = ({ selected, onSelect, onClose }) => {
|
||||||
|
const [activeRegion, setActiveRegion] = useState<string | null>(
|
||||||
|
() => REGIONS.find(r => r.cities.includes(selected))?.label ?? null
|
||||||
|
);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
document.body.style.overflow = 'hidden';
|
||||||
|
return () => { document.body.style.overflow = ''; };
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const activeEntry = REGIONS.find(r => r.label === activeRegion);
|
||||||
|
const cities = activeEntry?.cities ?? [];
|
||||||
|
|
||||||
|
const handleSelect = (value: string) => {
|
||||||
|
onSelect(value === selected ? '' : value);
|
||||||
|
onClose();
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="city-modal-backdrop" onClick={onClose}>
|
||||||
|
<div className="city-modal" onClick={e => e.stopPropagation()}>
|
||||||
|
<div className="city-modal-header">
|
||||||
|
<span className="city-modal-title">
|
||||||
|
{activeRegion ? (
|
||||||
|
<>
|
||||||
|
<button className="city-modal-back" onClick={() => setActiveRegion(null)}>←</button>
|
||||||
|
{activeRegion}
|
||||||
|
</>
|
||||||
|
) : '지역 선택'}
|
||||||
|
</span>
|
||||||
|
<button className="city-modal-close" onClick={onClose}>✕</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{activeRegion === null ? (
|
||||||
|
<div className="city-modal-grid">
|
||||||
|
{REGIONS.map(r => {
|
||||||
|
const isRegionSelected = selected === r.label;
|
||||||
|
const hasCitySelected = r.cities.includes(selected);
|
||||||
|
return (
|
||||||
|
<button
|
||||||
|
key={r.label}
|
||||||
|
className={`city-modal-region-item ${isRegionSelected || hasCitySelected ? 'has-selected' : ''}`}
|
||||||
|
onClick={() => setActiveRegion(r.label)}
|
||||||
|
>
|
||||||
|
<span>{r.label}</span>
|
||||||
|
{isRegionSelected && <span className="city-modal-region-badge">전체</span>}
|
||||||
|
{hasCitySelected && <span className="city-modal-region-badge">{selected}</span>}
|
||||||
|
<span className="city-modal-arrow">›</span>
|
||||||
|
</button>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<div className="city-modal-item-wrap">
|
||||||
|
{activeRegion !== '특별시 / 광역시' && (
|
||||||
|
<button
|
||||||
|
className={`city-modal-item city-modal-item-all ${selected === activeRegion ? 'active' : ''}`}
|
||||||
|
onClick={() => handleSelect(activeRegion!)}
|
||||||
|
>
|
||||||
|
전체
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
{cities.map(city => (
|
||||||
|
<button
|
||||||
|
key={city}
|
||||||
|
className={`city-modal-item ${selected === city ? 'active' : ''}`}
|
||||||
|
onClick={() => handleSelect(city)}
|
||||||
|
>
|
||||||
|
{city}
|
||||||
|
</button>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default CitySelectModal;
|
||||||
@@ -0,0 +1,100 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import { getKakaoLoginUrl } from '../utils/api';
|
||||||
|
|
||||||
|
interface LoginPromptModalProps {
|
||||||
|
onClose: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
const LoginPromptModal: React.FC<LoginPromptModalProps> = ({ onClose }) => {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
const handleLogin = async () => {
|
||||||
|
try {
|
||||||
|
sessionStorage.setItem('castad_login_redirect', window.location.pathname);
|
||||||
|
const response = await getKakaoLoginUrl();
|
||||||
|
window.location.href = response.auth_url;
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Failed to get Kakao login URL:', err);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
position: 'fixed',
|
||||||
|
inset: 0,
|
||||||
|
background: 'rgba(255, 255, 255, 0.25)',
|
||||||
|
display: 'flex',
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'center',
|
||||||
|
zIndex: 9999,
|
||||||
|
}}
|
||||||
|
onClick={onClose}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
background: '#01282A',
|
||||||
|
border: '1px solid rgba(155, 202, 204, 0.2)',
|
||||||
|
borderRadius: '16px',
|
||||||
|
padding: '40px 32px',
|
||||||
|
width: '360px',
|
||||||
|
maxWidth: '90vw',
|
||||||
|
textAlign: 'center',
|
||||||
|
position: 'relative',
|
||||||
|
}}
|
||||||
|
onClick={(e) => e.stopPropagation()}
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
onClick={onClose}
|
||||||
|
aria-label="닫기"
|
||||||
|
style={{
|
||||||
|
position: 'absolute',
|
||||||
|
top: '16px',
|
||||||
|
right: '16px',
|
||||||
|
background: 'none',
|
||||||
|
border: 'none',
|
||||||
|
cursor: 'pointer',
|
||||||
|
color: '#9BCACC',
|
||||||
|
padding: '4px',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" stroke="currentColor" strokeWidth="1.5">
|
||||||
|
<line x1="4" y1="4" x2="16" y2="16"/>
|
||||||
|
<line x1="16" y1="4" x2="4" y2="16"/>
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
<h2 style={{ color: '#FFFFFF', fontSize: '20px', fontWeight: 600, marginBottom: '12px' }}>
|
||||||
|
{t('loginPrompt.title')}
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
<button
|
||||||
|
onClick={handleLogin}
|
||||||
|
style={{
|
||||||
|
width: '50%',
|
||||||
|
margin: '0 auto',
|
||||||
|
padding: '14px',
|
||||||
|
background: '#FEE500',
|
||||||
|
color: '#3C1E1E',
|
||||||
|
border: 'none',
|
||||||
|
borderRadius: '8px',
|
||||||
|
fontSize: '15px',
|
||||||
|
fontWeight: 600,
|
||||||
|
cursor: 'pointer',
|
||||||
|
display: 'flex',
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'center',
|
||||||
|
gap: '8px',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path fillRule="evenodd" clipRule="evenodd" d="M10 2C5.582 2 2 4.91 2 8.5c0 2.26 1.37 4.25 3.44 5.44L4.6 17.1a.3.3 0 0 0 .44.33l4.03-2.67c.3.03.62.04.93.04 4.418 0 8-2.91 8-6.5S14.418 2 10 2z" fill="#3C1E1E"/>
|
||||||
|
</svg>
|
||||||
|
{t('loginPrompt.loginBtn')}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default LoginPromptModal;
|
||||||
@@ -0,0 +1,342 @@
|
|||||||
|
import React, { useState, useRef, useCallback, useEffect } from 'react';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import { searchAccommodation, AccommodationSearchItem, AutocompleteRequest } from '../utils/api';
|
||||||
|
import { useSearchHistory } from './SearchHistory/useSearchHistory';
|
||||||
|
import SearchHistoryDropdown from './SearchHistory/SearchHistoryDropdown';
|
||||||
|
import BusinessNameInputModal from './BusinessNameInputModal';
|
||||||
|
|
||||||
|
type SearchType = 'url' | 'name' | 'manual';
|
||||||
|
|
||||||
|
export type { SearchType };
|
||||||
|
|
||||||
|
const isValidUrl = (string: string): boolean => {
|
||||||
|
try {
|
||||||
|
const url = new URL(string);
|
||||||
|
return url.protocol === 'http:' || url.protocol === 'https:';
|
||||||
|
} catch {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
interface SearchInputFormProps {
|
||||||
|
onAnalyze?: (value: string, type: SearchType) => void;
|
||||||
|
onAutocomplete?: (data: AutocompleteRequest) => void;
|
||||||
|
onManualInput?: (businessName: string, address: string) => void;
|
||||||
|
/** 직접입력 버튼 클릭 시 기본 동작(모달 열기)을 대체합니다. 제공 시 모달을 직접 관리해야 합니다. */
|
||||||
|
onManualButtonClick?: () => void;
|
||||||
|
error?: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const SearchInputForm: React.FC<SearchInputFormProps> = ({
|
||||||
|
onAnalyze,
|
||||||
|
onAutocomplete,
|
||||||
|
onManualInput,
|
||||||
|
onManualButtonClick,
|
||||||
|
error: externalError,
|
||||||
|
}) => {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const [inputValue, setInputValue] = useState('');
|
||||||
|
const [searchType, setSearchType] = useState<SearchType>('name');
|
||||||
|
const [isDropdownOpen, setIsDropdownOpen] = useState(false);
|
||||||
|
const [isFocused, setIsFocused] = useState(false);
|
||||||
|
const [isManualModalOpen, setIsManualModalOpen] = useState(false);
|
||||||
|
const [localError, setLocalError] = useState('');
|
||||||
|
const [autocompleteResults, setAutocompleteResults] = useState<AccommodationSearchItem[]>([]);
|
||||||
|
const [isAutocompleteLoading, setIsAutocompleteLoading] = useState(false);
|
||||||
|
const [showAutocomplete, setShowAutocomplete] = useState(false);
|
||||||
|
const [selectedItem, setSelectedItem] = useState<AccommodationSearchItem | null>(null);
|
||||||
|
const [highlightedIndex, setHighlightedIndex] = useState<number>(-1);
|
||||||
|
|
||||||
|
const { filteredHistory, showHistory, openHistory, closeHistory, hideOnInput, deleteItem } = useSearchHistory(searchType === 'manual' ? 'name' : searchType);
|
||||||
|
const debounceRef = useRef<NodeJS.Timeout | null>(null);
|
||||||
|
const dropdownRef = useRef<HTMLDivElement>(null);
|
||||||
|
const autocompleteRef = useRef<HTMLDivElement>(null);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const handleClickOutside = (event: MouseEvent) => {
|
||||||
|
if (dropdownRef.current && !dropdownRef.current.contains(event.target as Node)) {
|
||||||
|
setIsDropdownOpen(false);
|
||||||
|
}
|
||||||
|
if (autocompleteRef.current && !autocompleteRef.current.contains(event.target as Node)) {
|
||||||
|
setShowAutocomplete(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
document.addEventListener('mousedown', handleClickOutside);
|
||||||
|
return () => document.removeEventListener('mousedown', handleClickOutside);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const searchTypeOptions = [
|
||||||
|
{ value: 'url' as SearchType, label: 'URL' },
|
||||||
|
{ value: 'name' as SearchType, label: t('landing.hero.searchTypeBusinessName') },
|
||||||
|
];
|
||||||
|
|
||||||
|
const getPlaceholder = () =>
|
||||||
|
searchType === 'url' ? 'https://naver.me/abcdef' : t('landing.hero.placeholderBusinessName');
|
||||||
|
|
||||||
|
const getGuideText = () =>
|
||||||
|
searchType === 'url' ? t('landing.hero.guideUrl') : t('landing.hero.guideBusinessName');
|
||||||
|
|
||||||
|
const handleAutocompleteSearch = useCallback(async (query: string) => {
|
||||||
|
if (!query.trim() || searchType !== 'name') {
|
||||||
|
setAutocompleteResults([]);
|
||||||
|
setShowAutocomplete(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIsAutocompleteLoading(true);
|
||||||
|
try {
|
||||||
|
const response = await searchAccommodation(query);
|
||||||
|
setAutocompleteResults(response.items || []);
|
||||||
|
setShowAutocomplete(response.items && response.items.length > 0);
|
||||||
|
} catch {
|
||||||
|
setAutocompleteResults([]);
|
||||||
|
setShowAutocomplete(false);
|
||||||
|
} finally {
|
||||||
|
setIsAutocompleteLoading(false);
|
||||||
|
}
|
||||||
|
}, [searchType]);
|
||||||
|
|
||||||
|
const handleSelectAutocomplete = (item: AccommodationSearchItem) => {
|
||||||
|
setInputValue(item.title.replace(/<[^>]*>/g, ''));
|
||||||
|
setSelectedItem(item);
|
||||||
|
setShowAutocomplete(false);
|
||||||
|
setAutocompleteResults([]);
|
||||||
|
setHighlightedIndex(-1);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {
|
||||||
|
if (showAutocomplete && autocompleteResults.length > 0) {
|
||||||
|
switch (e.key) {
|
||||||
|
case 'ArrowDown':
|
||||||
|
e.preventDefault();
|
||||||
|
setHighlightedIndex(prev => prev < autocompleteResults.length - 1 ? prev + 1 : 0);
|
||||||
|
return;
|
||||||
|
case 'ArrowUp':
|
||||||
|
e.preventDefault();
|
||||||
|
setHighlightedIndex(prev => prev > 0 ? prev - 1 : autocompleteResults.length - 1);
|
||||||
|
return;
|
||||||
|
case 'Enter':
|
||||||
|
e.preventDefault();
|
||||||
|
if (highlightedIndex >= 0 && highlightedIndex < autocompleteResults.length) {
|
||||||
|
handleSelectAutocomplete(autocompleteResults[highlightedIndex]);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
case 'Escape':
|
||||||
|
e.preventDefault();
|
||||||
|
setShowAutocomplete(false);
|
||||||
|
setHighlightedIndex(-1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (e.key === 'Enter') {
|
||||||
|
e.preventDefault();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleStart = () => {
|
||||||
|
if (!inputValue.trim()) {
|
||||||
|
setLocalError(searchType === 'url' ? t('landing.hero.errorUrlRequired') : t('landing.hero.errorNameRequired'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (searchType === 'url' && !isValidUrl(inputValue.trim())) {
|
||||||
|
setLocalError(t('landing.hero.errorInvalidUrl'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
setLocalError('');
|
||||||
|
|
||||||
|
if (searchType === 'name' && selectedItem && onAutocomplete) {
|
||||||
|
onAutocomplete({
|
||||||
|
address: selectedItem.address,
|
||||||
|
roadAddress: selectedItem.roadAddress,
|
||||||
|
title: selectedItem.title,
|
||||||
|
});
|
||||||
|
} else if (onAnalyze) {
|
||||||
|
onAnalyze(inputValue, searchType);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleManualButtonClick = () => {
|
||||||
|
if (onManualButtonClick) {
|
||||||
|
onManualButtonClick();
|
||||||
|
} else {
|
||||||
|
setIsManualModalOpen(true);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const error = externalError || localError;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="hero-form">
|
||||||
|
<div className={`hero-input-wrapper ${isFocused ? 'focused' : ''} ${error ? 'error' : ''} ${inputValue && !isFocused ? 'filled' : ''}`}>
|
||||||
|
{/* 드롭다운 */}
|
||||||
|
<div className="hero-dropdown-container" ref={dropdownRef}>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="hero-dropdown-trigger"
|
||||||
|
onClick={() => setIsDropdownOpen(!isDropdownOpen)}
|
||||||
|
>
|
||||||
|
<span>{searchTypeOptions.find(opt => opt.value === searchType)?.label}</span>
|
||||||
|
<svg
|
||||||
|
width="12"
|
||||||
|
height="12"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
strokeWidth="2"
|
||||||
|
className={`hero-dropdown-arrow ${isDropdownOpen ? 'open' : ''}`}
|
||||||
|
>
|
||||||
|
<path d="M6 9l6 6 6-6" />
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
{isDropdownOpen && (
|
||||||
|
<div className="hero-dropdown-menu">
|
||||||
|
{searchTypeOptions.map((option) => (
|
||||||
|
<button
|
||||||
|
key={option.value}
|
||||||
|
type="button"
|
||||||
|
className={`hero-dropdown-item ${searchType === option.value ? 'active' : ''}`}
|
||||||
|
onClick={() => {
|
||||||
|
setSearchType(option.value);
|
||||||
|
setIsDropdownOpen(false);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{option.label}
|
||||||
|
</button>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* 입력 필드 */}
|
||||||
|
<div className="hero-input-container" ref={autocompleteRef}>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
value={inputValue}
|
||||||
|
onChange={(e) => {
|
||||||
|
let value = e.target.value;
|
||||||
|
if (searchType === 'url') {
|
||||||
|
const urlMatch = value.match(/https?:\/\/\S+/);
|
||||||
|
if (urlMatch && urlMatch[0] !== value) value = urlMatch[0];
|
||||||
|
}
|
||||||
|
setInputValue(value);
|
||||||
|
setSelectedItem(null);
|
||||||
|
setHighlightedIndex(-1);
|
||||||
|
hideOnInput(value);
|
||||||
|
if (localError) setLocalError('');
|
||||||
|
if (searchType === 'name') {
|
||||||
|
if (debounceRef.current) clearTimeout(debounceRef.current);
|
||||||
|
debounceRef.current = setTimeout(() => handleAutocompleteSearch(value), 300);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
onPaste={(e: React.ClipboardEvent<HTMLInputElement>) => {
|
||||||
|
if (searchType !== 'url') return;
|
||||||
|
const pasted = e.clipboardData.getData('text');
|
||||||
|
const urlMatch = pasted.match(/https?:\/\/[^\s]+/);
|
||||||
|
if (urlMatch) {
|
||||||
|
e.preventDefault();
|
||||||
|
setInputValue(urlMatch[0]);
|
||||||
|
if (localError) setLocalError('');
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
onFocus={() => {
|
||||||
|
setIsFocused(true);
|
||||||
|
if (searchType === 'name' && autocompleteResults.length > 0) setShowAutocomplete(true);
|
||||||
|
openHistory(inputValue);
|
||||||
|
}}
|
||||||
|
onBlur={() => { setIsFocused(false); setTimeout(() => closeHistory(), 150); }}
|
||||||
|
onKeyDown={handleKeyDown}
|
||||||
|
placeholder={getPlaceholder()}
|
||||||
|
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' && (
|
||||||
|
<div className="hero-autocomplete-dropdown">
|
||||||
|
{isAutocompleteLoading ? (
|
||||||
|
<div className="hero-autocomplete-loading">{t('landing.hero.searching')}</div>
|
||||||
|
) : (
|
||||||
|
autocompleteResults.map((item, index) => (
|
||||||
|
<button
|
||||||
|
key={index}
|
||||||
|
type="button"
|
||||||
|
className={`hero-autocomplete-item ${highlightedIndex === index ? 'highlighted' : ''}`}
|
||||||
|
onMouseDown={(e) => { e.preventDefault(); handleSelectAutocomplete(item); }}
|
||||||
|
onMouseEnter={() => setHighlightedIndex(index)}
|
||||||
|
>
|
||||||
|
<div className="hero-autocomplete-title" dangerouslySetInnerHTML={{ __html: item.title }} />
|
||||||
|
<div className="hero-autocomplete-address">{item.roadAddress || item.address}</div>
|
||||||
|
</button>
|
||||||
|
))
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* 입력 clear 버튼 */}
|
||||||
|
{inputValue && (
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="hero-input-clear"
|
||||||
|
onClick={() => {
|
||||||
|
setInputValue('');
|
||||||
|
setSelectedItem(null);
|
||||||
|
setLocalError('');
|
||||||
|
setAutocompleteResults([]);
|
||||||
|
setShowAutocomplete(false);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<img src="/assets/images/input-clear-icon.svg" alt="Clear" />
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<span className="hero-input-hint">{getGuideText()}</span>
|
||||||
|
|
||||||
|
{error && <p className="hero-error">{error}</p>}
|
||||||
|
|
||||||
|
<button onClick={handleStart} className="hero-button">
|
||||||
|
{t('landing.hero.analyzeButton')}
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button type="button" className="hero-manual-button" onClick={handleManualButtonClick}>
|
||||||
|
{t('landing.hero.searchTypeManual')}
|
||||||
|
</button>
|
||||||
|
|
||||||
|
{/* onManualButtonClick 미제공 시 모달을 내부에서 관리 */}
|
||||||
|
{!onManualButtonClick && isManualModalOpen && (
|
||||||
|
<BusinessNameInputModal
|
||||||
|
onClose={() => setIsManualModalOpen(false)}
|
||||||
|
onSubmit={(businessName, address) => {
|
||||||
|
setIsManualModalOpen(false);
|
||||||
|
onManualInput?.(businessName, address);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default SearchInputForm;
|
||||||
@@ -38,9 +38,12 @@ interface SidebarProps {
|
|||||||
userInfo?: UserMeResponse | null;
|
userInfo?: UserMeResponse | null;
|
||||||
onLogout?: () => void;
|
onLogout?: () => void;
|
||||||
credits?: number | null;
|
credits?: number | null;
|
||||||
|
tutorialAvailable?: boolean;
|
||||||
|
tutorialEnabled?: boolean;
|
||||||
|
onToggleTutorial?: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Sidebar: React.FC<SidebarProps> = ({ activeItem, onNavigate, onHome, userInfo, onLogout, credits }) => {
|
const Sidebar: React.FC<SidebarProps> = ({ activeItem, onNavigate, onHome, userInfo, onLogout, credits, tutorialAvailable, tutorialEnabled, onToggleTutorial }) => {
|
||||||
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 +88,7 @@ const Sidebar: React.FC<SidebarProps> = ({ activeItem, onNavigate, onHome, userI
|
|||||||
{ id: '대시보드', label: t('sidebar.dashboard'), disabled: false, icon: <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5"><rect x="3" y="3" width="7" height="9"/><rect x="14" y="3" width="7" height="5"/><rect x="14" y="12" width="7" height="9"/><rect x="3" y="16" width="7" height="5"/></svg> },
|
{ id: '대시보드', label: t('sidebar.dashboard'), disabled: false, icon: <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5"><rect x="3" y="3" width="7" height="9"/><rect x="14" y="3" width="7" height="5"/><rect x="14" y="12" width="7" height="9"/><rect x="3" y="16" width="7" height="5"/></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: '새 프로젝트 만들기', 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: false, 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('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('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> },
|
||||||
];
|
];
|
||||||
@@ -159,6 +162,24 @@ const Sidebar: React.FC<SidebarProps> = ({ activeItem, onNavigate, onHome, userI
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="sidebar-footer">
|
<div className="sidebar-footer">
|
||||||
|
{/* 모바일 전용 튜토리얼 토글 */}
|
||||||
|
{tutorialAvailable && (
|
||||||
|
<button
|
||||||
|
className={`sidebar-tutorial-btn ${tutorialEnabled ? 'active' : ''}`}
|
||||||
|
onClick={() => onToggleTutorial?.()}
|
||||||
|
title={tutorialEnabled ? t('sidebar.tutorialOff') : t('sidebar.tutorialOn')}
|
||||||
|
>
|
||||||
|
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5">
|
||||||
|
<circle cx="12" cy="12" r="10"/>
|
||||||
|
<path d="M12 8v4l3 3"/>
|
||||||
|
</svg>
|
||||||
|
<span className="sidebar-tutorial-label">{t('sidebar.tutorial')}</span>
|
||||||
|
<span className={`sidebar-tutorial-badge ${tutorialEnabled ? 'on' : 'off'}`}>
|
||||||
|
{tutorialEnabled ? 'ON' : 'OFF'}
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
|
||||||
<div className="sidebar-language-switch">
|
<div className="sidebar-language-switch">
|
||||||
<LanguageSwitch isCollapsed={isCollapsed} />
|
<LanguageSwitch isCollapsed={isCollapsed} />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -142,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);
|
||||||
@@ -207,11 +211,28 @@ const SocialPostingModal: React.FC<SocialPostingModalProps> = ({
|
|||||||
|
|
||||||
// 소셜 계정 로드
|
// 소셜 계정 로드
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isOpen) {
|
if (!isOpen) return;
|
||||||
loadSocialAccounts();
|
|
||||||
|
const now = Date.now();
|
||||||
|
|
||||||
|
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);
|
||||||
@@ -252,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);
|
||||||
// 실패해도 사용자에게 별도 알림 없이 조용히 처리
|
// 실패해도 사용자에게 별도 알림 없이 조용히 처리
|
||||||
@@ -530,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)}
|
||||||
@@ -539,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">
|
||||||
|
|||||||
@@ -27,7 +27,11 @@ interface TutorialOverlayProps {
|
|||||||
const PADDING = 8;
|
const PADDING = 8;
|
||||||
|
|
||||||
function getTargetRect(selector: string): Rect | null {
|
function getTargetRect(selector: string): Rect | null {
|
||||||
const el = document.querySelector(selector);
|
const els = Array.from(document.querySelectorAll(selector));
|
||||||
|
const el = els.find(e => {
|
||||||
|
const r = (e as HTMLElement).getBoundingClientRect();
|
||||||
|
return r.width > 0 && r.height > 0;
|
||||||
|
}) ?? els[0];
|
||||||
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, bottom: r.bottom };
|
return { top: r.top, left: r.left, width: r.width, height: r.height, bottom: r.bottom };
|
||||||
@@ -139,7 +143,11 @@ const TutorialOverlay: React.FC<TutorialOverlayProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const tryBind = (): boolean => {
|
const tryBind = (): boolean => {
|
||||||
const el = document.querySelector(hint.targetSelector) as HTMLElement | null;
|
const els = Array.from(document.querySelectorAll(hint.targetSelector));
|
||||||
|
const el = (els.find(e => {
|
||||||
|
const r = (e as HTMLElement).getBoundingClientRect();
|
||||||
|
return r.width > 0 && r.height > 0;
|
||||||
|
}) ?? els[0]) as HTMLElement | null;
|
||||||
if (!el) return false;
|
if (!el) return false;
|
||||||
bindToTarget(el);
|
bindToTarget(el);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ export const tutorialSteps: TutorialStepDef[] = [
|
|||||||
targetSelector: '.hero-dropdown-trigger',
|
targetSelector: '.hero-dropdown-trigger',
|
||||||
titleKey: 'tutorial.landing.dropdown.title',
|
titleKey: 'tutorial.landing.dropdown.title',
|
||||||
descriptionKey: 'tutorial.landing.dropdown.desc',
|
descriptionKey: 'tutorial.landing.dropdown.desc',
|
||||||
position: 'left',
|
position: 'top',
|
||||||
clickToAdvance: false,
|
clickToAdvance: false,
|
||||||
noSpotlight: true,
|
noSpotlight: true,
|
||||||
variant: 'bubble',
|
variant: 'bubble',
|
||||||
@@ -59,7 +59,16 @@ export const tutorialSteps: TutorialStepDef[] = [
|
|||||||
targetSelector: '.hero-input-wrapper',
|
targetSelector: '.hero-input-wrapper',
|
||||||
titleKey: 'tutorial.landing.field.title',
|
titleKey: 'tutorial.landing.field.title',
|
||||||
descriptionKey: 'tutorial.landing.field.desc',
|
descriptionKey: 'tutorial.landing.field.desc',
|
||||||
position: 'right',
|
position: 'top',
|
||||||
|
clickToAdvance: false,
|
||||||
|
noSpotlight: true,
|
||||||
|
variant: 'bubble',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
targetSelector: '.hero-manual-button',
|
||||||
|
titleKey: 'tutorial.landing.manual.title',
|
||||||
|
descriptionKey: 'tutorial.landing.manual.desc',
|
||||||
|
position: 'bottom',
|
||||||
clickToAdvance: false,
|
clickToAdvance: false,
|
||||||
noSpotlight: true,
|
noSpotlight: true,
|
||||||
variant: 'bubble',
|
variant: 'bubble',
|
||||||
@@ -68,7 +77,7 @@ export const tutorialSteps: TutorialStepDef[] = [
|
|||||||
targetSelector: '.hero-button',
|
targetSelector: '.hero-button',
|
||||||
titleKey: 'tutorial.landing.button.title',
|
titleKey: 'tutorial.landing.button.title',
|
||||||
descriptionKey: 'tutorial.landing.button.desc',
|
descriptionKey: 'tutorial.landing.button.desc',
|
||||||
position: 'right',
|
position: 'bottom',
|
||||||
clickToAdvance: true,
|
clickToAdvance: true,
|
||||||
noSpotlight: true,
|
noSpotlight: true,
|
||||||
variant: 'bubble',
|
variant: 'bubble',
|
||||||
@@ -86,17 +95,17 @@ export const tutorialSteps: TutorialStepDef[] = [
|
|||||||
clickToAdvance: false,
|
clickToAdvance: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
targetSelector: '.asset-upload-zone',
|
targetSelector: '.asset-upload-zone, .asset-mobile-upload-btn',
|
||||||
titleKey: 'tutorial.asset.upload.title',
|
titleKey: 'tutorial.asset.upload.title',
|
||||||
descriptionKey: 'tutorial.asset.upload.desc',
|
descriptionKey: 'tutorial.asset.upload.desc',
|
||||||
position: 'left',
|
position: 'bottom',
|
||||||
clickToAdvance: false,
|
clickToAdvance: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
targetSelector: '.asset-ratio-section',
|
targetSelector: '.asset-ratio-section',
|
||||||
titleKey: 'tutorial.asset.ratio.title',
|
titleKey: 'tutorial.asset.ratio.title',
|
||||||
descriptionKey: 'tutorial.asset.ratio.desc',
|
descriptionKey: 'tutorial.asset.ratio.desc',
|
||||||
position: 'left',
|
position: 'top',
|
||||||
clickToAdvance: false,
|
clickToAdvance: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -129,7 +138,7 @@ export const tutorialSteps: TutorialStepDef[] = [
|
|||||||
targetSelector: '.btn-generate-sound',
|
targetSelector: '.btn-generate-sound',
|
||||||
titleKey: 'tutorial.sound.generate.title',
|
titleKey: 'tutorial.sound.generate.title',
|
||||||
descriptionKey: 'tutorial.sound.generate.desc',
|
descriptionKey: 'tutorial.sound.generate.desc',
|
||||||
position: 'right',
|
position: 'top',
|
||||||
clickToAdvance: true,
|
clickToAdvance: true,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -141,14 +150,14 @@ export const tutorialSteps: TutorialStepDef[] = [
|
|||||||
targetSelector: '.lyrics-display',
|
targetSelector: '.lyrics-display',
|
||||||
titleKey: 'tutorial.sound.lyrics.title',
|
titleKey: 'tutorial.sound.lyrics.title',
|
||||||
descriptionKey: 'tutorial.sound.lyrics.desc',
|
descriptionKey: 'tutorial.sound.lyrics.desc',
|
||||||
position: 'left',
|
position: 'top',
|
||||||
clickToAdvance: false,
|
clickToAdvance: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
targetSelector: '.status-message-new',
|
targetSelector: '.status-message-new',
|
||||||
titleKey: 'tutorial.sound.lyricsWait.title',
|
titleKey: 'tutorial.sound.lyricsWait.title',
|
||||||
descriptionKey: 'tutorial.sound.lyricsWait.desc',
|
descriptionKey: 'tutorial.sound.lyricsWait.desc',
|
||||||
position: 'right',
|
position: 'top',
|
||||||
clickToAdvance: false,
|
clickToAdvance: false,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -160,7 +169,7 @@ export const tutorialSteps: TutorialStepDef[] = [
|
|||||||
targetSelector: '.audio-player',
|
targetSelector: '.audio-player',
|
||||||
titleKey: 'tutorial.sound.audioPlayer.title',
|
titleKey: 'tutorial.sound.audioPlayer.title',
|
||||||
descriptionKey: 'tutorial.sound.audioPlayer.desc',
|
descriptionKey: 'tutorial.sound.audioPlayer.desc',
|
||||||
position: 'left',
|
position: 'bottom',
|
||||||
clickToAdvance: false,
|
clickToAdvance: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -220,21 +229,21 @@ export const tutorialSteps: TutorialStepDef[] = [
|
|||||||
targetSelector: '.content-upload-btn',
|
targetSelector: '.content-upload-btn',
|
||||||
titleKey: 'tutorial.ado2.download.title',
|
titleKey: 'tutorial.ado2.download.title',
|
||||||
descriptionKey: 'tutorial.ado2.download.desc',
|
descriptionKey: 'tutorial.ado2.download.desc',
|
||||||
position: 'right',
|
position: 'top',
|
||||||
clickToAdvance: false,
|
clickToAdvance: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
targetSelector: '.content-delete-btn',
|
targetSelector: '.content-delete-btn',
|
||||||
titleKey: 'tutorial.ado2.delete.title',
|
titleKey: 'tutorial.ado2.delete.title',
|
||||||
descriptionKey: 'tutorial.ado2.delete.desc',
|
descriptionKey: 'tutorial.ado2.delete.desc',
|
||||||
position: 'right',
|
position: 'top',
|
||||||
clickToAdvance: false,
|
clickToAdvance: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
targetSelector: '.content-download-btn',
|
targetSelector: '.content-download-btn',
|
||||||
titleKey: 'tutorial.ado2.upload.title',
|
titleKey: 'tutorial.ado2.upload.title',
|
||||||
descriptionKey: 'tutorial.ado2.upload.desc',
|
descriptionKey: 'tutorial.ado2.upload.desc',
|
||||||
position: 'right',
|
position: 'top',
|
||||||
clickToAdvance: true,
|
clickToAdvance: true,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -252,7 +261,7 @@ export const tutorialSteps: TutorialStepDef[] = [
|
|||||||
targetSelector: '.comp2-video-section',
|
targetSelector: '.comp2-video-section',
|
||||||
titleKey: 'tutorial.completion.generating.title',
|
titleKey: 'tutorial.completion.generating.title',
|
||||||
descriptionKey: 'tutorial.completion.generating.desc',
|
descriptionKey: 'tutorial.completion.generating.desc',
|
||||||
position: 'right',
|
position: 'top',
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -263,7 +272,7 @@ export const tutorialSteps: TutorialStepDef[] = [
|
|||||||
targetSelector: '.comp2-video-section',
|
targetSelector: '.comp2-video-section',
|
||||||
titleKey: 'tutorial.completion.completion.title',
|
titleKey: 'tutorial.completion.completion.title',
|
||||||
descriptionKey: 'tutorial.completion.completion.desc',
|
descriptionKey: 'tutorial.completion.completion.desc',
|
||||||
position: 'right',
|
position: 'top',
|
||||||
clickToAdvance: false,
|
clickToAdvance: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -294,14 +303,14 @@ export const tutorialSteps: TutorialStepDef[] = [
|
|||||||
targetSelector: '.social-posting-form',
|
targetSelector: '.social-posting-form',
|
||||||
titleKey: 'tutorial.upload.required.title',
|
titleKey: 'tutorial.upload.required.title',
|
||||||
descriptionKey: 'tutorial.upload.required.desc',
|
descriptionKey: 'tutorial.upload.required.desc',
|
||||||
position: 'left',
|
position: 'top',
|
||||||
clickToAdvance: false,
|
clickToAdvance: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
targetSelector: '.social-posting-radio-group',
|
targetSelector: '.social-posting-radio-group',
|
||||||
titleKey: 'tutorial.upload.schedule.title',
|
titleKey: 'tutorial.upload.schedule.title',
|
||||||
descriptionKey: 'tutorial.upload.schedule.desc',
|
descriptionKey: 'tutorial.upload.schedule.desc',
|
||||||
position: 'left',
|
position: 'top',
|
||||||
clickToAdvance: false,
|
clickToAdvance: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -326,7 +335,7 @@ export const tutorialSteps: TutorialStepDef[] = [
|
|||||||
targetSelector: '.yoy-chart-card',
|
targetSelector: '.yoy-chart-card',
|
||||||
titleKey: 'tutorial.dashboard.chart.title',
|
titleKey: 'tutorial.dashboard.chart.title',
|
||||||
descriptionKey: 'tutorial.dashboard.chart.desc',
|
descriptionKey: 'tutorial.dashboard.chart.desc',
|
||||||
position: 'right',
|
position: 'top',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
targetSelector: '.tutorial-center-anchor',
|
targetSelector: '.tutorial-center-anchor',
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, { useState, useCallback } from 'react';
|
import React, { useState, useCallback, useEffect } from 'react';
|
||||||
import { tutorialSteps, TutorialHint, TUTORIAL_PAGE_GROUPS } from './tutorialSteps';
|
import { tutorialSteps, TutorialHint, TUTORIAL_PAGE_GROUPS } from './tutorialSteps';
|
||||||
|
|
||||||
// 현재 키가 속한 그룹의 전체 힌트 수와 현재까지의 offset 반환
|
// 현재 키가 속한 그룹의 전체 힌트 수와 현재까지의 offset 반환
|
||||||
@@ -189,6 +189,16 @@ export function useTutorial(): UseTutorialReturn {
|
|||||||
return getSeenKeys().includes(key);
|
return getSeenKeys().includes(key);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
// 영상 보유 사용자 자동 off 이벤트 수신
|
||||||
|
useEffect(() => {
|
||||||
|
const handler = () => {
|
||||||
|
setIsActive(false);
|
||||||
|
setIsEnabled(false);
|
||||||
|
};
|
||||||
|
window.addEventListener('ado2-tutorial-auto-disable', handler);
|
||||||
|
return () => window.removeEventListener('ado2-tutorial-auto-disable', handler);
|
||||||
|
}, []);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
isActive,
|
isActive,
|
||||||
isEnabled,
|
isEnabled,
|
||||||
|
|||||||
@@ -0,0 +1,485 @@
|
|||||||
|
import React, { useState, useEffect, useCallback, useRef } from 'react';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import {
|
||||||
|
getVideoById,
|
||||||
|
getVideoComments,
|
||||||
|
postVideoComment,
|
||||||
|
deleteComment,
|
||||||
|
toggleVideoLike,
|
||||||
|
isLoggedIn,
|
||||||
|
} from '../utils/api';
|
||||||
|
import { VideoDetailItem, CommentItem } from '../types/api';
|
||||||
|
import LoginPromptModal from './LoginPromptModal';
|
||||||
|
|
||||||
|
interface VideoDetailContentProps {
|
||||||
|
videoId: string;
|
||||||
|
isModal?: boolean;
|
||||||
|
onClose?: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
const VideoDetailContent: React.FC<VideoDetailContentProps> = ({ videoId, isModal = false, onClose }) => {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const authed = isLoggedIn();
|
||||||
|
|
||||||
|
const [video, setVideo] = useState<VideoDetailItem | null>(null);
|
||||||
|
const [loading, setLoading] = useState(true);
|
||||||
|
const [error, setError] = useState<string | null>(null);
|
||||||
|
|
||||||
|
const [likeCount, setLikeCount] = useState(0);
|
||||||
|
const [isLiked, setIsLiked] = useState(false);
|
||||||
|
|
||||||
|
const [copied, setCopied] = useState(false);
|
||||||
|
const [shareMenuOpen, setShareMenuOpen] = useState(false);
|
||||||
|
const [isLandscape, setIsLandscape] = useState(false);
|
||||||
|
const [showLoginModal, setShowLoginModal] = useState(false);
|
||||||
|
|
||||||
|
const [comments, setComments] = useState<CommentItem[]>([]);
|
||||||
|
const [commentsTotal, setCommentsTotal] = useState(0);
|
||||||
|
const [commentsPage, setCommentsPage] = useState(1);
|
||||||
|
const [commentsHasNext, setCommentsHasNext] = useState(false);
|
||||||
|
const [commentsLoading, setCommentsLoading] = useState(false);
|
||||||
|
const [commentInput, setCommentInput] = useState('');
|
||||||
|
const [commentSubmitting, setCommentSubmitting] = useState(false);
|
||||||
|
const commentTextareaRef = useRef<HTMLTextAreaElement>(null);
|
||||||
|
|
||||||
|
const [commentNickname, setCommentNickname] = useState('');
|
||||||
|
const [commentAvatarSeedIdx, setCommentAvatarSeedIdx] = useState(0);
|
||||||
|
|
||||||
|
// 고정 seed 목록: 브라우저가 캐싱하여 중복 요청 없음
|
||||||
|
const AVATAR_SEEDS = ['42', '77', '123', '256', '512', '888', '1024', '2048', '3141', '9999'];
|
||||||
|
const commentAvatarSeed = AVATAR_SEEDS[commentAvatarSeedIdx % AVATAR_SEEDS.length];
|
||||||
|
|
||||||
|
const handleChangeAvatar = useCallback(() => {
|
||||||
|
setCommentAvatarSeedIdx(prev => (prev + 1) % AVATAR_SEEDS.length);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const fetchComments = useCallback(async (page: number, append = false) => {
|
||||||
|
setCommentsLoading(true);
|
||||||
|
try {
|
||||||
|
const res = await getVideoComments(videoId, page, 20);
|
||||||
|
const sorted = [...res.items].sort(
|
||||||
|
(a, b) => new Date(a.created_at).getTime() - new Date(b.created_at).getTime()
|
||||||
|
);
|
||||||
|
setComments(prev => append ? [...prev, ...sorted] : sorted);
|
||||||
|
setCommentsTotal(res.total);
|
||||||
|
setCommentsHasNext(res.has_next);
|
||||||
|
setCommentsPage(page);
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Failed to fetch comments:', err);
|
||||||
|
} finally {
|
||||||
|
setCommentsLoading(false);
|
||||||
|
}
|
||||||
|
}, [videoId]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const fetchVideo = async () => {
|
||||||
|
setLoading(true);
|
||||||
|
setError(null);
|
||||||
|
try {
|
||||||
|
const data = await getVideoById(videoId);
|
||||||
|
setVideo(data);
|
||||||
|
setLikeCount(data.like_count);
|
||||||
|
setIsLiked(data.is_liked_by_me);
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Failed to fetch video:', err);
|
||||||
|
setError(t('ado2Contents.loadFailed'));
|
||||||
|
} finally {
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
fetchVideo();
|
||||||
|
fetchComments(1);
|
||||||
|
}, [videoId, fetchComments]);
|
||||||
|
|
||||||
|
const formatDate = (dateString: string) => {
|
||||||
|
const date = new Date(dateString);
|
||||||
|
return `${date.getFullYear()}년 ${date.getMonth() + 1}월 ${date.getDate()}일`;
|
||||||
|
};
|
||||||
|
|
||||||
|
const formatCommentDate = (dateString: string) => {
|
||||||
|
const date = new Date(dateString);
|
||||||
|
return `${date.getFullYear()}.${String(date.getMonth() + 1).padStart(2, '0')}.${String(date.getDate()).padStart(2, '0')}`;
|
||||||
|
};
|
||||||
|
|
||||||
|
const shareUrl = `${window.location.origin}/video/${videoId}`;
|
||||||
|
|
||||||
|
const handleCopyLink = async () => {
|
||||||
|
try {
|
||||||
|
await navigator.clipboard.writeText(shareUrl);
|
||||||
|
} catch {
|
||||||
|
// clipboard API 미지원 환경에서는 무시
|
||||||
|
}
|
||||||
|
setCopied(true);
|
||||||
|
setTimeout(() => setCopied(false), 2000);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleKakaoShare = () => {
|
||||||
|
const kakao = window.Kakao;
|
||||||
|
if (kakao?.Share) {
|
||||||
|
kakao.Share.sendDefault({
|
||||||
|
objectType: 'feed',
|
||||||
|
content: {
|
||||||
|
title: video?.store_name ?? 'ADO2 영상',
|
||||||
|
description: `${video?.region ?? ''} · ADO2 AI 마케팅 영상`,
|
||||||
|
imageUrl: 'https://demo.castad.net/favicon_48.svg',
|
||||||
|
link: { mobileWebUrl: shareUrl, webUrl: shareUrl },
|
||||||
|
},
|
||||||
|
buttons: [{ title: '영상 보기', link: { mobileWebUrl: shareUrl, webUrl: shareUrl } }],
|
||||||
|
});
|
||||||
|
} else if (navigator.share) {
|
||||||
|
navigator.share({ url: shareUrl }).catch(() => {});
|
||||||
|
} else {
|
||||||
|
handleCopyLink();
|
||||||
|
}
|
||||||
|
setShareMenuOpen(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleFacebookShare = () => {
|
||||||
|
window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(shareUrl)}`, '_blank', 'noopener,width=600,height=600');
|
||||||
|
setShareMenuOpen(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleTwitterShare = () => {
|
||||||
|
window.open(`https://twitter.com/intent/tweet?url=${encodeURIComponent(shareUrl)}`, '_blank', 'noopener,width=600,height=600');
|
||||||
|
setShareMenuOpen(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
const shareMenuRef = React.useRef<HTMLDivElement>(null);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!shareMenuOpen) return;
|
||||||
|
const handleClickOutside = (e: MouseEvent) => {
|
||||||
|
if (shareMenuRef.current && !shareMenuRef.current.contains(e.target as Node)) {
|
||||||
|
setShareMenuOpen(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
document.addEventListener('mousedown', handleClickOutside);
|
||||||
|
return () => document.removeEventListener('mousedown', handleClickOutside);
|
||||||
|
}, [shareMenuOpen]);
|
||||||
|
|
||||||
|
const likeDebounceRef = React.useRef<ReturnType<typeof setTimeout> | null>(null);
|
||||||
|
|
||||||
|
const handleLike = () => {
|
||||||
|
if (!authed) { setShowLoginModal(true); return; }
|
||||||
|
|
||||||
|
// 1. UI 즉시 업데이트 (Optimistic)
|
||||||
|
setIsLiked(prev => !prev);
|
||||||
|
setLikeCount(prev => isLiked ? prev - 1 : prev + 1);
|
||||||
|
|
||||||
|
// 2. 기존 debounce 타이머 취소 후 재설정
|
||||||
|
if (likeDebounceRef.current) clearTimeout(likeDebounceRef.current);
|
||||||
|
likeDebounceRef.current = setTimeout(async () => {
|
||||||
|
const prevLiked = isLiked;
|
||||||
|
const prevCount = likeCount;
|
||||||
|
try {
|
||||||
|
await toggleVideoLike(videoId);
|
||||||
|
} catch (err) {
|
||||||
|
// 3. 실패 시 롤백
|
||||||
|
console.error('Failed to toggle like:', err);
|
||||||
|
setIsLiked(prevLiked);
|
||||||
|
setLikeCount(prevCount);
|
||||||
|
}
|
||||||
|
}, 500);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleHeaderAction = () => {
|
||||||
|
if (!isModal && !authed) { setShowLoginModal(true); return; }
|
||||||
|
onClose?.();
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleCommentFocus = () => {
|
||||||
|
if (!authed) setShowLoginModal(true);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleCommentSubmit = async () => {
|
||||||
|
if (!authed) { setShowLoginModal(true); return; }
|
||||||
|
if (!commentInput.trim() || commentSubmitting) return;
|
||||||
|
setCommentSubmitting(true);
|
||||||
|
try {
|
||||||
|
await postVideoComment(videoId, commentInput.trim(), commentNickname);
|
||||||
|
setCommentInput('');
|
||||||
|
if (commentTextareaRef.current) {
|
||||||
|
commentTextareaRef.current.style.height = 'auto';
|
||||||
|
}
|
||||||
|
setCommentNickname('');
|
||||||
|
setCommentAvatarSeedIdx(prev => (prev + 1) % AVATAR_SEEDS.length);
|
||||||
|
await fetchComments(1);
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Failed to post comment:', err);
|
||||||
|
} finally {
|
||||||
|
setCommentSubmitting(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleDeleteComment = async (commentId: number) => {
|
||||||
|
try {
|
||||||
|
await deleteComment(commentId);
|
||||||
|
await fetchComments(commentsPage);
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Failed to delete comment:', err);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const renderCommentContent = (content: string | null, isDeleted: boolean) => {
|
||||||
|
if (isDeleted) return <span style={{ color: '#6B9EA0', fontStyle: 'italic' }}>(삭제된 댓글입니다.)</span>;
|
||||||
|
return content;
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={isModal ? 'video-detail-modal-content' : 'video-detail-page-content'}>
|
||||||
|
{/* 헤더 */}
|
||||||
|
<div className="video-detail-header">
|
||||||
|
{isModal ? (
|
||||||
|
<button className="video-detail-close-btn" onClick={handleHeaderAction} aria-label="닫기">
|
||||||
|
<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
|
||||||
|
<line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/>
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
) : (
|
||||||
|
<button className="video-detail-back-btn" onClick={handleHeaderAction}>
|
||||||
|
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" stroke="currentColor" strokeWidth="1.5">
|
||||||
|
<path d="M13 4l-6 6 6 6"/>
|
||||||
|
</svg>
|
||||||
|
{t('sidebar.ado2Contents')}
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{loading ? (
|
||||||
|
<div className="ado2-contents-loading">
|
||||||
|
<div className="loading-spinner"></div>
|
||||||
|
<p>{t('ado2Contents.loading')}</p>
|
||||||
|
</div>
|
||||||
|
) : error ? (
|
||||||
|
<div className="ado2-contents-error"><p>{error}</p></div>
|
||||||
|
) : video ? (
|
||||||
|
<div className={`video-detail-content ${isLandscape ? 'landscape' : ''}`}>
|
||||||
|
<video
|
||||||
|
src={video.result_movie_url}
|
||||||
|
controls
|
||||||
|
autoPlay
|
||||||
|
controlsList="nodownload"
|
||||||
|
onContextMenu={(e) => e.preventDefault()}
|
||||||
|
className="video-detail-player"
|
||||||
|
onLoadedMetadata={(e) => {
|
||||||
|
const v = e.currentTarget;
|
||||||
|
setIsLandscape(v.videoWidth > v.videoHeight);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div className="video-detail-info">
|
||||||
|
<h2 className="video-detail-store">{video.store_name}</h2>
|
||||||
|
<p className="video-detail-date">{formatDate(video.created_at)}</p>
|
||||||
|
|
||||||
|
{/* 좋아요 + 링크 복사 */}
|
||||||
|
<div style={{ display: 'flex', gap: '8px', flexWrap: 'wrap' }}>
|
||||||
|
<button
|
||||||
|
className={`video-detail-like-btn ${isLiked ? 'liked' : ''}`}
|
||||||
|
onClick={handleLike}
|
||||||
|
disabled={false}
|
||||||
|
>
|
||||||
|
<svg width="16" height="16" viewBox="0 0 24 24" fill={isLiked ? 'currentColor' : 'none'} stroke="currentColor" strokeWidth="2">
|
||||||
|
<path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"/>
|
||||||
|
</svg>
|
||||||
|
{likeCount}
|
||||||
|
</button>
|
||||||
|
<div style={{ position: 'relative' }} ref={shareMenuRef}>
|
||||||
|
<button
|
||||||
|
className="video-detail-copy-btn"
|
||||||
|
onClick={() => setShareMenuOpen(v => !v)}
|
||||||
|
>
|
||||||
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
|
||||||
|
<circle cx="18" cy="5" r="3"/><circle cx="6" cy="12" r="3"/><circle cx="18" cy="19" r="3"/>
|
||||||
|
<line x1="8.59" y1="13.51" x2="15.42" y2="17.49"/><line x1="15.41" y1="6.51" x2="8.59" y2="10.49"/>
|
||||||
|
</svg>
|
||||||
|
{copied ? '복사됨!' : '공유하기'}
|
||||||
|
</button>
|
||||||
|
{shareMenuOpen && (
|
||||||
|
<div className="video-detail-share-menu">
|
||||||
|
{/* 카카오톡 */}
|
||||||
|
<button className="video-detail-share-item" onClick={handleKakaoShare}>
|
||||||
|
<svg width="18" height="18" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<rect width="20" height="20" rx="4" fill="#FEE500"/>
|
||||||
|
<path fillRule="evenodd" clipRule="evenodd" d="M10 3.5C6.134 3.5 3 6.01 3 9.1c0 1.98 1.2 3.72 3.01 4.76l-.74 2.75a.19.19 0 0 0 .28.21l3.37-2.23c.34.04.69.06 1.06.06 3.866 0 7-2.51 7-5.6S13.866 3.5 10 3.5z" fill="#3C1E1E"/>
|
||||||
|
</svg>
|
||||||
|
카카오톡
|
||||||
|
</button>
|
||||||
|
{/* 페이스북 */}
|
||||||
|
<button className="video-detail-share-item" onClick={handleFacebookShare}>
|
||||||
|
<svg width="18" height="18" viewBox="0 0 24 24" fill="#1877F2">
|
||||||
|
<path d="M24 12.073C24 5.405 18.627 0 12 0S0 5.405 0 12.073C0 18.1 4.388 23.094 10.125 24v-8.437H7.078v-3.49h3.047V9.41c0-3.025 1.792-4.697 4.533-4.697 1.312 0 2.686.235 2.686.235v2.97h-1.513c-1.491 0-1.956.93-1.956 1.887v2.268h3.328l-.532 3.49h-2.796V24C19.612 23.094 24 18.1 24 12.073z"/>
|
||||||
|
</svg>
|
||||||
|
페이스북
|
||||||
|
</button>
|
||||||
|
{/* X (트위터) */}
|
||||||
|
<button className="video-detail-share-item" onClick={handleTwitterShare}>
|
||||||
|
<svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor">
|
||||||
|
<path d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"/>
|
||||||
|
</svg>
|
||||||
|
X (트위터)
|
||||||
|
</button>
|
||||||
|
{/* URL 복사 */}
|
||||||
|
<button className="video-detail-share-item" onClick={() => { handleCopyLink(); setShareMenuOpen(false); }}>
|
||||||
|
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
|
||||||
|
<rect x="9" y="9" width="13" height="13" rx="2"/>
|
||||||
|
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/>
|
||||||
|
</svg>
|
||||||
|
{copied ? '복사됨!' : 'URL 복사'}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* 댓글 섹션 */}
|
||||||
|
<div className="video-detail-comments">
|
||||||
|
<div className="video-detail-comments-header">
|
||||||
|
<h3 className="video-detail-comments-title">댓글</h3>
|
||||||
|
<span className="video-detail-comments-count">{commentsTotal}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* 댓글 작성자 프로필 선택 */}
|
||||||
|
{authed && (
|
||||||
|
<div className="video-detail-comment-profile">
|
||||||
|
<img
|
||||||
|
src={`https://api.dicebear.com/9.x/pixel-art/svg?seed=${commentAvatarSeed}`}
|
||||||
|
alt="아바타 변경"
|
||||||
|
className="video-detail-comment-avatar"
|
||||||
|
onClick={handleChangeAvatar}
|
||||||
|
style={{ cursor: 'pointer' }}
|
||||||
|
title="클릭하여 아바타 변경"
|
||||||
|
/>
|
||||||
|
<input
|
||||||
|
className="video-detail-nickname-input"
|
||||||
|
type="text"
|
||||||
|
placeholder="작성자 이름"
|
||||||
|
value={commentNickname}
|
||||||
|
onChange={(e) => setCommentNickname(e.target.value)}
|
||||||
|
maxLength={20}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<div className="video-detail-comment-input-wrap">
|
||||||
|
<textarea
|
||||||
|
ref={commentTextareaRef}
|
||||||
|
className="video-detail-comment-input"
|
||||||
|
placeholder={authed ? '댓글을 입력하세요...' : '로그인 후 댓글을 작성할 수 있습니다'}
|
||||||
|
maxLength={500}
|
||||||
|
rows={1}
|
||||||
|
value={commentInput}
|
||||||
|
onChange={(e) => {
|
||||||
|
setCommentInput(e.target.value);
|
||||||
|
e.target.style.height = 'auto';
|
||||||
|
e.target.style.height = `${e.target.scrollHeight}px`;
|
||||||
|
}}
|
||||||
|
onFocus={handleCommentFocus}
|
||||||
|
onKeyDown={(e) => {
|
||||||
|
if (e.key === 'Enter' && !e.shiftKey) {
|
||||||
|
e.preventDefault();
|
||||||
|
handleCommentSubmit();
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
disabled={!authed}
|
||||||
|
/>
|
||||||
|
<button
|
||||||
|
className="video-detail-comment-submit"
|
||||||
|
onClick={handleCommentSubmit}
|
||||||
|
disabled={!authed || !commentInput.trim() || commentSubmitting}
|
||||||
|
>
|
||||||
|
{commentSubmitting ? '작성 중' : '작성'}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{comments.length === 0 && !commentsLoading ? (
|
||||||
|
<p className="video-detail-comments-empty">아직 댓글이 없습니다.</p>
|
||||||
|
) : (
|
||||||
|
<ul className="video-detail-comment-list">
|
||||||
|
{comments.map((c) => (
|
||||||
|
<li key={c.id} className="video-detail-comment-item">
|
||||||
|
<img
|
||||||
|
src={`https://api.dicebear.com/9.x/pixel-art/svg?seed=${c.id}`}
|
||||||
|
alt="avatar"
|
||||||
|
className="video-detail-comment-avatar"
|
||||||
|
/>
|
||||||
|
<div className="video-detail-comment-body">
|
||||||
|
<span className="video-detail-comment-nickname">
|
||||||
|
{c.nickname || '익명'}
|
||||||
|
</span>
|
||||||
|
<p className="video-detail-comment-text">
|
||||||
|
{renderCommentContent(c.content, c.is_deleted)}
|
||||||
|
</p>
|
||||||
|
<div className="video-detail-comment-bottom">
|
||||||
|
<span className="video-detail-comment-date">{formatCommentDate(c.created_at)}</span>
|
||||||
|
{c.is_mine && !c.is_deleted && (
|
||||||
|
<button
|
||||||
|
className="video-detail-comment-delete"
|
||||||
|
onClick={() => handleDeleteComment(c.id)}
|
||||||
|
>
|
||||||
|
삭제
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* 대댓글 (읽기 전용) */}
|
||||||
|
{c.replies && c.replies.length > 0 && (
|
||||||
|
<ul className="video-detail-reply-list">
|
||||||
|
{c.replies.map((r) => (
|
||||||
|
<li key={r.id} className="video-detail-reply-item">
|
||||||
|
<img
|
||||||
|
src={`https://api.dicebear.com/9.x/pixel-art/svg?seed=${r.id}`}
|
||||||
|
alt="avatar"
|
||||||
|
className="video-detail-comment-avatar small"
|
||||||
|
/>
|
||||||
|
<div className="video-detail-comment-body">
|
||||||
|
<span className="video-detail-comment-nickname">
|
||||||
|
{r.nickname || '익명'}
|
||||||
|
</span>
|
||||||
|
<p className="video-detail-comment-text">
|
||||||
|
{renderCommentContent(r.content, r.is_deleted)}
|
||||||
|
</p>
|
||||||
|
<div className="video-detail-comment-bottom">
|
||||||
|
<span className="video-detail-comment-date">{formatCommentDate(r.created_at)}</span>
|
||||||
|
{r.is_mine && !r.is_deleted && (
|
||||||
|
<button
|
||||||
|
className="video-detail-comment-delete"
|
||||||
|
onClick={() => handleDeleteComment(r.id)}
|
||||||
|
>
|
||||||
|
삭제
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{commentsHasNext && (
|
||||||
|
<button
|
||||||
|
className="video-detail-comments-more"
|
||||||
|
onClick={() => fetchComments(commentsPage + 1, true)}
|
||||||
|
disabled={commentsLoading}
|
||||||
|
>
|
||||||
|
{commentsLoading ? '불러오는 중...' : '댓글 더 보기'}
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{showLoginModal && (
|
||||||
|
<LoginPromptModal onClose={() => setShowLoginModal(false)} />
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default VideoDetailContent;
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
import React, { useEffect } from 'react';
|
||||||
|
import VideoDetailContent from './VideoDetailContent';
|
||||||
|
|
||||||
|
interface VideoDetailModalProps {
|
||||||
|
videoId: string;
|
||||||
|
onClose: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
const VideoDetailModal: React.FC<VideoDetailModalProps> = ({ videoId, onClose }) => {
|
||||||
|
useEffect(() => {
|
||||||
|
// 모달 열릴 때 배경 스크롤 잠금
|
||||||
|
const prev = document.body.style.overflow;
|
||||||
|
document.body.style.overflow = 'hidden';
|
||||||
|
|
||||||
|
const handleKeyDown = (e: KeyboardEvent) => {
|
||||||
|
if (e.key === 'Escape') onClose();
|
||||||
|
};
|
||||||
|
document.addEventListener('keydown', handleKeyDown);
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
document.body.style.overflow = prev;
|
||||||
|
document.removeEventListener('keydown', handleKeyDown);
|
||||||
|
};
|
||||||
|
}, [onClose]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
position: 'fixed',
|
||||||
|
inset: 0,
|
||||||
|
background: 'rgba(0, 0, 0, 0.85)',
|
||||||
|
zIndex: 2000,
|
||||||
|
display: 'flex',
|
||||||
|
overflowY: 'auto',
|
||||||
|
padding: '24px 16px',
|
||||||
|
}}
|
||||||
|
onClick={onClose}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
background: '#01282A',
|
||||||
|
borderRadius: '16px',
|
||||||
|
width: '100%',
|
||||||
|
maxWidth: '900px',
|
||||||
|
margin: 'auto',
|
||||||
|
position: 'relative',
|
||||||
|
}}
|
||||||
|
onClick={(e) => e.stopPropagation()}
|
||||||
|
>
|
||||||
|
<VideoDetailContent videoId={videoId} isModal={true} onClose={onClose} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default VideoDetailModal;
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import VideoDetailContent from './VideoDetailContent';
|
||||||
|
|
||||||
|
interface VideoDetailPageProps {
|
||||||
|
videoId: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const VideoDetailPage: React.FC<VideoDetailPageProps> = ({ videoId }) => {
|
||||||
|
const handleBack = () => {
|
||||||
|
localStorage.setItem('castad_active_item', 'ADO2 콘텐츠');
|
||||||
|
window.location.href = '/';
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="video-detail-page">
|
||||||
|
<VideoDetailContent videoId={videoId} isModal={false} onClose={handleBack} />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default VideoDetailPage;
|
||||||
@@ -4,6 +4,17 @@ import ReactDOM from 'react-dom/client';
|
|||||||
import './i18n';
|
import './i18n';
|
||||||
import App from './App';
|
import App from './App';
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface Window {
|
||||||
|
Kakao: any;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const kakaoKey = import.meta.env.VITE_KAKAO_JS_KEY as string | undefined;
|
||||||
|
if (kakaoKey && window.Kakao && !window.Kakao.isInitialized()) {
|
||||||
|
window.Kakao.init(kakaoKey);
|
||||||
|
}
|
||||||
|
|
||||||
const rootElement = document.getElementById('root');
|
const rootElement = document.getElementById('root');
|
||||||
if (!rootElement) {
|
if (!rootElement) {
|
||||||
throw new Error("Could not find root element to mount to");
|
throw new Error("Could not find root element to mount to");
|
||||||
|
|||||||
+49
-9
@@ -30,6 +30,7 @@
|
|||||||
"intro": { "title": "Welcome to ADO2 Tutorial", "desc": "We'll guide you through ADO2 step by step." },
|
"intro": { "title": "Welcome to ADO2 Tutorial", "desc": "We'll guide you through ADO2 step by step." },
|
||||||
"dropdown": { "title": "Choose Search Type", "desc": "Select URL or business name from the dropdown." },
|
"dropdown": { "title": "Choose Search Type", "desc": "Select URL or business name from the dropdown." },
|
||||||
"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." },
|
||||||
|
"manual": { "title": "Direct Input", "desc": "You can also enter the business name and address manually to start analysis." },
|
||||||
"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." }
|
||||||
},
|
},
|
||||||
"asset": {
|
"asset": {
|
||||||
@@ -95,8 +96,8 @@
|
|||||||
"footer": {
|
"footer": {
|
||||||
"company":"O2O Inc.",
|
"company":"O2O Inc.",
|
||||||
"businessNumber": "Business Registration No. : 620-87-00810 | CEO : Ahn Sungmin",
|
"businessNumber": "Business Registration No. : 620-87-00810 | CEO : Ahn Sungmin",
|
||||||
"headquarters": "HQ : 41593 Unicorn Lab Daegu A05, 5F, 111 Oksan-ro, Buk-gu, Daegu, Korea",
|
"headquarters": "HQ : 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 : 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",
|
"privacyPolicy": "Privacy Policy",
|
||||||
@@ -169,7 +170,17 @@
|
|||||||
"testDataLoading": "Loading...",
|
"testDataLoading": "Loading...",
|
||||||
"testData": "Test Data",
|
"testData": "Test Data",
|
||||||
"testDataLoadFailed": "Failed to load test data.",
|
"testDataLoadFailed": "Failed to load test data.",
|
||||||
"searching": "Searching..."
|
"searching": "Searching...",
|
||||||
|
"searchTypeManual": "Manual Input",
|
||||||
|
"manualModalTitle": "Enter Business Info",
|
||||||
|
"manualLabelName": "Business Name",
|
||||||
|
"manualLabelAddress": "Address",
|
||||||
|
"manualLabelRegion": "Region",
|
||||||
|
"manualLabelDetail": "Detail Address",
|
||||||
|
"manualPlaceholderName": "Enter the business name",
|
||||||
|
"manualPlaceholderAddress": "Enter the address",
|
||||||
|
"manualPlaceholderRegion": "Select a region",
|
||||||
|
"manualPlaceholderDetail": "Enter detail address (e.g. Gangnam-gu Teheran-ro 123)"
|
||||||
},
|
},
|
||||||
"welcome": {
|
"welcome": {
|
||||||
"title": "Welcome to ADO2.AI",
|
"title": "Welcome to ADO2.AI",
|
||||||
@@ -200,7 +211,21 @@
|
|||||||
"searchButton": "Search",
|
"searchButton": "Search",
|
||||||
"searching": "Searching...",
|
"searching": "Searching...",
|
||||||
"testDataLoading": "Loading...",
|
"testDataLoading": "Loading...",
|
||||||
"testData": "Test Data"
|
"testData": "Test Data",
|
||||||
|
"searchTypeManual": "Manual Input",
|
||||||
|
"errorSelectFromList": "Please select a business from the list.",
|
||||||
|
"errorUrlRequired": "Please enter a URL.",
|
||||||
|
"errorNameRequired": "Please enter a business name.",
|
||||||
|
"errorInvalidUrl": "Invalid URL format. (e.g. https://example.com)",
|
||||||
|
"manualModalTitle": "Enter Business Info",
|
||||||
|
"manualLabelName": "Business Name",
|
||||||
|
"manualLabelAddress": "Address",
|
||||||
|
"manualLabelRegion": "Region",
|
||||||
|
"manualLabelDetail": "Detail Address",
|
||||||
|
"manualPlaceholderName": "Enter the business name",
|
||||||
|
"manualPlaceholderAddress": "Enter the address",
|
||||||
|
"manualPlaceholderRegion": "Select a region",
|
||||||
|
"manualPlaceholderDetail": "Enter detail address (e.g. Gangnam-gu Teheran-ro 123)"
|
||||||
},
|
},
|
||||||
"assetManagement": {
|
"assetManagement": {
|
||||||
"title": "Brand Assets",
|
"title": "Brand Assets",
|
||||||
@@ -208,7 +233,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",
|
||||||
@@ -234,6 +259,7 @@
|
|||||||
"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",
|
"regenerateButton": "Regenerate",
|
||||||
"regenerateHint": "Press the regenerate button to create new lyrics and music.",
|
"regenerateHint": "Press the regenerate button to create new lyrics and music.",
|
||||||
@@ -265,6 +291,8 @@
|
|||||||
"titleError": "Video Generation Failed",
|
"titleError": "Video Generation Failed",
|
||||||
"titleComplete": "Content Creation Complete",
|
"titleComplete": "Content Creation Complete",
|
||||||
"imageAndVideo": "Images & Video",
|
"imageAndVideo": "Images & Video",
|
||||||
|
"checkingSubtitle": "Checking subtitle generation status...",
|
||||||
|
"waitingSubtitle": "Generating subtitles...",
|
||||||
"requestingGeneration": "Requesting video generation...",
|
"requestingGeneration": "Requesting video generation...",
|
||||||
"generatingVideo": "Generating video...",
|
"generatingVideo": "Generating video...",
|
||||||
"processingAfterRefresh": "Processing video... (recovered after refresh)",
|
"processingAfterRefresh": "Processing video... (recovered after refresh)",
|
||||||
@@ -306,6 +334,7 @@
|
|||||||
"resolution": "Resolution",
|
"resolution": "Resolution",
|
||||||
"lyrics": "Lyrics",
|
"lyrics": "Lyrics",
|
||||||
"sampleLyrics": "Loading lyrics...",
|
"sampleLyrics": "Loading lyrics...",
|
||||||
|
"noLyricsBGM": "Background music is generated without lyrics.",
|
||||||
"downloading": "Downloading...",
|
"downloading": "Downloading...",
|
||||||
"download": "Download",
|
"download": "Download",
|
||||||
"uploadToSocial": "Upload to Social"
|
"uploadToSocial": "Upload to Social"
|
||||||
@@ -418,7 +447,7 @@
|
|||||||
"title": "My Info",
|
"title": "My Info",
|
||||||
"tabBasic": "Basic Info",
|
"tabBasic": "Basic Info",
|
||||||
"tabPayment": "Payment Info",
|
"tabPayment": "Payment Info",
|
||||||
"tabBusiness": "My Business & Social Channel Management",
|
"tabBusiness": "Social Channel Management",
|
||||||
"basicPlaceholder": "Basic information settings are coming soon.",
|
"basicPlaceholder": "Basic information settings are coming soon.",
|
||||||
"paymentPlaceholder": "Payment information settings are coming soon.",
|
"paymentPlaceholder": "Payment information settings are coming soon.",
|
||||||
"myBusiness": "My Business",
|
"myBusiness": "My Business",
|
||||||
@@ -467,7 +496,14 @@
|
|||||||
"delete": "Delete",
|
"delete": "Delete",
|
||||||
"previous": "Previous",
|
"previous": "Previous",
|
||||||
"next": "Next",
|
"next": "Next",
|
||||||
"uploadToSocial": "Upload to social media"
|
"uploadToSocial": "Upload to social media",
|
||||||
|
"sortLatest": "Latest",
|
||||||
|
"sortOldest": "Oldest",
|
||||||
|
"sortLikes": "Most Liked",
|
||||||
|
"sortComments": "Most Commented",
|
||||||
|
"regionPlaceholder": "Select Region",
|
||||||
|
"searchPlaceholder": "Search by name",
|
||||||
|
"searchBtn": "Search"
|
||||||
},
|
},
|
||||||
"businessSettings": {
|
"businessSettings": {
|
||||||
"title": "Business Settings",
|
"title": "Business Settings",
|
||||||
@@ -542,14 +578,18 @@
|
|||||||
"scheduledCount": "Sched {{count}}",
|
"scheduledCount": "Sched {{count}}",
|
||||||
"failedCount": "Fail {{count}}"
|
"failedCount": "Fail {{count}}"
|
||||||
},
|
},
|
||||||
|
"loginPrompt": {
|
||||||
|
"title": "Login Required",
|
||||||
|
"loginBtn": "Login with Kakao"
|
||||||
|
},
|
||||||
"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. Please enter the URL directly.",
|
"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."
|
||||||
}
|
}
|
||||||
|
|||||||
+50
-10
@@ -30,6 +30,7 @@
|
|||||||
"intro": { "title": "ADO2 튜토리얼 시작", "desc": "ADO2 사용 방법을 단계별로 안내해 드릴게요." },
|
"intro": { "title": "ADO2 튜토리얼 시작", "desc": "ADO2 사용 방법을 단계별로 안내해 드릴게요." },
|
||||||
"dropdown": { "title": "검색 방식 선택", "desc": "드롭다운에서 URL 또는 업체명 중 원하는 방식을 선택하세요." },
|
"dropdown": { "title": "검색 방식 선택", "desc": "드롭다운에서 URL 또는 업체명 중 원하는 방식을 선택하세요." },
|
||||||
"field": { "title": "입력하기", "desc": "URL 방식이라면 네이버 지도 공유 URL,\n업체명 방식이라면 업체명을 입력하고 목록에서 선택하세요." },
|
"field": { "title": "입력하기", "desc": "URL 방식이라면 네이버 지도 공유 URL,\n업체명 방식이라면 업체명을 입력하고 목록에서 선택하세요." },
|
||||||
|
"manual": { "title": "직접 입력", "desc": "업체명과 주소를 직접 입력해서 분석을 시작할 수도 있어요." },
|
||||||
"button": { "title": "브랜드 분석 시작", "desc": "버튼을 누르면 AI가 브랜드를 분석하기 시작해요." }
|
"button": { "title": "브랜드 분석 시작", "desc": "버튼을 누르면 AI가 브랜드를 분석하기 시작해요." }
|
||||||
},
|
},
|
||||||
"asset": {
|
"asset": {
|
||||||
@@ -55,7 +56,7 @@
|
|||||||
},
|
},
|
||||||
"myInfo": {
|
"myInfo": {
|
||||||
"myInfo": { "title": "내 정보", "desc": "내 정보에서는 소셜 연결과 연결된 계정을 확인 할 수 있어요." },
|
"myInfo": { "title": "내 정보", "desc": "내 정보에서는 소셜 연결과 연결된 계정을 확인 할 수 있어요." },
|
||||||
"connect": { "title": "연결하기", "desc": "YouTube 연결 버튼을 누르면 연결 페이지로 이동합니다.", "note": "Instargram 연결은 오픈 예정입니다." },
|
"connect": { "title": "연결하기", "desc": "YouTube 연결 버튼을 누르면 연결 페이지로 이동합니다.", "note": "Instagram 연결은 오픈 예정입니다." },
|
||||||
"connected": { "title": "연결 계정", "desc": "연결된 소셜 계정 목록이에요. \n연결 후 여기서 확인할 수 있어요." },
|
"connected": { "title": "연결 계정", "desc": "연결된 소셜 계정 목록이에요. \n연결 후 여기서 확인할 수 있어요." },
|
||||||
"ado2": { "title": "ADO2 콘텐츠", "desc": "이제 생성된 영상을 업로드할 수 있어요. \n클릭해서 이동하세요." }
|
"ado2": { "title": "ADO2 콘텐츠", "desc": "이제 생성된 영상을 업로드할 수 있어요. \n클릭해서 이동하세요." }
|
||||||
},
|
},
|
||||||
@@ -95,8 +96,8 @@
|
|||||||
"footer": {
|
"footer": {
|
||||||
"company":"㈜에이아이오투오",
|
"company":"㈜에이아이오투오",
|
||||||
"businessNumber": "사업자 등록번호 : 620-87-00810 | 대표 : 안성민",
|
"businessNumber": "사업자 등록번호 : 620-87-00810 | 대표 : 안성민",
|
||||||
"headquarters": "본사 : 41593 대구광역시 북구 옥산로 111, 5층 유니콘랩 대구 A05호",
|
"headquarters": "본사 : 대구광역시 북구 옥산로 111, 5층 유니콘랩 대구 A05호",
|
||||||
"researchCenter": "연구소 : 13453 경기 성남시 수정구 금토로 32 (금토동) (주)KT 판교빌딩 504호~505호 (East)",
|
"researchCenter": "연구소 : 경기 성남시 수정구 금토로 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": "개인정보처리방침",
|
"privacyPolicy": "개인정보처리방침",
|
||||||
@@ -169,7 +170,17 @@
|
|||||||
"testDataLoading": "로딩 중...",
|
"testDataLoading": "로딩 중...",
|
||||||
"testData": "테스트 데이터",
|
"testData": "테스트 데이터",
|
||||||
"testDataLoadFailed": "테스트 데이터를 불러오는데 실패했습니다.",
|
"testDataLoadFailed": "테스트 데이터를 불러오는데 실패했습니다.",
|
||||||
"searching": "검색 중..."
|
"searching": "검색 중...",
|
||||||
|
"searchTypeManual": "직접 입력",
|
||||||
|
"manualModalTitle": "업체 정보 입력",
|
||||||
|
"manualLabelName": "업체명",
|
||||||
|
"manualLabelAddress": "주소",
|
||||||
|
"manualLabelRegion": "지역",
|
||||||
|
"manualLabelDetail": "상세 주소",
|
||||||
|
"manualPlaceholderName": "업체명을 입력하세요.",
|
||||||
|
"manualPlaceholderAddress": "주소를 입력하세요.",
|
||||||
|
"manualPlaceholderRegion": "지역을 선택하세요.",
|
||||||
|
"manualPlaceholderDetail": "상세 주소를 입력하세요. (예: 강남구 테헤란로 123)"
|
||||||
},
|
},
|
||||||
"welcome": {
|
"welcome": {
|
||||||
"title": "ADO2.AI에 오신 것을 환영합니다.",
|
"title": "ADO2.AI에 오신 것을 환영합니다.",
|
||||||
@@ -200,7 +211,21 @@
|
|||||||
"searchButton": "검색하기",
|
"searchButton": "검색하기",
|
||||||
"searching": "검색 중...",
|
"searching": "검색 중...",
|
||||||
"testDataLoading": "로딩 중...",
|
"testDataLoading": "로딩 중...",
|
||||||
"testData": "테스트 데이터"
|
"testData": "테스트 데이터",
|
||||||
|
"searchTypeManual": "직접 입력",
|
||||||
|
"errorSelectFromList": "목록에서 업체를 선택해 주세요.",
|
||||||
|
"errorUrlRequired": "URL을 입력해주세요.",
|
||||||
|
"errorNameRequired": "업체명을 입력해주세요.",
|
||||||
|
"errorInvalidUrl": "올바른 URL 형식이 아닙니다. (예: https://example.com)",
|
||||||
|
"manualModalTitle": "업체 정보 입력",
|
||||||
|
"manualLabelName": "업체명",
|
||||||
|
"manualLabelAddress": "주소",
|
||||||
|
"manualLabelRegion": "지역",
|
||||||
|
"manualLabelDetail": "상세 주소",
|
||||||
|
"manualPlaceholderName": "업체명을 입력하세요.",
|
||||||
|
"manualPlaceholderAddress": "주소를 입력하세요.",
|
||||||
|
"manualPlaceholderRegion": "지역을 선택하세요.",
|
||||||
|
"manualPlaceholderDetail": "상세 주소를 입력하세요. (예: 강남구 테헤란로 123)"
|
||||||
},
|
},
|
||||||
"assetManagement": {
|
"assetManagement": {
|
||||||
"title": "브랜드 에셋",
|
"title": "브랜드 에셋",
|
||||||
@@ -208,7 +233,7 @@
|
|||||||
"imageAlt": "이미지",
|
"imageAlt": "이미지",
|
||||||
"uploadBadge": "업로드",
|
"uploadBadge": "업로드",
|
||||||
"imageUpload": "이미지 업로드",
|
"imageUpload": "이미지 업로드",
|
||||||
"dragAndDrop": "이미지를 드래그하여\n업로드",
|
"dragAndDrop": "이미지를 끌어다 놓거나\n클릭하여 업로드",
|
||||||
"videoRatio": "영상 비율",
|
"videoRatio": "영상 비율",
|
||||||
"minImages": "최소 5장",
|
"minImages": "최소 5장",
|
||||||
"youtubeShorts": "유튜브 쇼츠",
|
"youtubeShorts": "유튜브 쇼츠",
|
||||||
@@ -234,6 +259,7 @@
|
|||||||
"lyricsColumn": "가사",
|
"lyricsColumn": "가사",
|
||||||
"lyricsHint": "가사 영역을 선택해서 수정 가능해요",
|
"lyricsHint": "가사 영역을 선택해서 수정 가능해요",
|
||||||
"lyricsPlaceholder": "사운드 생성 시 가사 표시됩니다.",
|
"lyricsPlaceholder": "사운드 생성 시 가사 표시됩니다.",
|
||||||
|
"lyricsPlaceholderBGM": "배경음악은 가사 없이 생성됩니다.",
|
||||||
"generateButton": "사운드 생성",
|
"generateButton": "사운드 생성",
|
||||||
"regenerateButton": "재생성 하기",
|
"regenerateButton": "재생성 하기",
|
||||||
"regenerateHint": "재생성 버튼을 누르면 가사와 음악을 다시 만들 수 있어요.",
|
"regenerateHint": "재생성 버튼을 누르면 가사와 음악을 다시 만들 수 있어요.",
|
||||||
@@ -265,6 +291,8 @@
|
|||||||
"titleError": "영상 생성 실패",
|
"titleError": "영상 생성 실패",
|
||||||
"titleComplete": "콘텐츠 제작 완료",
|
"titleComplete": "콘텐츠 제작 완료",
|
||||||
"imageAndVideo": "이미지 및 영상",
|
"imageAndVideo": "이미지 및 영상",
|
||||||
|
"checkingSubtitle": "자막 생성 상태를 확인하고 있습니다...",
|
||||||
|
"waitingSubtitle": "자막을 생성하고 있습니다...",
|
||||||
"requestingGeneration": "영상 생성을 요청하고 있습니다...",
|
"requestingGeneration": "영상 생성을 요청하고 있습니다...",
|
||||||
"generatingVideo": "영상을 생성하고 있습니다...",
|
"generatingVideo": "영상을 생성하고 있습니다...",
|
||||||
"processingAfterRefresh": "영상을 처리하고 있습니다... (새로고침 후 복구됨)",
|
"processingAfterRefresh": "영상을 처리하고 있습니다... (새로고침 후 복구됨)",
|
||||||
@@ -306,6 +334,7 @@
|
|||||||
"resolution": "규격",
|
"resolution": "규격",
|
||||||
"lyrics": "가사",
|
"lyrics": "가사",
|
||||||
"sampleLyrics": "가사를 불러오는 중...",
|
"sampleLyrics": "가사를 불러오는 중...",
|
||||||
|
"noLyricsBGM": "배경음악은 가사 없이 생성됩니다.",
|
||||||
"downloading": "다운로드 중...",
|
"downloading": "다운로드 중...",
|
||||||
"download": "다운로드",
|
"download": "다운로드",
|
||||||
"uploadToSocial": "소셜 채널 업로드"
|
"uploadToSocial": "소셜 채널 업로드"
|
||||||
@@ -418,7 +447,7 @@
|
|||||||
"title": "내 정보",
|
"title": "내 정보",
|
||||||
"tabBasic": "기본 정보",
|
"tabBasic": "기본 정보",
|
||||||
"tabPayment": "결제 정보",
|
"tabPayment": "결제 정보",
|
||||||
"tabBusiness": "내 비즈니스 & 소셜 채널 관리",
|
"tabBusiness": "소셜 채널 관리",
|
||||||
"basicPlaceholder": "기본 정보 설정 기능이 준비 중입니다.",
|
"basicPlaceholder": "기본 정보 설정 기능이 준비 중입니다.",
|
||||||
"paymentPlaceholder": "결제 정보 설정 기능이 준비 중입니다.",
|
"paymentPlaceholder": "결제 정보 설정 기능이 준비 중입니다.",
|
||||||
"myBusiness": "내 비즈니스",
|
"myBusiness": "내 비즈니스",
|
||||||
@@ -467,7 +496,14 @@
|
|||||||
"delete": "삭제",
|
"delete": "삭제",
|
||||||
"previous": "이전",
|
"previous": "이전",
|
||||||
"next": "다음",
|
"next": "다음",
|
||||||
"uploadToSocial": "소셜 미디어에 업로드"
|
"uploadToSocial": "소셜 미디어에 업로드",
|
||||||
|
"sortLatest": "최신순",
|
||||||
|
"sortOldest": "오래된순",
|
||||||
|
"sortLikes": "좋아요 많은순",
|
||||||
|
"sortComments": "댓글 많은순",
|
||||||
|
"regionPlaceholder": "지역 선택",
|
||||||
|
"searchPlaceholder": "업체명 검색",
|
||||||
|
"searchBtn": "검색"
|
||||||
},
|
},
|
||||||
"businessSettings": {
|
"businessSettings": {
|
||||||
"title": "비즈니스 설정",
|
"title": "비즈니스 설정",
|
||||||
@@ -542,14 +578,18 @@
|
|||||||
"scheduledCount": "예약 {{count}}",
|
"scheduledCount": "예약 {{count}}",
|
||||||
"failedCount": "실패 {{count}}"
|
"failedCount": "실패 {{count}}"
|
||||||
},
|
},
|
||||||
|
"loginPrompt": {
|
||||||
|
"title": "로그인이 필요합니다.",
|
||||||
|
"loginBtn": "로그인"
|
||||||
|
},
|
||||||
"app": {
|
"app": {
|
||||||
"loginProcessing": "로그인 처리 중...",
|
"loginProcessing": "로그인 처리 중...",
|
||||||
"loginFailed": "로그인 처리에 실패했습니다. 다시 시도해주세요.",
|
"loginFailed": "로그인 처리에 실패했습니다. 다시 시도해주세요.",
|
||||||
"kakaoLoginFailed": "카카오 로그인에 실패했습니다. 다시 시도해주세요.",
|
"kakaoLoginFailed": "카카오 로그인에 실패했습니다. 다시 시도해주세요.",
|
||||||
"loginUrlFailed": "로그인 URL을 가져오는데 실패했습니다. 다시 시도해주세요.",
|
"loginUrlFailed": "로그인 URL을 가져오는데 실패했습니다. 다시 시도해주세요.",
|
||||||
"invalidUrl": "유효하지 않은 URL입니다. 네이버 지도 URL을 입력해주세요.",
|
"invalidUrl": "유효하지 않은 URL입니다. 네이버 지도 URL을 입력해주세요.",
|
||||||
"analysisError": "분석 중 오류가 발생했습니다. 다시 시도해주세요.",
|
"analysisError": "검색 정보를 찾을 수 없습니다. 입력 정보를 다시 확인해주세요.",
|
||||||
"autocompleteError": "업체 정보 조회에 실패했습니다. URL을 직접 입력해주세요.",
|
"autocompleteError": "검색 정보를 찾을 수 없습니다. 입력 정보를 다시 확인해주세요.",
|
||||||
"autocompleteGeneralError": "업체 정보 조회 중 오류가 발생했습니다. 다시 시도해주세요.",
|
"autocompleteGeneralError": "업체 정보 조회 중 오류가 발생했습니다. 다시 시도해주세요.",
|
||||||
"pageComingSoon": "{{page}} 페이지 준비 중입니다."
|
"pageComingSoon": "{{page}} 페이지 준비 중입니다."
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ const LoadingSection: React.FC<LoadingSectionProps> = ({ onComplete, isComplete
|
|||||||
<div className="loading-content">
|
<div className="loading-content">
|
||||||
{/* Logo */}
|
{/* Logo */}
|
||||||
<div className="loading-logo">
|
<div className="loading-logo">
|
||||||
<img src="/assets/images/ado2-loading-logo.svg" alt="ADO2" />
|
<img src="/assets/images/ADO2_with Slogan_white.svg" alt="ADO2" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Loading Spinner and Text */}
|
{/* Loading Spinner and Text */}
|
||||||
|
|||||||
@@ -1,149 +1,127 @@
|
|||||||
|
|
||||||
import React, { useState, useEffect } from 'react';
|
import React, { useState, useEffect } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { getVideosList, deleteVideo } from '../../utils/api';
|
import { getAllVideos, isLoggedIn } from '../../utils/api';
|
||||||
import { VideoListItem } from '../../types/api';
|
import { VideoListItem } from '../../types/api';
|
||||||
import SocialPostingModal from '../../components/SocialPostingModal';
|
import LoginPromptModal from '../../components/LoginPromptModal';
|
||||||
|
import VideoDetailModal from '../../components/VideoDetailModal';
|
||||||
|
import CitySelectModal from '../../components/CitySelectModal';
|
||||||
|
|
||||||
interface ADO2ContentsPageProps {
|
interface ADO2ContentsPageProps {
|
||||||
onBack: () => void;
|
onBack?: () => void;
|
||||||
onNavigate?: (item: string) => void;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const ADO2ContentsPage: React.FC<ADO2ContentsPageProps> = ({ onBack, onNavigate }) => {
|
const ADO2ContentsPage: React.FC<ADO2ContentsPageProps> = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
const authed = isLoggedIn();
|
||||||
|
const [selectedVideoId, setSelectedVideoId] = useState<number | null>(null);
|
||||||
const [videos, setVideos] = useState<VideoListItem[]>([]);
|
const [videos, setVideos] = useState<VideoListItem[]>([]);
|
||||||
const [total, setTotal] = useState(0);
|
const [total, setTotal] = useState(0);
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(authed);
|
||||||
const [error, setError] = useState<string | null>(null);
|
const [error, setError] = useState<string | null>(null);
|
||||||
const [page, setPage] = useState(1);
|
const [page, setPage] = useState(1);
|
||||||
const [hasNext, setHasNext] = useState(false);
|
const [hasNext, setHasNext] = useState(false);
|
||||||
const [hasPrev, setHasPrev] = useState(false);
|
const [hasPrev, setHasPrev] = useState(false);
|
||||||
const [totalPages, setTotalPages] = useState(1);
|
const [totalPages, setTotalPages] = useState(1);
|
||||||
const [deleteModalOpen, setDeleteModalOpen] = useState(false);
|
|
||||||
const [deleteTargetId, setDeleteTargetId] = useState<number | null>(null);
|
|
||||||
const [isDeleting, setIsDeleting] = useState(false);
|
|
||||||
const [uploadModalOpen, setUploadModalOpen] = useState(false);
|
|
||||||
const [uploadTargetVideo, setUploadTargetVideo] = useState<VideoListItem | null>(null);
|
|
||||||
|
|
||||||
const pageSize = 12;
|
const pageSize = 20;
|
||||||
|
const [sortBy, setSortBy] = useState<'created_at' | 'like_count' | 'comment_count'>('created_at');
|
||||||
|
const [order, setOrder] = useState<'desc' | 'asc'>('desc');
|
||||||
|
const [searchInput, setSearchInput] = useState('');
|
||||||
|
const [storeName, setStoreName] = useState('');
|
||||||
|
const [region, setRegion] = useState('');
|
||||||
|
const [showCityModal, setShowCityModal] = useState(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (!authed) return;
|
||||||
fetchVideos();
|
fetchVideos();
|
||||||
}, [page]);
|
}, [page, sortBy, order, storeName, region]);
|
||||||
|
|
||||||
const fetchVideos = async () => {
|
const fetchVideos = async () => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
setError(null);
|
setError(null);
|
||||||
try {
|
try {
|
||||||
const response = await getVideosList(page, pageSize);
|
const response = await getAllVideos(page, pageSize, sortBy, storeName, order, region);
|
||||||
console.log('[ADO2] API response:', response);
|
setVideos(response.items);
|
||||||
console.log('[ADO2] First video item:', response.items[0]);
|
|
||||||
// result_movie_url이 있는 비디오만 필터링 (빈/더미 데이터 제외)
|
|
||||||
const validVideos = response.items.filter(video => video.result_movie_url && video.result_movie_url.trim() !== '');
|
|
||||||
setVideos(validVideos);
|
|
||||||
setTotal(response.total);
|
setTotal(response.total);
|
||||||
setTotalPages(response.total_pages);
|
setTotalPages(response.total_pages);
|
||||||
setHasNext(response.has_next);
|
setHasNext(response.has_next);
|
||||||
setHasPrev(response.has_prev);
|
setHasPrev(response.has_prev);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Failed to fetch videos:', err);
|
console.error('Failed to fetch all videos:', err);
|
||||||
setError(t('ado2Contents.loadFailed'));
|
setError(t('ado2Contents.loadFailed'));
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleCardClick = (videoId: number) => {
|
||||||
|
setSelectedVideoId(videoId);
|
||||||
|
};
|
||||||
|
|
||||||
const formatDate = (dateString: string) => {
|
const formatDate = (dateString: string) => {
|
||||||
const date = new Date(dateString);
|
const date = new Date(dateString);
|
||||||
const year = date.getFullYear();
|
const year = date.getFullYear();
|
||||||
const month = String(date.getMonth() + 1).padStart(2, '0');
|
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||||
const day = String(date.getDate()).padStart(2, '0');
|
const day = String(date.getDate()).padStart(2, '0');
|
||||||
const hours = String(date.getHours()).padStart(2, '0');
|
return `${year}.${month}.${day}`;
|
||||||
const minutes = String(date.getMinutes()).padStart(2, '0');
|
|
||||||
return `${year}.${month}.${day}・${hours}:${minutes}`;
|
|
||||||
};
|
|
||||||
|
|
||||||
const formatTitle = (storeName: string, dateString: string) => {
|
|
||||||
const date = new Date(dateString);
|
|
||||||
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
||||||
const day = String(date.getDate()).padStart(2, '0');
|
|
||||||
const hours = String(date.getHours()).padStart(2, '0');
|
|
||||||
const minutes = String(date.getMinutes()).padStart(2, '0');
|
|
||||||
return `${storeName} ${month}/${day} ${hours}:${minutes}`;
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleDownload = async (videoUrl: string, storeName: string) => {
|
|
||||||
try {
|
|
||||||
const response = await fetch(videoUrl);
|
|
||||||
const blob = await response.blob();
|
|
||||||
const url = window.URL.createObjectURL(blob);
|
|
||||||
const a = document.createElement('a');
|
|
||||||
a.href = url;
|
|
||||||
a.download = `${storeName}.mp4`;
|
|
||||||
document.body.appendChild(a);
|
|
||||||
a.click();
|
|
||||||
window.URL.revokeObjectURL(url);
|
|
||||||
document.body.removeChild(a);
|
|
||||||
} catch (err) {
|
|
||||||
console.error('Download failed:', err);
|
|
||||||
alert(t('ado2Contents.downloadFailed'));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleDeleteClick = (videoId: number) => {
|
|
||||||
setDeleteTargetId(videoId);
|
|
||||||
setDeleteModalOpen(true);
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleUploadClick = (video: VideoListItem) => {
|
|
||||||
console.log('[ADO2] Upload clicked - video object:', video);
|
|
||||||
console.log('[ADO2] video.video_id:', video.video_id);
|
|
||||||
setUploadTargetVideo(video);
|
|
||||||
setUploadModalOpen(true);
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleUploadModalClose = () => {
|
|
||||||
setUploadModalOpen(false);
|
|
||||||
setUploadTargetVideo(null);
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleDeleteCancel = () => {
|
|
||||||
setDeleteModalOpen(false);
|
|
||||||
setDeleteTargetId(null);
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleDeleteConfirm = async () => {
|
|
||||||
if (!deleteTargetId) return;
|
|
||||||
setIsDeleting(true);
|
|
||||||
try {
|
|
||||||
await deleteVideo(deleteTargetId);
|
|
||||||
|
|
||||||
// 삭제 성공 시 로컬 상태에서 즉시 제거 (UI 즉시 반영)
|
|
||||||
// fetchVideos()를 호출하지 않음 - 서버 캐시 또는 동기화 지연으로 인해
|
|
||||||
// 삭제된 항목이 다시 나타날 수 있기 때문
|
|
||||||
setVideos(prev => prev.filter(video => video.video_id !== deleteTargetId));
|
|
||||||
setTotal(prev => Math.max(0, prev - 1));
|
|
||||||
|
|
||||||
setDeleteModalOpen(false);
|
|
||||||
setDeleteTargetId(null);
|
|
||||||
} catch (err) {
|
|
||||||
console.error('Delete failed:', err);
|
|
||||||
alert(t('ado2Contents.deleteFailed'));
|
|
||||||
} finally {
|
|
||||||
setIsDeleting(false);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="ado2-contents-page">
|
<div className="ado2-contents-page">
|
||||||
{/* Header */}
|
|
||||||
<div className="ado2-contents-header">
|
<div className="ado2-contents-header">
|
||||||
<h1 className="ado2-contents-title">{t('ado2Contents.title')}</h1>
|
<h1 className="ado2-contents-title">{t('sidebar.ado2Contents')}</h1>
|
||||||
<span className="ado2-contents-count">{t('ado2Contents.totalCount', { count: total })}</span>
|
<span className="ado2-contents-count">{t('ado2Contents.totalCount', { count: total })}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Content Grid */}
|
<div className="ado2-contents-filters">
|
||||||
|
<select
|
||||||
|
className="ado2-filter-select"
|
||||||
|
value={`${sortBy}__${order}`}
|
||||||
|
onChange={(e) => {
|
||||||
|
const [sb, ord] = e.target.value.split('__') as [typeof sortBy, typeof order];
|
||||||
|
setSortBy(sb);
|
||||||
|
setOrder(ord);
|
||||||
|
setPage(1);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<option value="created_at__desc">{t('ado2Contents.sortLatest')}</option>
|
||||||
|
<option value="created_at__asc">{t('ado2Contents.sortOldest')}</option>
|
||||||
|
<option value="like_count__desc">{t('ado2Contents.sortLikes')}</option>
|
||||||
|
<option value="comment_count__desc">{t('ado2Contents.sortComments')}</option>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className={`ado2-region-pill ${region ? 'active' : ''}`}
|
||||||
|
onClick={() => setShowCityModal(true)}
|
||||||
|
>
|
||||||
|
{region || t('ado2Contents.regionPlaceholder')}
|
||||||
|
{region && (
|
||||||
|
<span className="ado2-region-clear" onClick={(e) => { e.stopPropagation(); setRegion(''); setPage(1); }}>✕</span>
|
||||||
|
)}
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<form
|
||||||
|
className="ado2-filter-search"
|
||||||
|
onSubmit={(e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
setStoreName(searchInput);
|
||||||
|
setPage(1);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
className="ado2-filter-input"
|
||||||
|
value={searchInput}
|
||||||
|
onChange={(e) => setSearchInput(e.target.value)}
|
||||||
|
placeholder={t('ado2Contents.searchPlaceholder')}
|
||||||
|
/>
|
||||||
|
<button type="submit" className="ado2-filter-btn">
|
||||||
|
{t('ado2Contents.searchBtn')}
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
{loading ? (
|
{loading ? (
|
||||||
<div className="ado2-contents-loading">
|
<div className="ado2-contents-loading">
|
||||||
<div className="loading-spinner"></div>
|
<div className="loading-spinner"></div>
|
||||||
@@ -162,89 +140,64 @@ const ADO2ContentsPage: React.FC<ADO2ContentsPageProps> = ({ onBack, onNavigate
|
|||||||
<>
|
<>
|
||||||
<div className="ado2-contents-grid">
|
<div className="ado2-contents-grid">
|
||||||
{videos.map((video) => (
|
{videos.map((video) => (
|
||||||
<div key={video.task_id} className="ado2-content-card">
|
<div
|
||||||
{/* Video Thumbnail */}
|
key={video.video_id}
|
||||||
<div className="content-card-thumbnail">
|
className="ado2-content-card"
|
||||||
{video.result_movie_url ? (
|
style={{ cursor: 'pointer' }}
|
||||||
|
onClick={() => handleCardClick(video.video_id)}
|
||||||
|
role="button"
|
||||||
|
tabIndex={0}
|
||||||
|
onKeyDown={(e) => e.key === 'Enter' && handleCardClick(video.video_id)}
|
||||||
|
>
|
||||||
|
<div className="content-card-thumbnail ado2-gallery-thumbnail-wrap">
|
||||||
|
{video.thumbnail_url ? (
|
||||||
|
<img
|
||||||
|
src={video.thumbnail_url}
|
||||||
|
alt={video.store_name}
|
||||||
|
style={{ width: '100%', height: '100%', objectFit: 'cover' }}
|
||||||
|
/>
|
||||||
|
) : video.result_movie_url ? (
|
||||||
<video
|
<video
|
||||||
src={video.result_movie_url}
|
src={video.result_movie_url}
|
||||||
className="content-video-preview"
|
className="content-video-preview"
|
||||||
|
preload="metadata"
|
||||||
muted
|
muted
|
||||||
playsInline
|
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" />
|
||||||
<svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5">
|
)}
|
||||||
<rect x="2" y="2" width="20" height="20" rx="2.18" ry="2.18"/>
|
{/* 호버 오버레이 */}
|
||||||
<line x1="7" y1="2" x2="7" y2="22"/>
|
<div className="ado2-gallery-overlay">
|
||||||
<line x1="17" y1="2" x2="17" y2="22"/>
|
<div className="ado2-gallery-play-btn">
|
||||||
<line x1="2" y1="12" x2="22" y2="12"/>
|
<svg width="28" height="28" viewBox="0 0 24 24" fill="currentColor">
|
||||||
<line x1="2" y1="7" x2="7" y2="7"/>
|
<polygon points="5,3 19,12 5,21"/>
|
||||||
<line x1="2" y1="17" x2="7" y2="17"/>
|
|
||||||
<line x1="17" y1="17" x2="22" y2="17"/>
|
|
||||||
<line x1="17" y1="7" x2="22" y2="7"/>
|
|
||||||
</svg>
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
)}
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Card Info */}
|
|
||||||
<div className="content-card-info">
|
<div className="content-card-info">
|
||||||
<div className="content-card-text">
|
<div className="content-card-text">
|
||||||
<h3 className="content-card-title">
|
<h3 className="content-card-title">{video.store_name}</h3>
|
||||||
{formatTitle(video.store_name, video.created_at)}
|
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
|
||||||
</h3>
|
<p className="content-card-date">{formatDate(video.created_at)}</p>
|
||||||
<p className="content-card-date">
|
<span className="content-card-like">
|
||||||
{formatDate(video.created_at)}
|
<svg width="15" height="15" viewBox="0 0 24 24" fill="currentColor" stroke="currentColor" strokeWidth="2">
|
||||||
</p>
|
<path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"/>
|
||||||
</div>
|
</svg>
|
||||||
|
{video.like_count ?? 0}
|
||||||
{/* Action Buttons */}
|
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" style={{ marginLeft: '6px' }}>
|
||||||
<div className="content-card-actions">
|
<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/>
|
||||||
<button
|
</svg>
|
||||||
className="content-download-btn"
|
{video.comment_count ?? 0}
|
||||||
onClick={() => handleUploadClick(video)}
|
</span>
|
||||||
disabled={!video.result_movie_url}
|
</div>
|
||||||
>
|
|
||||||
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" stroke="currentColor" strokeWidth="1.5">
|
|
||||||
<path d="M10 13V3M10 3l-4 4M10 3l4 4"/>
|
|
||||||
<path d="M3 15v2h14v-2"/>
|
|
||||||
</svg>
|
|
||||||
<span>{t('ado2Contents.uploadToSocial')}</span>
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
className="content-upload-btn"
|
|
||||||
onClick={() => handleDownload(video.result_movie_url, video.store_name)}
|
|
||||||
disabled={!video.result_movie_url}
|
|
||||||
title={t('ado2Contents.download')}
|
|
||||||
>
|
|
||||||
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" stroke="currentColor" strokeWidth="1.5">
|
|
||||||
<path d="M10 3v10M10 13l-4-4M10 13l4-4"/>
|
|
||||||
<path d="M3 15v2h14v-2"/>
|
|
||||||
</svg>
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
className="content-delete-btn"
|
|
||||||
onClick={() => handleDeleteClick(video.video_id)}
|
|
||||||
>
|
|
||||||
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" stroke="currentColor" strokeWidth="1.5">
|
|
||||||
<path d="M3 5h14M8 5V3h4v2M6 5v12h8V5"/>
|
|
||||||
<line x1="8" y1="8" x2="8" y2="14"/>
|
|
||||||
<line x1="12" y1="8" x2="12" y2="14"/>
|
|
||||||
</svg>
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Pagination - 항상 표시 */}
|
|
||||||
<div className="ado2-contents-pagination">
|
<div className="ado2-contents-pagination">
|
||||||
<button
|
<button
|
||||||
className="pagination-btn"
|
className="pagination-btn"
|
||||||
@@ -265,39 +218,24 @@ const ADO2ContentsPage: React.FC<ADO2ContentsPageProps> = ({ onBack, onNavigate
|
|||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* 삭제 확인 모달 */}
|
{!authed && (
|
||||||
{deleteModalOpen && (
|
<LoginPromptModal onClose={() => { window.location.href = '/'; }} />
|
||||||
<div className="delete-modal-overlay" onClick={handleDeleteCancel}>
|
|
||||||
<div className="delete-modal" onClick={(e: React.MouseEvent) => e.stopPropagation()}>
|
|
||||||
<h2 className="delete-modal-title">{t('ado2Contents.deleteConfirmTitle')}</h2>
|
|
||||||
<p className="delete-modal-description">{t('ado2Contents.deleteConfirmDesc')}</p>
|
|
||||||
<div className="delete-modal-actions">
|
|
||||||
<button
|
|
||||||
className="delete-modal-btn cancel"
|
|
||||||
onClick={handleDeleteCancel}
|
|
||||||
disabled={isDeleting}
|
|
||||||
>
|
|
||||||
{t('ado2Contents.cancel')}
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
className="delete-modal-btn confirm"
|
|
||||||
onClick={handleDeleteConfirm}
|
|
||||||
disabled={isDeleting}
|
|
||||||
>
|
|
||||||
{isDeleting ? t('ado2Contents.deleting') : t('ado2Contents.delete')}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* 소셜 미디어 업로드 모달 */}
|
{selectedVideoId !== null && (
|
||||||
<SocialPostingModal
|
<VideoDetailModal
|
||||||
isOpen={uploadModalOpen}
|
videoId={String(selectedVideoId)}
|
||||||
onClose={handleUploadModalClose}
|
onClose={() => setSelectedVideoId(null)}
|
||||||
video={uploadTargetVideo}
|
/>
|
||||||
onGoToCalendar={onNavigate ? () => onNavigate('콘텐츠 캘린더') : undefined}
|
)}
|
||||||
/>
|
|
||||||
|
{showCityModal && (
|
||||||
|
<CitySelectModal
|
||||||
|
selected={region}
|
||||||
|
onSelect={(city) => { setRegion(city); setPage(1); }}
|
||||||
|
onClose={() => setShowCityModal(false)}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
import React, { useState, useEffect, useRef } from 'react';
|
import React, { useState, useEffect, useRef } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { generateVideo, waitForVideoComplete } from '../../utils/api';
|
import { generateVideo, waitForVideoComplete, getSubtitleStatus, waitForSubtitleComplete } from '../../utils/api';
|
||||||
import SocialPostingModal from '../../components/SocialPostingModal';
|
import SocialPostingModal from '../../components/SocialPostingModal';
|
||||||
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';
|
||||||
@@ -174,10 +174,19 @@ const CompletionContent: React.FC<CompletionContentProps> = ({
|
|||||||
|
|
||||||
hasStartedGeneration.current = true;
|
hasStartedGeneration.current = true;
|
||||||
setVideoStatus('generating');
|
setVideoStatus('generating');
|
||||||
setStatusMessage(t('completion.requestingGeneration'));
|
setStatusMessage(t('completion.checkingSubtitle'));
|
||||||
setErrorMessage(null);
|
setErrorMessage(null);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// 자막 완료 여부 확인 후 미완료면 폴링
|
||||||
|
const subtitleStatus = await getSubtitleStatus(songTaskId);
|
||||||
|
if (subtitleStatus.status !== 'completed') {
|
||||||
|
setStatusMessage(t('completion.waitingSubtitle'));
|
||||||
|
await waitForSubtitleComplete(songTaskId);
|
||||||
|
}
|
||||||
|
|
||||||
|
setStatusMessage(t('completion.requestingGeneration'));
|
||||||
|
|
||||||
const savedRatio = localStorage.getItem('castad_video_ratio');
|
const savedRatio = localStorage.getItem('castad_video_ratio');
|
||||||
const orientation = (savedRatio === 'horizontal' || savedRatio === 'vertical') ? savedRatio : 'vertical';
|
const orientation = (savedRatio === 'horizontal' || savedRatio === 'vertical') ? savedRatio : 'vertical';
|
||||||
|
|
||||||
@@ -483,9 +492,33 @@ const CompletionContent: React.FC<CompletionContentProps> = ({
|
|||||||
<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')}</span>
|
<span className="comp2-meta-label">{t('completion.lyrics')}</span>
|
||||||
<p className="comp2-lyrics-text">
|
{(() => {
|
||||||
{songCompletionData?.lyrics || t('completion.sampleLyrics')}
|
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 outro = lines.slice(-1);
|
||||||
|
const body = lines.slice(0, -1);
|
||||||
|
const half = Math.ceil(body.length / 2);
|
||||||
|
const sections = [
|
||||||
|
{ tag: '[Verse]', lines: body.slice(0, half) },
|
||||||
|
{ tag: '[Chorus]', lines: body.slice(half) },
|
||||||
|
{ tag: '[Outro]', lines: outro },
|
||||||
|
].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>
|
||||||
@@ -522,6 +555,8 @@ const CompletionContent: React.FC<CompletionContentProps> = ({
|
|||||||
task_id: songTaskId || '',
|
task_id: songTaskId || '',
|
||||||
result_movie_url: videoUrl,
|
result_movie_url: videoUrl,
|
||||||
created_at: new Date().toISOString(),
|
created_at: new Date().toISOString(),
|
||||||
|
like_count: 0,
|
||||||
|
comment_count: 0,
|
||||||
} : null}
|
} : null}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|||||||
@@ -553,7 +553,7 @@ const ContentCalendarContent: React.FC<ContentCalendarContentProps> = ({ onNavig
|
|||||||
<PlatformIcon platform={item.platform} size={16} />
|
<PlatformIcon platform={item.platform} size={16} />
|
||||||
<span style={{
|
<span style={{
|
||||||
fontFamily: 'Pretendard, sans-serif', fontWeight: 500, fontSize: 12,
|
fontFamily: 'Pretendard, sans-serif', fontWeight: 500, fontSize: 12,
|
||||||
color: '#9bcacc', lineHeight: 1,
|
color: '#9bcacc', lineHeight: 1.4,
|
||||||
overflow: 'hidden', whiteSpace: 'nowrap', textOverflow: 'ellipsis',
|
overflow: 'hidden', whiteSpace: 'nowrap', textOverflow: 'ellipsis',
|
||||||
}}>
|
}}>
|
||||||
{item.platform_username || item.platform_user_id || item.channel_name}
|
{item.platform_username || item.platform_user_id || item.channel_name}
|
||||||
|
|||||||
@@ -9,12 +9,13 @@ import DashboardContent from './DashboardContent';
|
|||||||
import BusinessSettingsContent from './BusinessSettingsContent';
|
import BusinessSettingsContent from './BusinessSettingsContent';
|
||||||
import UrlInputContent from './UrlInputContent';
|
import UrlInputContent from './UrlInputContent';
|
||||||
import ADO2ContentsPage from './ADO2ContentsPage';
|
import ADO2ContentsPage from './ADO2ContentsPage';
|
||||||
|
import MyContentsPage from './MyContentsPage';
|
||||||
import MyInfoContent from './MyInfoContent';
|
import MyInfoContent from './MyInfoContent';
|
||||||
import ContentCalendarContent from './ContentCalendarContent';
|
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, getUserCredits, clearTokens } from '../../utils/api';
|
import { crawlUrl, autocomplete, marketingAnalysis, 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';
|
||||||
@@ -130,6 +131,13 @@ const GenerationFlow: React.FC<GenerationFlowProps> = ({
|
|||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
// 사운드 스튜디오, 영상 완성 진입 시 크레딧 갱신
|
||||||
|
useEffect(() => {
|
||||||
|
if (wizardStep === 2 || wizardStep === 3) {
|
||||||
|
refreshCredits();
|
||||||
|
}
|
||||||
|
}, [wizardStep]);
|
||||||
|
|
||||||
// 로그인 직후 사용자 정보 + 크레딧 조회
|
// 로그인 직후 사용자 정보 + 크레딧 조회
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchUserInfo = async () => {
|
const fetchUserInfo = async () => {
|
||||||
@@ -248,12 +256,38 @@ const GenerationFlow: React.FC<GenerationFlowProps> = ({
|
|||||||
setIsAnalysisComplete(true);
|
setIsAnalysisComplete(true);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Autocomplete error:', err);
|
console.error('Autocomplete error:', err);
|
||||||
const msg = err instanceof Error ? err.message : '';
|
setAnalysisError(t('app.autocompleteError'));
|
||||||
setAnalysisError(/^HTTP error!/.test(msg) ? t('app.autocompleteError') : (msg || t('app.autocompleteError')));
|
|
||||||
goToWizardStep(-2); // URL 입력으로 돌아가기
|
goToWizardStep(-2); // URL 입력으로 돌아가기
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 업체명·주소 수동 입력으로 마케팅 분석 API 호출
|
||||||
|
const handleManualInput = async (businessName: string, address: string) => {
|
||||||
|
goToWizardStep(-1);
|
||||||
|
setIsAnalysisComplete(false);
|
||||||
|
setAnalysisError(null);
|
||||||
|
|
||||||
|
try {
|
||||||
|
const data = await marketingAnalysis(businessName, address);
|
||||||
|
|
||||||
|
if (data.processed_info) {
|
||||||
|
data.processed_info.customer_name = data.processed_info.customer_name || businessName;
|
||||||
|
data.processed_info.region = data.processed_info.region || '';
|
||||||
|
data.processed_info.detail_region_info = data.processed_info.detail_region_info || '';
|
||||||
|
}
|
||||||
|
data.image_list = data.image_list || [];
|
||||||
|
|
||||||
|
setAnalysisData(data);
|
||||||
|
localStorage.setItem(ANALYSIS_DATA_KEY, JSON.stringify(data));
|
||||||
|
saveSearchHistory({ type: 'name', value: businessName, address, roadAddress: address });
|
||||||
|
setIsAnalysisComplete(true);
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Marketing analysis error:', err);
|
||||||
|
setAnalysisError(t('app.autocompleteError'));
|
||||||
|
goToWizardStep(-2);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// 테스트용 랜덤 m_id 생성 (99 ~ 300)
|
// 테스트용 랜덤 m_id 생성 (99 ~ 300)
|
||||||
const generateRandomMId = (): number => {
|
const generateRandomMId = (): number => {
|
||||||
return Math.floor(Math.random() * (300 - 99 + 1)) + 99;
|
return Math.floor(Math.random() * (300 - 99 + 1)) + 99;
|
||||||
@@ -318,8 +352,7 @@ const GenerationFlow: React.FC<GenerationFlowProps> = ({
|
|||||||
setIsAnalysisComplete(true);
|
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 입력으로 돌아가기
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -359,7 +392,7 @@ const GenerationFlow: React.FC<GenerationFlowProps> = ({
|
|||||||
if (tutorial.isActive) tutorial.skipTutorial();
|
if (tutorial.isActive) tutorial.skipTutorial();
|
||||||
if (activeItem === '내 정보' && !tutorial.hasSeen(TUTORIAL_KEYS.MY_INFO)) {
|
if (activeItem === '내 정보' && !tutorial.hasSeen(TUTORIAL_KEYS.MY_INFO)) {
|
||||||
tutorial.startTutorial(TUTORIAL_KEYS.MY_INFO);
|
tutorial.startTutorial(TUTORIAL_KEYS.MY_INFO);
|
||||||
} else if (activeItem === 'ADO2 콘텐츠' && !tutorial.hasSeen(TUTORIAL_KEYS.ADO2_CONTENTS)) {
|
} else if (activeItem === '내 콘텐츠' && !tutorial.hasSeen(TUTORIAL_KEYS.ADO2_CONTENTS)) {
|
||||||
tutorial.startTutorial(TUTORIAL_KEYS.ADO2_CONTENTS);
|
tutorial.startTutorial(TUTORIAL_KEYS.ADO2_CONTENTS);
|
||||||
} else if (activeItem === '대시보드' && !tutorial.hasSeen(TUTORIAL_KEYS.DASHBOARD)) {
|
} else if (activeItem === '대시보드' && !tutorial.hasSeen(TUTORIAL_KEYS.DASHBOARD)) {
|
||||||
tutorial.startTutorial(TUTORIAL_KEYS.DASHBOARD);
|
tutorial.startTutorial(TUTORIAL_KEYS.DASHBOARD);
|
||||||
@@ -405,6 +438,7 @@ const GenerationFlow: React.FC<GenerationFlowProps> = ({
|
|||||||
<UrlInputContent
|
<UrlInputContent
|
||||||
onAnalyze={handleStartAnalysis}
|
onAnalyze={handleStartAnalysis}
|
||||||
onAutocomplete={handleAutocomplete}
|
onAutocomplete={handleAutocomplete}
|
||||||
|
onManualInput={handleManualInput}
|
||||||
onTestData={handleTestData}
|
onTestData={handleTestData}
|
||||||
error={analysisError}
|
error={analysisError}
|
||||||
/>
|
/>
|
||||||
@@ -504,8 +538,10 @@ const GenerationFlow: React.FC<GenerationFlowProps> = ({
|
|||||||
case '비즈니스 설정':
|
case '비즈니스 설정':
|
||||||
return <BusinessSettingsContent />;
|
return <BusinessSettingsContent />;
|
||||||
case 'ADO2 콘텐츠':
|
case 'ADO2 콘텐츠':
|
||||||
|
return <ADO2ContentsPage />;
|
||||||
|
case '내 콘텐츠':
|
||||||
return (
|
return (
|
||||||
<ADO2ContentsPage
|
<MyContentsPage
|
||||||
onBack={() => setActiveItem('새 프로젝트 만들기')}
|
onBack={() => setActiveItem('새 프로젝트 만들기')}
|
||||||
onNavigate={handleNavigate}
|
onNavigate={handleNavigate}
|
||||||
/>
|
/>
|
||||||
@@ -539,12 +575,12 @@ const GenerationFlow: React.FC<GenerationFlowProps> = ({
|
|||||||
// 브랜드 분석(0)일 때는 전체 페이지 스크롤
|
// 브랜드 분석(0)일 때는 전체 페이지 스크롤
|
||||||
const isBrandAnalysis = activeItem === '새 프로젝트 만들기' && wizardStep === 0;
|
const isBrandAnalysis = activeItem === '새 프로젝트 만들기' && wizardStep === 0;
|
||||||
// 스크롤이 필요한 페이지: 대시보드, 비즈니스 설정, 브랜드 분석(0), ADO2 콘텐츠, 내 정보
|
// 스크롤이 필요한 페이지: 대시보드, 비즈니스 설정, 브랜드 분석(0), ADO2 콘텐츠, 내 정보
|
||||||
const needsScroll = activeItem === '대시보드' || activeItem === '비즈니스 설정' || activeItem === 'ADO2 콘텐츠' || activeItem === '내 정보' || activeItem === '콘텐츠 캘린더' || isBrandAnalysis;
|
const needsScroll = activeItem === '대시보드' || activeItem === '비즈니스 설정' || activeItem === 'ADO2 콘텐츠' || activeItem === '내 콘텐츠' || activeItem === '내 정보' || activeItem === '콘텐츠 캘린더' || isBrandAnalysis;
|
||||||
|
|
||||||
// 현재 화면에 맞는 튜토리얼 키 반환 (없으면 null)
|
// 현재 화면에 맞는 튜토리얼 키 반환 (없으면 null)
|
||||||
const getCurrentTutorialKey = (): string | null => {
|
const getCurrentTutorialKey = (): string | null => {
|
||||||
if (activeItem === '내 정보') return TUTORIAL_KEYS.MY_INFO;
|
if (activeItem === '내 정보') return TUTORIAL_KEYS.MY_INFO;
|
||||||
if (activeItem === 'ADO2 콘텐츠') return TUTORIAL_KEYS.ADO2_CONTENTS;
|
if (activeItem === '내 콘텐츠') return TUTORIAL_KEYS.ADO2_CONTENTS;
|
||||||
if (activeItem === '대시보드') return TUTORIAL_KEYS.DASHBOARD;
|
if (activeItem === '대시보드') return TUTORIAL_KEYS.DASHBOARD;
|
||||||
if (activeItem === '콘텐츠 캘린더') return TUTORIAL_KEYS.CONTENT_CALENDAR;
|
if (activeItem === '콘텐츠 캘린더') return TUTORIAL_KEYS.CONTENT_CALENDAR;
|
||||||
if (activeItem === '새 프로젝트 만들기') {
|
if (activeItem === '새 프로젝트 만들기') {
|
||||||
@@ -596,7 +632,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} credits={credits} />
|
<Sidebar activeItem={activeItem} onNavigate={handleNavigate} onHome={handleHome} userInfo={userInfo} onLogout={handleLogout} credits={credits} tutorialAvailable={!!getCurrentTutorialKey()} tutorialEnabled={tutorial.isEnabled} onToggleTutorial={() => tutorial.toggleTutorial(getCurrentTutorialKey())} />
|
||||||
)}
|
)}
|
||||||
<main className="analysis-page-main">
|
<main className="analysis-page-main">
|
||||||
{renderContent()}
|
{renderContent()}
|
||||||
@@ -609,7 +645,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} credits={credits} />
|
<Sidebar activeItem={activeItem} onNavigate={handleNavigate} onHome={handleHome} userInfo={userInfo} onLogout={handleLogout} credits={credits} tutorialAvailable={!!getCurrentTutorialKey()} tutorialEnabled={tutorial.isEnabled} onToggleTutorial={() => tutorial.toggleTutorial(getCurrentTutorialKey())} />
|
||||||
)}
|
)}
|
||||||
{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'}`}>
|
||||||
|
|||||||
@@ -0,0 +1,399 @@
|
|||||||
|
|
||||||
|
import React, { useState, useEffect, useRef, useCallback } from 'react';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import { getVideosList, deleteVideo } from '../../utils/api';
|
||||||
|
import { VideoListItem } from '../../types/api';
|
||||||
|
import SocialPostingModal from '../../components/SocialPostingModal';
|
||||||
|
import VideoDetailModal from '../../components/VideoDetailModal';
|
||||||
|
import { useTutorial } from '../../components/Tutorial/useTutorial';
|
||||||
|
import { TUTORIAL_KEYS } from '../../components/Tutorial/tutorialSteps';
|
||||||
|
|
||||||
|
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 MyContentsPageProps {
|
||||||
|
onBack?: () => void;
|
||||||
|
onNavigate?: (item: string) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
const MyContentsPage: React.FC<MyContentsPageProps> = ({ onNavigate }) => {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const tutorial = useTutorial();
|
||||||
|
const [videos, setVideos] = useState<VideoListItem[]>([]);
|
||||||
|
const [total, setTotal] = useState(0);
|
||||||
|
const [loading, setLoading] = useState(true);
|
||||||
|
const [error, setError] = useState<string | null>(null);
|
||||||
|
const [page, setPage] = useState(1);
|
||||||
|
const [hasNext, setHasNext] = useState(false);
|
||||||
|
const [hasPrev, setHasPrev] = useState(false);
|
||||||
|
const [totalPages, setTotalPages] = useState(1);
|
||||||
|
const [deleteModalOpen, setDeleteModalOpen] = useState(false);
|
||||||
|
const [deleteTargetId, setDeleteTargetId] = useState<number | null>(null);
|
||||||
|
const [isDeleting, setIsDeleting] = useState(false);
|
||||||
|
const [uploadModalOpen, setUploadModalOpen] = useState(false);
|
||||||
|
const [uploadTargetVideo, setUploadTargetVideo] = useState<VideoListItem | null>(null);
|
||||||
|
const [selectedVideoId, setSelectedVideoId] = useState<number | null>(null);
|
||||||
|
|
||||||
|
const pageSize = 12;
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
fetchVideos();
|
||||||
|
}, [page]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!tutorial.hasSeen(TUTORIAL_KEYS.ADO2_CONTENTS)) {
|
||||||
|
tutorial.startTutorial(TUTORIAL_KEYS.ADO2_CONTENTS);
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const fetchVideos = async () => {
|
||||||
|
setLoading(true);
|
||||||
|
setError(null);
|
||||||
|
try {
|
||||||
|
const response = await getVideosList(page, pageSize);
|
||||||
|
const validVideos = response.items.filter(video => video.result_movie_url && video.result_movie_url.trim() !== '');
|
||||||
|
setVideos(validVideos);
|
||||||
|
setTotal(response.total);
|
||||||
|
setTotalPages(response.total_pages);
|
||||||
|
setHasNext(response.has_next);
|
||||||
|
setHasPrev(response.has_prev);
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Failed to fetch videos:', err);
|
||||||
|
setError(t('ado2Contents.loadFailed'));
|
||||||
|
} finally {
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const formatDate = (dateString: string) => {
|
||||||
|
const date = new Date(dateString);
|
||||||
|
const year = date.getFullYear();
|
||||||
|
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||||
|
const day = String(date.getDate()).padStart(2, '0');
|
||||||
|
const hours = String(date.getHours()).padStart(2, '0');
|
||||||
|
const minutes = String(date.getMinutes()).padStart(2, '0');
|
||||||
|
return `${year}.${month}.${day}・${hours}:${minutes}`;
|
||||||
|
};
|
||||||
|
|
||||||
|
const formatTitle = (storeName: string, dateString: string) => {
|
||||||
|
const date = new Date(dateString);
|
||||||
|
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||||
|
const day = String(date.getDate()).padStart(2, '0');
|
||||||
|
const hours = String(date.getHours()).padStart(2, '0');
|
||||||
|
const minutes = String(date.getMinutes()).padStart(2, '0');
|
||||||
|
return `${storeName} ${month}/${day} ${hours}:${minutes}`;
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleDownload = async (videoUrl: string, storeName: string) => {
|
||||||
|
try {
|
||||||
|
const response = await fetch(videoUrl);
|
||||||
|
const blob = await response.blob();
|
||||||
|
const url = window.URL.createObjectURL(blob);
|
||||||
|
const a = document.createElement('a');
|
||||||
|
a.href = url;
|
||||||
|
a.download = `${storeName}.mp4`;
|
||||||
|
document.body.appendChild(a);
|
||||||
|
a.click();
|
||||||
|
window.URL.revokeObjectURL(url);
|
||||||
|
document.body.removeChild(a);
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Download failed:', err);
|
||||||
|
alert(t('ado2Contents.downloadFailed'));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleDeleteClick = (videoId: number) => {
|
||||||
|
setDeleteTargetId(videoId);
|
||||||
|
setDeleteModalOpen(true);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleUploadClick = (video: VideoListItem) => {
|
||||||
|
setUploadTargetVideo(video);
|
||||||
|
setUploadModalOpen(true);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleUploadModalClose = () => {
|
||||||
|
setUploadModalOpen(false);
|
||||||
|
setUploadTargetVideo(null);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleDeleteCancel = () => {
|
||||||
|
setDeleteModalOpen(false);
|
||||||
|
setDeleteTargetId(null);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleDeleteConfirm = async () => {
|
||||||
|
if (!deleteTargetId) return;
|
||||||
|
setIsDeleting(true);
|
||||||
|
try {
|
||||||
|
await deleteVideo(deleteTargetId);
|
||||||
|
setVideos(prev => prev.filter(video => video.video_id !== deleteTargetId));
|
||||||
|
setTotal(prev => Math.max(0, prev - 1));
|
||||||
|
setDeleteModalOpen(false);
|
||||||
|
setDeleteTargetId(null);
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Delete failed:', err);
|
||||||
|
alert(t('ado2Contents.deleteFailed'));
|
||||||
|
} finally {
|
||||||
|
setIsDeleting(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="ado2-contents-page">
|
||||||
|
{/* Header */}
|
||||||
|
<div className="ado2-contents-header">
|
||||||
|
<h1 className="ado2-contents-title">{t('sidebar.myContents')}</h1>
|
||||||
|
<span className="ado2-contents-count">{t('ado2Contents.totalCount', { count: total })}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Content Grid */}
|
||||||
|
{loading ? (
|
||||||
|
<div className="ado2-contents-loading">
|
||||||
|
<div className="loading-spinner"></div>
|
||||||
|
<p>{t('ado2Contents.loading')}</p>
|
||||||
|
</div>
|
||||||
|
) : error ? (
|
||||||
|
<div className="ado2-contents-error">
|
||||||
|
<p>{error}</p>
|
||||||
|
<button onClick={fetchVideos} className="retry-btn">{t('ado2Contents.retry')}</button>
|
||||||
|
</div>
|
||||||
|
) : videos.length === 0 ? (
|
||||||
|
<div className="ado2-contents-empty">
|
||||||
|
<p>{t('ado2Contents.noContent')}</p>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
<div className="ado2-contents-grid">
|
||||||
|
{videos.map((video) => (
|
||||||
|
<div key={video.task_id} className="ado2-content-card">
|
||||||
|
{/* Video Thumbnail */}
|
||||||
|
<div
|
||||||
|
className="content-card-thumbnail"
|
||||||
|
style={{ cursor: 'pointer' }}
|
||||||
|
onClick={() => setSelectedVideoId(video.video_id)}
|
||||||
|
>
|
||||||
|
{video.result_movie_url ? (
|
||||||
|
<VideoPreviewCard
|
||||||
|
src={video.result_movie_url}
|
||||||
|
className="content-video-preview"
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<div className="content-no-video">
|
||||||
|
<svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5">
|
||||||
|
<rect x="2" y="2" width="20" height="20" rx="2.18" ry="2.18"/>
|
||||||
|
<line x1="7" y1="2" x2="7" y2="22"/>
|
||||||
|
<line x1="17" y1="2" x2="17" y2="22"/>
|
||||||
|
<line x1="2" y1="12" x2="22" y2="12"/>
|
||||||
|
<line x1="2" y1="7" x2="7" y2="7"/>
|
||||||
|
<line x1="2" y1="17" x2="7" y2="17"/>
|
||||||
|
<line x1="17" y1="17" x2="22" y2="17"/>
|
||||||
|
<line x1="17" y1="7" x2="22" y2="7"/>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Card Info */}
|
||||||
|
<div className="content-card-info">
|
||||||
|
<div className="content-card-text">
|
||||||
|
<h3 className="content-card-title">
|
||||||
|
{formatTitle(video.store_name, video.created_at)}
|
||||||
|
</h3>
|
||||||
|
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
|
||||||
|
<p className="content-card-date">
|
||||||
|
{formatDate(video.created_at)}
|
||||||
|
</p>
|
||||||
|
<span className="content-card-like">
|
||||||
|
<svg width="15" height="15" viewBox="0 0 24 24" fill="currentColor" stroke="currentColor" strokeWidth="2">
|
||||||
|
<path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"/>
|
||||||
|
</svg>
|
||||||
|
{video.like_count ?? 0}
|
||||||
|
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" style={{ marginLeft: '6px' }}>
|
||||||
|
<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>
|
||||||
|
{video.comment_count ?? 0}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Action Buttons */}
|
||||||
|
<div className="content-card-actions">
|
||||||
|
<button
|
||||||
|
className="content-download-btn"
|
||||||
|
onClick={() => handleUploadClick(video)}
|
||||||
|
disabled={!video.result_movie_url}
|
||||||
|
>
|
||||||
|
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" stroke="currentColor" strokeWidth="1.5">
|
||||||
|
<path d="M10 13V3M10 3l-4 4M10 3l4 4"/>
|
||||||
|
<path d="M3 15v2h14v-2"/>
|
||||||
|
</svg>
|
||||||
|
<span>{t('ado2Contents.uploadToSocial')}</span>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
className="content-upload-btn"
|
||||||
|
onClick={() => handleDownload(video.result_movie_url, video.store_name)}
|
||||||
|
disabled={!video.result_movie_url}
|
||||||
|
title={t('ado2Contents.download')}
|
||||||
|
>
|
||||||
|
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" stroke="currentColor" strokeWidth="1.5">
|
||||||
|
<path d="M10 3v10M10 13l-4-4M10 13l4-4"/>
|
||||||
|
<path d="M3 15v2h14v-2"/>
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
className="content-delete-btn"
|
||||||
|
onClick={() => handleDeleteClick(video.video_id)}
|
||||||
|
>
|
||||||
|
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" stroke="currentColor" strokeWidth="1.5">
|
||||||
|
<path d="M3 5h14M8 5V3h4v2M6 5v12h8V5"/>
|
||||||
|
<line x1="8" y1="8" x2="8" y2="14"/>
|
||||||
|
<line x1="12" y1="8" x2="12" y2="14"/>
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Pagination */}
|
||||||
|
<div className="ado2-contents-pagination">
|
||||||
|
<button
|
||||||
|
className="pagination-btn"
|
||||||
|
onClick={() => setPage(p => p - 1)}
|
||||||
|
disabled={!hasPrev}
|
||||||
|
>
|
||||||
|
{t('ado2Contents.previous')}
|
||||||
|
</button>
|
||||||
|
<span className="pagination-info">{page} / {totalPages}</span>
|
||||||
|
<button
|
||||||
|
className="pagination-btn"
|
||||||
|
onClick={() => setPage(p => p + 1)}
|
||||||
|
disabled={!hasNext}
|
||||||
|
>
|
||||||
|
{t('ado2Contents.next')}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{/* 삭제 확인 모달 */}
|
||||||
|
{deleteModalOpen && (
|
||||||
|
<div className="delete-modal-overlay" onClick={handleDeleteCancel}>
|
||||||
|
<div className="delete-modal" onClick={(e: React.MouseEvent) => e.stopPropagation()}>
|
||||||
|
<h2 className="delete-modal-title">{t('ado2Contents.deleteConfirmTitle')}</h2>
|
||||||
|
<p className="delete-modal-description">{t('ado2Contents.deleteConfirmDesc')}</p>
|
||||||
|
<div className="delete-modal-actions">
|
||||||
|
<button
|
||||||
|
className="delete-modal-btn cancel"
|
||||||
|
onClick={handleDeleteCancel}
|
||||||
|
disabled={isDeleting}
|
||||||
|
>
|
||||||
|
{t('ado2Contents.cancel')}
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
className="delete-modal-btn confirm"
|
||||||
|
onClick={handleDeleteConfirm}
|
||||||
|
disabled={isDeleting}
|
||||||
|
>
|
||||||
|
{isDeleting ? t('ado2Contents.deleting') : t('ado2Contents.delete')}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{selectedVideoId !== null && (
|
||||||
|
<VideoDetailModal
|
||||||
|
videoId={String(selectedVideoId)}
|
||||||
|
onClose={() => setSelectedVideoId(null)}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{/* 소셜 미디어 업로드 모달 */}
|
||||||
|
<SocialPostingModal
|
||||||
|
isOpen={uploadModalOpen}
|
||||||
|
onClose={handleUploadModalClose}
|
||||||
|
video={uploadTargetVideo}
|
||||||
|
onGoToCalendar={onNavigate ? () => onNavigate('콘텐츠 캘린더') : undefined}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default MyContentsPage;
|
||||||
@@ -113,7 +113,7 @@ const MyInfoContent: React.FC<MyInfoContentProps> = ({ initialTab }) => {
|
|||||||
const hasConnectedAccounts = youtubeAccounts.length > 0 || instagramAccounts.length > 0;
|
const hasConnectedAccounts = youtubeAccounts.length > 0 || instagramAccounts.length > 0;
|
||||||
|
|
||||||
const tabs = [
|
const tabs = [
|
||||||
{ id: 'basic' as TabType, label: t('myInfo.tabBasic') },
|
// { id: 'basic' as TabType, label: t('myInfo.tabBasic') },
|
||||||
{ id: 'payment' as TabType, label: t('myInfo.tabPayment') },
|
{ id: 'payment' as TabType, label: t('myInfo.tabPayment') },
|
||||||
{ id: 'business' as TabType, label: t('myInfo.tabBusiness') },
|
{ id: 'business' as TabType, label: t('myInfo.tabBusiness') },
|
||||||
];
|
];
|
||||||
@@ -205,11 +205,11 @@ const MyInfoContent: React.FC<MyInfoContentProps> = ({ initialTab }) => {
|
|||||||
|
|
||||||
{/* 탭 컨텐츠 */}
|
{/* 탭 컨텐츠 */}
|
||||||
<div className="myinfo-content">
|
<div className="myinfo-content">
|
||||||
{activeTab === 'basic' && (
|
{/* {activeTab === 'basic' && (
|
||||||
<div className="myinfo-section">
|
<div className="myinfo-section">
|
||||||
<p className="myinfo-placeholder">{t('myInfo.basicPlaceholder')}</p>
|
<p className="myinfo-placeholder">{t('myInfo.basicPlaceholder')}</p>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)} */}
|
||||||
|
|
||||||
{activeTab === 'payment' && (
|
{activeTab === 'payment' && (
|
||||||
<div className="myinfo-section">
|
<div className="myinfo-section">
|
||||||
@@ -240,7 +240,7 @@ const MyInfoContent: React.FC<MyInfoContentProps> = ({ initialTab }) => {
|
|||||||
|
|
||||||
{activeTab === 'business' && (
|
{activeTab === 'business' && (
|
||||||
<>
|
<>
|
||||||
{/* 내 비즈니스 섹션 */}
|
{/* 내 비즈니스 섹션
|
||||||
<div className="myinfo-section">
|
<div className="myinfo-section">
|
||||||
<h2 className="myinfo-section-title">{t('myInfo.myBusiness')}</h2>
|
<h2 className="myinfo-section-title">{t('myInfo.myBusiness')}</h2>
|
||||||
<div className="myinfo-business-card">
|
<div className="myinfo-business-card">
|
||||||
@@ -261,7 +261,7 @@ const MyInfoContent: React.FC<MyInfoContentProps> = ({ initialTab }) => {
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div> */}
|
||||||
|
|
||||||
{/* 소셜 채널 섹션 */}
|
{/* 소셜 채널 섹션 */}
|
||||||
<div className="myinfo-section">
|
<div className="myinfo-section">
|
||||||
|
|||||||
@@ -26,6 +26,19 @@ type GenerationStatus = 'idle' | 'generating_lyric' | 'generating_song' | 'polli
|
|||||||
|
|
||||||
const MAX_RETRY_COUNT = 3;
|
const MAX_RETRY_COUNT = 3;
|
||||||
|
|
||||||
|
const sanitizeError = (message: string, fallback: string): string => {
|
||||||
|
if (
|
||||||
|
message.includes('Traceback') ||
|
||||||
|
message.includes('File "/') ||
|
||||||
|
message.includes('httpx.') ||
|
||||||
|
message.includes('httpcore.') ||
|
||||||
|
message.length > 200
|
||||||
|
) {
|
||||||
|
return fallback;
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
};
|
||||||
|
|
||||||
const LANGUAGE_FLAGS: Record<string, string> = {
|
const LANGUAGE_FLAGS: Record<string, string> = {
|
||||||
'한국어': '🇰🇷',
|
'한국어': '🇰🇷',
|
||||||
'English': '🇺🇸',
|
'English': '🇺🇸',
|
||||||
@@ -131,7 +144,10 @@ const SoundStudioContent: React.FC<SoundStudioContentProps> = ({
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
setStatus('error');
|
setStatus('error');
|
||||||
setErrorMessage(error instanceof Error ? error.message : t('soundStudio.musicGenerationError'));
|
setErrorMessage(sanitizeError(
|
||||||
|
error instanceof Error ? error.message : '',
|
||||||
|
t('soundStudio.musicGenerationError')
|
||||||
|
));
|
||||||
setRetryCount(0);
|
setRetryCount(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -153,10 +169,10 @@ const SoundStudioContent: React.FC<SoundStudioContentProps> = ({
|
|||||||
'ROCK': 'rock',
|
'ROCK': 'rock',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const isInstrumental = selectedType === '배경음악';
|
||||||
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: currentLyrics }),
|
||||||
lyrics: currentLyrics,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!songResponse.success) {
|
if (!songResponse.success) {
|
||||||
@@ -168,7 +184,10 @@ const SoundStudioContent: React.FC<SoundStudioContentProps> = ({
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Song regeneration failed:', error);
|
console.error('Song regeneration failed:', error);
|
||||||
setStatus('error');
|
setStatus('error');
|
||||||
setErrorMessage(error instanceof Error ? error.message : t('soundStudio.songRegenerationError'));
|
setErrorMessage(sanitizeError(
|
||||||
|
error instanceof Error ? error.message : '',
|
||||||
|
t('soundStudio.songRegenerationError')
|
||||||
|
));
|
||||||
setRetryCount(0);
|
setRetryCount(0);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -276,6 +295,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);
|
||||||
@@ -287,37 +307,13 @@ 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'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 가사 생성 상태 폴링 → 완료 시 상세 조회
|
|
||||||
setStatusMessage(t('soundStudio.generatingLyrics'));
|
|
||||||
const lyricDetailResponse = await waitForLyricComplete(
|
|
||||||
lyricResponse.task_id,
|
|
||||||
(status: string) => {
|
|
||||||
if (status === 'processing') {
|
|
||||||
setStatusMessage(t('soundStudio.generatingLyrics'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!lyricDetailResponse.lyric_result) {
|
|
||||||
throw new Error(t('soundStudio.lyricNotReceived'));
|
|
||||||
}
|
|
||||||
|
|
||||||
// "I'm sorry" 체크
|
|
||||||
if (lyricDetailResponse.lyric_result.includes("I'm sorry")) {
|
|
||||||
throw new Error(t('soundStudio.lyricGenerationError'));
|
|
||||||
}
|
|
||||||
|
|
||||||
setLyrics(lyricDetailResponse.lyric_result);
|
|
||||||
|
|
||||||
setStatus('generating_song');
|
|
||||||
setStatusMessage(t('soundStudio.generatingSong'));
|
|
||||||
|
|
||||||
const genreMap: Record<string, string> = {
|
const genreMap: Record<string, string> = {
|
||||||
'자동 선택': 'pop',
|
'자동 선택': 'pop',
|
||||||
'K-POP': 'kpop',
|
'K-POP': 'kpop',
|
||||||
@@ -329,10 +325,39 @@ const SoundStudioContent: React.FC<SoundStudioContentProps> = ({
|
|||||||
'ROCK': 'rock',
|
'ROCK': 'rock',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let songLyrics: string | undefined;
|
||||||
|
|
||||||
|
if (!isInstrumental) {
|
||||||
|
// 2. 가사 생성 상태 폴링 → 완료 시 상세 조회
|
||||||
|
setStatusMessage(t('soundStudio.generatingLyrics'));
|
||||||
|
const lyricDetailResponse = await waitForLyricComplete(
|
||||||
|
lyricResponse.task_id,
|
||||||
|
(status: string) => {
|
||||||
|
if (status === 'processing') {
|
||||||
|
setStatusMessage(t('soundStudio.generatingLyrics'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!lyricDetailResponse.lyric_result) {
|
||||||
|
throw new Error(t('soundStudio.lyricNotReceived'));
|
||||||
|
}
|
||||||
|
|
||||||
|
// "I'm sorry" 체크
|
||||||
|
if (lyricDetailResponse.lyric_result.includes("I'm sorry")) {
|
||||||
|
throw new Error(t('soundStudio.lyricGenerationError'));
|
||||||
|
}
|
||||||
|
|
||||||
|
setLyrics(lyricDetailResponse.lyric_result);
|
||||||
|
songLyrics = lyricDetailResponse.lyric_result;
|
||||||
|
}
|
||||||
|
|
||||||
|
setStatus('generating_song');
|
||||||
|
setStatusMessage(t('soundStudio.generatingSong'));
|
||||||
|
|
||||||
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) {
|
||||||
@@ -351,12 +376,15 @@ 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);
|
||||||
setStatus('error');
|
setStatus('error');
|
||||||
setErrorMessage(error instanceof Error ? error.message : t('soundStudio.musicGenerationError'));
|
setErrorMessage(sanitizeError(
|
||||||
|
error instanceof Error ? error.message : '',
|
||||||
|
t('soundStudio.musicGenerationError')
|
||||||
|
));
|
||||||
setRetryCount(0);
|
setRetryCount(0);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -383,7 +411,14 @@ const SoundStudioContent: React.FC<SoundStudioContentProps> = ({
|
|||||||
<>
|
<>
|
||||||
<main className="sound-studio-page">
|
<main className="sound-studio-page">
|
||||||
{audioUrl && (
|
{audioUrl && (
|
||||||
<audio ref={audioRef} src={audioUrl} preload="metadata" />
|
<audio
|
||||||
|
ref={audioRef}
|
||||||
|
src={audioUrl}
|
||||||
|
preload="metadata"
|
||||||
|
onLoadedMetadata={() => {
|
||||||
|
if (audioRef.current) setDuration(audioRef.current.duration);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Header */}
|
{/* Header */}
|
||||||
@@ -412,7 +447,7 @@ const SoundStudioContent: React.FC<SoundStudioContentProps> = ({
|
|||||||
<div className="sound-type-grid">
|
<div className="sound-type-grid">
|
||||||
{[
|
{[
|
||||||
{ key: '보컬', label: t('soundStudio.soundTypeVocal'), disabled: false },
|
{ key: '보컬', label: t('soundStudio.soundTypeVocal'), disabled: false },
|
||||||
{ key: '배경음악', label: t('soundStudio.soundTypeBGM'), disabled: true },
|
{ key: '배경음악', label: t('soundStudio.soundTypeBGM'), disabled: false },
|
||||||
].map(({ key, label, disabled }) => (
|
].map(({ key, label, disabled }) => (
|
||||||
<button
|
<button
|
||||||
key={key}
|
key={key}
|
||||||
@@ -598,16 +633,29 @@ 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 outro = lines.slice(-1);
|
||||||
readOnly
|
const body = lines.slice(0, -1);
|
||||||
className="lyrics-textarea"
|
const half = Math.ceil(body.length / 2);
|
||||||
placeholder={t('soundStudio.lyricsPlaceholder')}
|
const sections = [
|
||||||
/>
|
{ tag: '[Verse]', lines: body.slice(0, half) },
|
||||||
) : (
|
{ tag: '[Chorus]', lines: body.slice(half) },
|
||||||
|
{ tag: '[Outro]', lines: outro },
|
||||||
|
].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>
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
import React, { useState, useRef, useCallback } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { searchAccommodation, AccommodationSearchItem, AutocompleteRequest } from '../../utils/api';
|
import { AutocompleteRequest } from '../../utils/api';
|
||||||
import { CrawlingResponse } from '../../types/api';
|
import { CrawlingResponse } from '../../types/api';
|
||||||
import { useSearchHistory } from '../../components/SearchHistory/useSearchHistory';
|
import SearchInputForm, { SearchType } from '../../components/SearchInputForm';
|
||||||
import SearchHistoryDropdown from '../../components/SearchHistory/SearchHistoryDropdown';
|
|
||||||
|
|
||||||
type SearchType = 'url' | 'name';
|
|
||||||
|
|
||||||
// 환경변수에서 테스트 모드 확인
|
// 환경변수에서 테스트 모드 확인
|
||||||
const isTestPage = import.meta.env.VITE_IS_TESTPAGE === 'true';
|
const isTestPage = import.meta.env.VITE_IS_TESTPAGE === 'true';
|
||||||
@@ -13,39 +10,15 @@ const isTestPage = import.meta.env.VITE_IS_TESTPAGE === 'true';
|
|||||||
interface UrlInputContentProps {
|
interface UrlInputContentProps {
|
||||||
onAnalyze: (value: string, type?: SearchType) => void;
|
onAnalyze: (value: string, type?: SearchType) => void;
|
||||||
onAutocomplete?: (data: AutocompleteRequest) => void;
|
onAutocomplete?: (data: AutocompleteRequest) => void;
|
||||||
|
onManualInput?: (businessName: string, address: string) => void;
|
||||||
onTestData?: (data: CrawlingResponse) => void;
|
onTestData?: (data: CrawlingResponse) => void;
|
||||||
error: string | null;
|
error: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const UrlInputContent: React.FC<UrlInputContentProps> = ({ onAnalyze, onAutocomplete, onTestData, error }) => {
|
const UrlInputContent: React.FC<UrlInputContentProps> = ({ onAnalyze, onAutocomplete, onManualInput, onTestData, error }) => {
|
||||||
const { t, i18n } = useTranslation();
|
const { t, i18n } = useTranslation();
|
||||||
const [inputValue, setInputValue] = useState('');
|
|
||||||
const [searchType, setSearchType] = useState<SearchType>('name');
|
|
||||||
const [isDropdownOpen, setIsDropdownOpen] = useState(false);
|
|
||||||
const [autocompleteResults, setAutocompleteResults] = useState<AccommodationSearchItem[]>([]);
|
|
||||||
const [isAutocompleteLoading, setIsAutocompleteLoading] = useState(false);
|
|
||||||
const [showAutocomplete, setShowAutocomplete] = useState(false);
|
|
||||||
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 () => {
|
||||||
if (!onTestData) return;
|
if (!onTestData) return;
|
||||||
setIsLoadingTest(true);
|
setIsLoadingTest(true);
|
||||||
@@ -60,261 +33,21 @@ const UrlInputContent: React.FC<UrlInputContentProps> = ({ onAnalyze, onAutocomp
|
|||||||
setIsLoadingTest(false);
|
setIsLoadingTest(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const [highlightedIndex, setHighlightedIndex] = useState<number>(-1);
|
|
||||||
const debounceRef = useRef<NodeJS.Timeout | null>(null);
|
|
||||||
const autocompleteRef = useRef<HTMLDivElement>(null);
|
|
||||||
|
|
||||||
const searchTypeOptions = [
|
|
||||||
{ value: 'url' as SearchType, label: 'URL' },
|
|
||||||
{ value: 'name' as SearchType, label: t('urlInput.searchTypeBusinessName') },
|
|
||||||
];
|
|
||||||
|
|
||||||
const getPlaceholder = () => {
|
|
||||||
return searchType === 'url'
|
|
||||||
? 'https://naver.me/abcdef'
|
|
||||||
: t('urlInput.placeholderBusinessName');
|
|
||||||
};
|
|
||||||
|
|
||||||
const getGuideText = () => {
|
|
||||||
return searchType === 'url'
|
|
||||||
? t('urlInput.guideUrl')
|
|
||||||
: t('urlInput.guideBusinessName');
|
|
||||||
};
|
|
||||||
|
|
||||||
// 업체명 검색 시 자동완성 (디바운스 적용)
|
|
||||||
const handleAutocompleteSearch = useCallback(async (query: string) => {
|
|
||||||
if (!query.trim() || searchType !== 'name') {
|
|
||||||
setAutocompleteResults([]);
|
|
||||||
setShowAutocomplete(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
setIsAutocompleteLoading(true);
|
|
||||||
try {
|
|
||||||
const response = await searchAccommodation(query);
|
|
||||||
setAutocompleteResults(response.items || []);
|
|
||||||
setShowAutocomplete(response.items && response.items.length > 0);
|
|
||||||
} catch (error) {
|
|
||||||
console.error('자동완성 검색 오류:', error);
|
|
||||||
setAutocompleteResults([]);
|
|
||||||
setShowAutocomplete(false);
|
|
||||||
} finally {
|
|
||||||
setIsAutocompleteLoading(false);
|
|
||||||
}
|
|
||||||
}, [searchType]);
|
|
||||||
|
|
||||||
// 자동완성 항목 선택 - 업체 정보 저장
|
|
||||||
const handleSelectAutocomplete = (item: AccommodationSearchItem) => {
|
|
||||||
setInputValue(item.title.replace(/<[^>]*>/g, '')); // HTML 태그 제거
|
|
||||||
setSelectedItem(item); // 선택된 업체 정보 저장
|
|
||||||
setShowAutocomplete(false);
|
|
||||||
setAutocompleteResults([]);
|
|
||||||
setHighlightedIndex(-1);
|
|
||||||
};
|
|
||||||
|
|
||||||
// 키보드 네비게이션 핸들러
|
|
||||||
const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {
|
|
||||||
if (e.key === 'Enter') {
|
|
||||||
e.preventDefault();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!showAutocomplete || autocompleteResults.length === 0) return;
|
|
||||||
|
|
||||||
switch (e.key) {
|
|
||||||
case 'ArrowDown':
|
|
||||||
e.preventDefault();
|
|
||||||
setHighlightedIndex(prev =>
|
|
||||||
prev < autocompleteResults.length - 1 ? prev + 1 : 0
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
case 'ArrowUp':
|
|
||||||
e.preventDefault();
|
|
||||||
setHighlightedIndex(prev =>
|
|
||||||
prev > 0 ? prev - 1 : autocompleteResults.length - 1
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
case 'Escape':
|
|
||||||
setShowAutocomplete(false);
|
|
||||||
setHighlightedIndex(-1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// 붙여넣기 시 URL만 추출
|
|
||||||
const handlePaste = (e: React.ClipboardEvent<HTMLInputElement>) => {
|
|
||||||
if (searchType !== 'url') return;
|
|
||||||
const pasted = e.clipboardData.getData('text');
|
|
||||||
const urlMatch = pasted.match(/https?:\/\/[^\s]+/);
|
|
||||||
if (urlMatch) {
|
|
||||||
e.preventDefault();
|
|
||||||
setInputValue(urlMatch[0]);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// 폼 제출 처리
|
|
||||||
const handleSubmit = (e: React.FormEvent) => {
|
|
||||||
e.preventDefault();
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleAnalyzeClick = () => {
|
|
||||||
if (!inputValue.trim()) return;
|
|
||||||
|
|
||||||
if (searchType === 'name' && selectedItem && onAutocomplete) {
|
|
||||||
// 업체명 검색인 경우 autocomplete API 호출
|
|
||||||
const request: AutocompleteRequest = {
|
|
||||||
address: selectedItem.address,
|
|
||||||
roadAddress: selectedItem.roadAddress,
|
|
||||||
title: selectedItem.title,
|
|
||||||
};
|
|
||||||
onAutocomplete(request);
|
|
||||||
} else {
|
|
||||||
// URL 검색인 경우 기존 로직
|
|
||||||
onAnalyze(inputValue.trim(), searchType);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="url-input-container">
|
<div className="url-input-container">
|
||||||
<div className="url-input-content">
|
<div className="url-input-content">
|
||||||
{/* 로고 */}
|
{/* 로고 */}
|
||||||
<div className="url-input-logo">
|
<div className="url-input-logo">
|
||||||
<img src="/assets/images/ado2-logo.svg" alt="ADO2" />
|
<img src="/assets/images/ADO2_with Slogan_white.svg" alt="ADO2" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* URL 입력 폼 */}
|
<SearchInputForm
|
||||||
<form onSubmit={handleSubmit} className="url-input-form">
|
onAnalyze={onAnalyze}
|
||||||
<div className="url-input-wrapper">
|
onAutocomplete={onAutocomplete}
|
||||||
{/* 드롭다운 */}
|
onManualInput={onManualInput}
|
||||||
<div className="url-input-dropdown-container">
|
error={error}
|
||||||
<button
|
/>
|
||||||
type="button"
|
|
||||||
className="url-input-dropdown-trigger"
|
|
||||||
onClick={() => setIsDropdownOpen(!isDropdownOpen)}
|
|
||||||
>
|
|
||||||
<span>{searchTypeOptions.find(opt => opt.value === searchType)?.label}</span>
|
|
||||||
<svg
|
|
||||||
width="12"
|
|
||||||
height="12"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
fill="none"
|
|
||||||
stroke="currentColor"
|
|
||||||
strokeWidth="2"
|
|
||||||
className={`url-input-dropdown-arrow ${isDropdownOpen ? 'open' : ''}`}
|
|
||||||
>
|
|
||||||
<path d="M6 9l6 6 6-6" />
|
|
||||||
</svg>
|
|
||||||
</button>
|
|
||||||
{isDropdownOpen && (
|
|
||||||
<div className="url-input-dropdown-menu">
|
|
||||||
{searchTypeOptions.map((option) => (
|
|
||||||
<button
|
|
||||||
key={option.value}
|
|
||||||
type="button"
|
|
||||||
className={`url-input-dropdown-item ${searchType === option.value ? 'active' : ''}`}
|
|
||||||
onClick={() => {
|
|
||||||
setSearchType(option.value);
|
|
||||||
setIsDropdownOpen(false);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{option.label}
|
|
||||||
</button>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* 입력 필드 */}
|
|
||||||
<div className="url-input-field-container" ref={autocompleteRef}>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
value={inputValue}
|
|
||||||
onChange={(e) => {
|
|
||||||
let value = e.target.value;
|
|
||||||
|
|
||||||
// URL 모드일 때 URL만 추출 (예: "[네이버 지도] https://...")
|
|
||||||
if (searchType === 'url') {
|
|
||||||
const urlMatch = value.match(/https?:\/\/\S+/);
|
|
||||||
if (urlMatch && urlMatch[0] !== value) {
|
|
||||||
value = urlMatch[0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
setInputValue(value);
|
|
||||||
hideOnInput(value);
|
|
||||||
|
|
||||||
// 업체명 검색일 때 자동완성 검색 (디바운스)
|
|
||||||
if (searchType === 'name') {
|
|
||||||
if (debounceRef.current) {
|
|
||||||
clearTimeout(debounceRef.current);
|
|
||||||
}
|
|
||||||
debounceRef.current = setTimeout(() => {
|
|
||||||
handleAutocompleteSearch(value);
|
|
||||||
}, 300);
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
onPaste={handlePaste}
|
|
||||||
onFocus={() => {
|
|
||||||
if (searchType === 'name' && autocompleteResults.length > 0) {
|
|
||||||
setShowAutocomplete(true);
|
|
||||||
}
|
|
||||||
openHistory(inputValue);
|
|
||||||
}}
|
|
||||||
onBlur={() => setTimeout(() => closeHistory(), 150)}
|
|
||||||
placeholder={getPlaceholder()}
|
|
||||||
className="url-input-field"
|
|
||||||
/>
|
|
||||||
|
|
||||||
{/* 최근 검색 히스토리 */}
|
|
||||||
{showHistory && !showAutocomplete && (
|
|
||||||
<SearchHistoryDropdown
|
|
||||||
items={filteredHistory}
|
|
||||||
onSelect={handleSelectHistory}
|
|
||||||
onDelete={(e, value) => { e.preventDefault(); e.stopPropagation(); deleteItem(value); }}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{/* 자동완성 결과 */}
|
|
||||||
{showAutocomplete && searchType === 'name' && (
|
|
||||||
<div className="url-input-autocomplete-dropdown">
|
|
||||||
{isAutocompleteLoading ? (
|
|
||||||
<div className="url-input-autocomplete-loading">{t('urlInput.searching')}</div>
|
|
||||||
) : (
|
|
||||||
autocompleteResults.map((item, index) => (
|
|
||||||
<button
|
|
||||||
key={index}
|
|
||||||
type="button"
|
|
||||||
className="url-input-autocomplete-item"
|
|
||||||
onMouseDown={(e) => {
|
|
||||||
e.preventDefault();
|
|
||||||
handleSelectAutocomplete(item);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<div className="url-input-autocomplete-title" dangerouslySetInnerHTML={{ __html: item.title }} />
|
|
||||||
<div className="url-input-autocomplete-address">{item.roadAddress || item.address}</div>
|
|
||||||
</button>
|
|
||||||
))
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* 안내 텍스트 */}
|
|
||||||
<p className="url-input-guide">
|
|
||||||
{getGuideText()}
|
|
||||||
</p>
|
|
||||||
|
|
||||||
{/* 에러 메시지 */}
|
|
||||||
{error && (
|
|
||||||
<p className="url-input-error">{error}</p>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{/* 검색 버튼 */}
|
|
||||||
<button type="button" onClick={handleAnalyzeClick} className="url-input-button">
|
|
||||||
{t('landing.hero.analyzeButton')}
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* 테스트 버튼 (VITE_IS_TESTPAGE=true일 때만 표시) */}
|
{/* 테스트 버튼 (VITE_IS_TESTPAGE=true일 때만 표시) */}
|
||||||
|
|||||||
@@ -1,37 +1,19 @@
|
|||||||
|
|
||||||
import React, { useState, useEffect, useRef, useCallback } from 'react';
|
import React, { useState, useEffect, useRef } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { searchAccommodation, AccommodationSearchItem, AutocompleteRequest } from '../../utils/api';
|
import { AutocompleteRequest, isLoggedIn } from '../../utils/api';
|
||||||
import { CrawlingResponse } from '../../types/api';
|
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 BusinessNameInputModal from '../../components/BusinessNameInputModal';
|
||||||
import SearchHistoryDropdown from '../../components/SearchHistory/SearchHistoryDropdown';
|
import LoginPromptModal from '../../components/LoginPromptModal';
|
||||||
|
import SearchInputForm from '../../components/SearchInputForm';
|
||||||
type SearchType = 'url' | 'name';
|
import { SearchType } from '../../components/SearchInputForm';
|
||||||
|
|
||||||
// 환경변수에서 테스트 모드 확인
|
// 환경변수에서 테스트 모드 확인
|
||||||
const isTestPage = import.meta.env.VITE_IS_TESTPAGE === 'true';
|
const isTestPage = import.meta.env.VITE_IS_TESTPAGE === 'true';
|
||||||
|
|
||||||
interface HeroSectionProps {
|
|
||||||
onAnalyze?: (value: string, type?: SearchType) => void;
|
|
||||||
onAutocomplete?: (data: AutocompleteRequest) => void;
|
|
||||||
onTestData?: (data: CrawlingResponse) => void;
|
|
||||||
onNext?: () => void;
|
|
||||||
error?: string | null;
|
|
||||||
scrollProgress?: number; // 0 ~ 1 (스크롤 진행률)
|
|
||||||
}
|
|
||||||
|
|
||||||
const isValidUrl = (string: string): boolean => {
|
|
||||||
try {
|
|
||||||
const url = new URL(string);
|
|
||||||
return url.protocol === 'http:' || url.protocol === 'https:';
|
|
||||||
} catch {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Orb configuration with movement zones to prevent overlap
|
// Orb configuration with movement zones to prevent overlap
|
||||||
interface OrbConfig {
|
interface OrbConfig {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -39,65 +21,39 @@ interface OrbConfig {
|
|||||||
initialX: number;
|
initialX: number;
|
||||||
initialY: number;
|
initialY: number;
|
||||||
color: string;
|
color: string;
|
||||||
// Movement bounds for each orb
|
|
||||||
minX: number;
|
minX: number;
|
||||||
maxX: number;
|
maxX: number;
|
||||||
minY: number;
|
minY: number;
|
||||||
maxY: number;
|
maxY: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 6 orbs distributed in a 3x2 grid pattern with overlapping zones for smooth movement
|
|
||||||
const orbConfigs: OrbConfig[] = [
|
const orbConfigs: OrbConfig[] = [
|
||||||
// Top-left zone
|
|
||||||
{ id: 'orb-1', size: 500, initialX: -10, initialY: -10, color: 'radial-gradient(circle, #C490FF 20%, #AE72F9 50%, rgba(94, 235, 195, 0.4) 100%)', minX: -30, maxX: 35, minY: -30, maxY: 40 },
|
{ id: 'orb-1', size: 500, initialX: -10, initialY: -10, color: 'radial-gradient(circle, #C490FF 20%, #AE72F9 50%, rgba(94, 235, 195, 0.4) 100%)', minX: -30, maxX: 35, minY: -30, maxY: 40 },
|
||||||
// Top-right zone
|
|
||||||
{ id: 'orb-2', size: 480, initialX: 70, initialY: -5, color: 'radial-gradient(circle, #5EEBC3 25%, rgba(174, 114, 249, 0.6) 70%, rgba(139, 92, 246, 0.3) 100%)', minX: 50, maxX: 110, minY: -30, maxY: 40 },
|
{ id: 'orb-2', size: 480, initialX: 70, initialY: -5, color: 'radial-gradient(circle, #5EEBC3 25%, rgba(174, 114, 249, 0.6) 70%, rgba(139, 92, 246, 0.3) 100%)', minX: 50, maxX: 110, minY: -30, maxY: 40 },
|
||||||
// Middle-left zone
|
|
||||||
{ id: 'orb-3', size: 420, initialX: 5, initialY: 35, color: 'radial-gradient(circle, rgba(148, 251, 224, 0.8) 15%, #AE72F9 55%, rgba(94, 235, 195, 0.3) 100%)', minX: -20, maxX: 45, minY: 20, maxY: 65 },
|
{ id: 'orb-3', size: 420, initialX: 5, initialY: 35, color: 'radial-gradient(circle, rgba(148, 251, 224, 0.8) 15%, #AE72F9 55%, rgba(94, 235, 195, 0.3) 100%)', minX: -20, maxX: 45, minY: 20, maxY: 65 },
|
||||||
// Middle-right zone
|
|
||||||
{ id: 'orb-4', size: 400, initialX: 60, initialY: 40, color: 'radial-gradient(circle, rgba(220, 200, 255, 0.95) 10%, rgba(148, 251, 224, 0.85) 45%, rgba(174, 114, 249, 0.5) 100%)', minX: 40, maxX: 100, minY: 25, maxY: 70 },
|
{ id: 'orb-4', size: 400, initialX: 60, initialY: 40, color: 'radial-gradient(circle, rgba(220, 200, 255, 0.95) 10%, rgba(148, 251, 224, 0.85) 45%, rgba(174, 114, 249, 0.5) 100%)', minX: 40, maxX: 100, minY: 25, maxY: 70 },
|
||||||
// Bottom-left zone
|
|
||||||
{ id: 'orb-5', size: 520, initialX: -8, initialY: 65, color: 'radial-gradient(circle, #B794F6 30%, rgba(148, 251, 224, 0.6) 65%, rgba(174, 114, 249, 0.3) 100%)', minX: -30, maxX: 40, minY: 50, maxY: 110 },
|
{ id: 'orb-5', size: 520, initialX: -8, initialY: 65, color: 'radial-gradient(circle, #B794F6 30%, rgba(148, 251, 224, 0.6) 65%, rgba(174, 114, 249, 0.3) 100%)', minX: -30, maxX: 40, minY: 50, maxY: 110 },
|
||||||
// Bottom-right zone
|
|
||||||
{ id: 'orb-6', size: 450, initialX: 65, initialY: 70, color: 'radial-gradient(circle, rgba(180, 255, 235, 0.95) 15%, rgba(200, 160, 255, 0.8) 50%, rgba(94, 235, 195, 0.45) 100%)', minX: 45, maxX: 110, minY: 55, maxY: 110 },
|
{ id: 'orb-6', size: 450, initialX: 65, initialY: 70, color: 'radial-gradient(circle, rgba(180, 255, 235, 0.95) 15%, rgba(200, 160, 255, 0.8) 50%, rgba(94, 235, 195, 0.45) 100%)', minX: 45, maxX: 110, minY: 55, maxY: 110 },
|
||||||
];
|
];
|
||||||
|
|
||||||
const HeroSection: React.FC<HeroSectionProps> = ({ onAnalyze, onAutocomplete, onTestData, onNext, error: externalError, scrollProgress = 0 }) => {
|
interface HeroSectionProps {
|
||||||
const { t, i18n } = useTranslation();
|
onAnalyze?: (value: string, type?: SearchType) => void;
|
||||||
const [inputValue, setInputValue] = useState('');
|
onAutocomplete?: (data: AutocompleteRequest) => void;
|
||||||
const [searchType, setSearchType] = useState<SearchType>('name');
|
onManualInput?: (businessName: string, address: string) => void;
|
||||||
const [isDropdownOpen, setIsDropdownOpen] = useState(false);
|
onTestData?: (data: CrawlingResponse) => void;
|
||||||
const [localError, setLocalError] = useState('');
|
onNext?: () => void;
|
||||||
const [isLoadingTest, setIsLoadingTest] = useState(false);
|
error?: string | null;
|
||||||
|
scrollProgress?: number;
|
||||||
|
}
|
||||||
|
|
||||||
// 테스트 데이터 로드 핸들러
|
const HeroSection: React.FC<HeroSectionProps> = ({ onAnalyze, onAutocomplete, onManualInput, onTestData, onNext, error: externalError, scrollProgress = 0 }) => {
|
||||||
const handleTestData = async () => {
|
const { t, i18n } = useTranslation();
|
||||||
if (!onTestData) return;
|
const [isManualModalOpen, setIsManualModalOpen] = useState(false);
|
||||||
setIsLoadingTest(true);
|
const [isLoginPromptOpen, setIsLoginPromptOpen] = useState(false);
|
||||||
try {
|
const [testError, setTestError] = useState('');
|
||||||
const jsonFile = i18n.language === 'en' ? '/example_analysis_en.json' : '/example_analysis.json';
|
const [isLoadingTest, setIsLoadingTest] = useState(false);
|
||||||
const response = await fetch(jsonFile);
|
|
||||||
const data: CrawlingResponse = await response.json();
|
|
||||||
onTestData(data);
|
|
||||||
} catch (error) {
|
|
||||||
console.error('테스트 데이터 로드 실패:', error);
|
|
||||||
setLocalError(t('landing.hero.testDataLoadFailed'));
|
|
||||||
} finally {
|
|
||||||
setIsLoadingTest(false);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const { filteredHistory, showHistory, openHistory, closeHistory, hideOnInput, deleteItem } = useSearchHistory(searchType);
|
|
||||||
const [isFocused, setIsFocused] = useState(false);
|
|
||||||
const [autocompleteResults, setAutocompleteResults] = useState<AccommodationSearchItem[]>([]);
|
|
||||||
const [isAutocompleteLoading, setIsAutocompleteLoading] = useState(false);
|
|
||||||
const [showAutocomplete, setShowAutocomplete] = useState(false);
|
|
||||||
const [selectedItem, setSelectedItem] = useState<AccommodationSearchItem | null>(null);
|
|
||||||
const [highlightedIndex, setHighlightedIndex] = useState<number>(-1);
|
|
||||||
const orbRefs = useRef<(HTMLDivElement | null)[]>([]);
|
const orbRefs = useRef<(HTMLDivElement | null)[]>([]);
|
||||||
const animationRefs = useRef<number[]>([]);
|
const animationRefs = useRef<number[]>([]);
|
||||||
const dropdownRef = useRef<HTMLDivElement>(null);
|
|
||||||
const autocompleteRef = useRef<HTMLDivElement>(null);
|
|
||||||
const debounceRef = useRef<NodeJS.Timeout | null>(null);
|
|
||||||
const tutorial = useTutorial();
|
const tutorial = useTutorial();
|
||||||
|
|
||||||
// 첫 방문 시 랜딩 튜토리얼 시작
|
// 첫 방문 시 랜딩 튜토리얼 시작
|
||||||
@@ -110,100 +66,28 @@ const HeroSection: React.FC<HeroSectionProps> = ({ onAnalyze, onAutocomplete, on
|
|||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const searchTypeOptions = [
|
// 테스트 데이터 로드 핸들러
|
||||||
{ value: 'url' as SearchType, label: 'URL' },
|
const handleTestData = async () => {
|
||||||
{ value: 'name' as SearchType, label: t('landing.hero.searchTypeBusinessName') },
|
if (!onTestData) return;
|
||||||
];
|
setIsLoadingTest(true);
|
||||||
|
|
||||||
// 드롭다운 외부 클릭 감지
|
|
||||||
useEffect(() => {
|
|
||||||
const handleClickOutside = (event: MouseEvent) => {
|
|
||||||
if (dropdownRef.current && !dropdownRef.current.contains(event.target as Node)) {
|
|
||||||
setIsDropdownOpen(false);
|
|
||||||
}
|
|
||||||
if (autocompleteRef.current && !autocompleteRef.current.contains(event.target as Node)) {
|
|
||||||
setShowAutocomplete(false);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
document.addEventListener('mousedown', handleClickOutside);
|
|
||||||
return () => document.removeEventListener('mousedown', handleClickOutside);
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
// 업체명 검색 시 자동완성 (디바운스 적용)
|
|
||||||
const handleAutocompleteSearch = useCallback(async (query: string) => {
|
|
||||||
if (!query.trim() || searchType !== 'name') {
|
|
||||||
setAutocompleteResults([]);
|
|
||||||
setShowAutocomplete(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
setIsAutocompleteLoading(true);
|
|
||||||
try {
|
try {
|
||||||
const response = await searchAccommodation(query);
|
const jsonFile = i18n.language === 'en' ? '/example_analysis_en.json' : '/example_analysis.json';
|
||||||
setAutocompleteResults(response.items || []);
|
const response = await fetch(jsonFile);
|
||||||
setShowAutocomplete(response.items && response.items.length > 0);
|
const data: CrawlingResponse = await response.json();
|
||||||
} catch (error) {
|
onTestData(data);
|
||||||
console.error('자동완성 검색 오류:', error);
|
} catch {
|
||||||
setAutocompleteResults([]);
|
setTestError(t('landing.hero.testDataLoadFailed'));
|
||||||
setShowAutocomplete(false);
|
|
||||||
} finally {
|
} finally {
|
||||||
setIsAutocompleteLoading(false);
|
setIsLoadingTest(false);
|
||||||
}
|
|
||||||
}, [searchType]);
|
|
||||||
|
|
||||||
// 자동완성 항목 선택 - 업체 정보 저장
|
|
||||||
const handleSelectAutocomplete = (item: AccommodationSearchItem) => {
|
|
||||||
setInputValue(item.title.replace(/<[^>]*>/g, '')); // HTML 태그 제거
|
|
||||||
setSelectedItem(item); // 선택된 업체 정보 저장
|
|
||||||
setShowAutocomplete(false);
|
|
||||||
setAutocompleteResults([]);
|
|
||||||
setHighlightedIndex(-1);
|
|
||||||
};
|
|
||||||
|
|
||||||
// 키보드 네비게이션 핸들러
|
|
||||||
const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {
|
|
||||||
// 자동완성이 표시될 때만 키보드 네비게이션 활성화
|
|
||||||
if (showAutocomplete && autocompleteResults.length > 0) {
|
|
||||||
switch (e.key) {
|
|
||||||
case 'ArrowDown':
|
|
||||||
e.preventDefault();
|
|
||||||
setHighlightedIndex(prev =>
|
|
||||||
prev < autocompleteResults.length - 1 ? prev + 1 : 0
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
case 'ArrowUp':
|
|
||||||
e.preventDefault();
|
|
||||||
setHighlightedIndex(prev =>
|
|
||||||
prev > 0 ? prev - 1 : autocompleteResults.length - 1
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
case 'Enter':
|
|
||||||
e.preventDefault(); // 항상 Enter 기본 동작 방지
|
|
||||||
if (highlightedIndex >= 0 && highlightedIndex < autocompleteResults.length) {
|
|
||||||
handleSelectAutocomplete(autocompleteResults[highlightedIndex]);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case 'Escape':
|
|
||||||
e.preventDefault();
|
|
||||||
setShowAutocomplete(false);
|
|
||||||
setHighlightedIndex(-1);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Enter 키 입력 시 기본 동작 방지 (폼 제출 방지)
|
|
||||||
if (e.key === 'Enter') {
|
|
||||||
e.preventDefault();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Random movement for orbs
|
// Orb 랜덤 이동 애니메이션
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const moveOrb = (orb: HTMLDivElement, index: number) => {
|
const moveOrb = (orb: HTMLDivElement, index: number) => {
|
||||||
const config = orbConfigs[index];
|
const config = orbConfigs[index];
|
||||||
let currentX = config.initialX;
|
let currentX = config.initialX;
|
||||||
let currentY = config.initialY;
|
let currentY = config.initialY;
|
||||||
// 초기 타겟은 현재 위치와 동일하게 설정 (순간이동 방지)
|
|
||||||
let targetX = currentX;
|
let targetX = currentX;
|
||||||
let targetY = currentY;
|
let targetY = currentY;
|
||||||
let scale = 1;
|
let scale = 1;
|
||||||
@@ -211,17 +95,13 @@ const HeroSection: React.FC<HeroSectionProps> = ({ onAnalyze, onAutocomplete, on
|
|||||||
let isFirstMove = true;
|
let isFirstMove = true;
|
||||||
|
|
||||||
const generateNewTarget = () => {
|
const generateNewTarget = () => {
|
||||||
// Move within the orb's designated zone
|
|
||||||
const rangeX = config.maxX - config.minX;
|
const rangeX = config.maxX - config.minX;
|
||||||
const rangeY = config.maxY - config.minY;
|
const rangeY = config.maxY - config.minY;
|
||||||
|
|
||||||
if (isFirstMove) {
|
if (isFirstMove) {
|
||||||
// 첫 이동은 현재 위치에서 가까운 곳으로 (자연스러운 시작)
|
|
||||||
const smallRangeX = rangeX * 0.3;
|
const smallRangeX = rangeX * 0.3;
|
||||||
const smallRangeY = rangeY * 0.3;
|
const smallRangeY = rangeY * 0.3;
|
||||||
targetX = currentX + (Math.random() - 0.5) * smallRangeX;
|
targetX = currentX + (Math.random() - 0.5) * smallRangeX;
|
||||||
targetY = currentY + (Math.random() - 0.5) * smallRangeY;
|
targetY = currentY + (Math.random() - 0.5) * smallRangeY;
|
||||||
// 범위 내로 클램핑
|
|
||||||
targetX = Math.max(config.minX, Math.min(config.maxX, targetX));
|
targetX = Math.max(config.minX, Math.min(config.maxX, targetX));
|
||||||
targetY = Math.max(config.minY, Math.min(config.maxY, targetY));
|
targetY = Math.max(config.minY, Math.min(config.maxY, targetY));
|
||||||
isFirstMove = false;
|
isFirstMove = false;
|
||||||
@@ -229,94 +109,38 @@ const HeroSection: React.FC<HeroSectionProps> = ({ onAnalyze, onAutocomplete, on
|
|||||||
targetX = config.minX + Math.random() * rangeX;
|
targetX = config.minX + Math.random() * rangeX;
|
||||||
targetY = config.minY + Math.random() * rangeY;
|
targetY = config.minY + Math.random() * rangeY;
|
||||||
}
|
}
|
||||||
targetScale = 0.9 + Math.random() * 0.2; // 0.9 to 1.1 (더 작은 범위)
|
targetScale = 0.9 + Math.random() * 0.2;
|
||||||
};
|
};
|
||||||
|
|
||||||
const animate = () => {
|
const animate = () => {
|
||||||
// Slow speed - 일정한 속도로 부드럽게
|
|
||||||
const speed = 0.003;
|
const speed = 0.003;
|
||||||
currentX += (targetX - currentX) * speed;
|
currentX += (targetX - currentX) * speed;
|
||||||
currentY += (targetY - currentY) * speed;
|
currentY += (targetY - currentY) * speed;
|
||||||
scale += (targetScale - scale) * speed;
|
scale += (targetScale - scale) * speed;
|
||||||
|
|
||||||
// Apply transform
|
|
||||||
orb.style.left = `${currentX}%`;
|
orb.style.left = `${currentX}%`;
|
||||||
orb.style.top = `${currentY}%`;
|
orb.style.top = `${currentY}%`;
|
||||||
orb.style.transform = `scale(${scale})`;
|
orb.style.transform = `scale(${scale})`;
|
||||||
|
const distance = Math.sqrt(Math.pow(targetX - currentX, 2) + Math.pow(targetY - currentY, 2));
|
||||||
// Generate new target when close enough
|
if (distance < 1) generateNewTarget();
|
||||||
const distance = Math.sqrt(
|
|
||||||
Math.pow(targetX - currentX, 2) + Math.pow(targetY - currentY, 2)
|
|
||||||
);
|
|
||||||
if (distance < 1) {
|
|
||||||
generateNewTarget();
|
|
||||||
}
|
|
||||||
|
|
||||||
animationRefs.current[index] = requestAnimationFrame(animate);
|
animationRefs.current[index] = requestAnimationFrame(animate);
|
||||||
};
|
};
|
||||||
|
|
||||||
// 첫 타겟 생성 후 애니메이션 시작
|
|
||||||
generateNewTarget();
|
generateNewTarget();
|
||||||
animate();
|
animate();
|
||||||
};
|
};
|
||||||
|
|
||||||
// 모든 공이 동시에 자연스럽게 시작 (딜레이 없이)
|
|
||||||
orbRefs.current.forEach((orb, index) => {
|
orbRefs.current.forEach((orb, index) => {
|
||||||
if (orb) {
|
if (orb) moveOrb(orb, index);
|
||||||
moveOrb(orb, index);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Cleanup
|
|
||||||
return () => {
|
return () => {
|
||||||
animationRefs.current.forEach(id => cancelAnimationFrame(id));
|
animationRefs.current.forEach(id => cancelAnimationFrame(id));
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const error = externalError || localError;
|
|
||||||
|
|
||||||
const getPlaceholder = () => {
|
|
||||||
return searchType === 'url'
|
|
||||||
? 'https://naver.me/abcdef'
|
|
||||||
: t('landing.hero.placeholderBusinessName');
|
|
||||||
};
|
|
||||||
|
|
||||||
const getGuideText = () => {
|
|
||||||
return searchType === 'url'
|
|
||||||
? t('landing.hero.guideUrl')
|
|
||||||
: t('landing.hero.guideBusinessName');
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleStart = () => {
|
|
||||||
if (!inputValue.trim()) {
|
|
||||||
setLocalError(searchType === 'url' ? t('landing.hero.errorUrlRequired') : t('landing.hero.errorNameRequired'));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (searchType === 'url' && !isValidUrl(inputValue.trim())) {
|
|
||||||
setLocalError(t('landing.hero.errorInvalidUrl'));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
setLocalError('');
|
|
||||||
|
|
||||||
if (searchType === 'name' && selectedItem && onAutocomplete) {
|
|
||||||
// 업체명 검색인 경우 autocomplete API 호출
|
|
||||||
const request: AutocompleteRequest = {
|
|
||||||
address: selectedItem.address,
|
|
||||||
roadAddress: selectedItem.roadAddress,
|
|
||||||
title: selectedItem.title,
|
|
||||||
};
|
|
||||||
onAutocomplete(request);
|
|
||||||
} else if (onAnalyze) {
|
|
||||||
// URL 검색인 경우 기존 로직
|
|
||||||
onAnalyze(inputValue, searchType);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="hero-section">
|
<div className="hero-section">
|
||||||
{/* Animated background orbs - 스크롤에 따라 빠르게 사라짐 */}
|
{/* Animated background orbs */}
|
||||||
<div
|
<div
|
||||||
className="hero-bg-orbs"
|
className="hero-bg-orbs"
|
||||||
style={{ opacity: Math.max(0, 1 - scrollProgress * 3) }}
|
style={{ opacity: Math.max(0, 1 - scrollProgress * 3) }}
|
||||||
@@ -338,214 +162,45 @@ const HeroSection: React.FC<HeroSectionProps> = ({ onAnalyze, onAutocomplete, on
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="hero-content">
|
<div className="hero-content">
|
||||||
{/* Logo Image */}
|
|
||||||
<img
|
<img
|
||||||
src="/assets/images/ado2-logo.svg"
|
src="/assets/images/ADO2_with Slogan_white.svg"
|
||||||
alt="ADO2"
|
alt="ADO2"
|
||||||
className="hero-logo"
|
className="hero-logo"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<SearchInputForm
|
||||||
{/* Input Form */}
|
onAnalyze={onAnalyze}
|
||||||
<div className="hero-form">
|
onAutocomplete={onAutocomplete}
|
||||||
<div className={`hero-input-wrapper ${isFocused ? 'focused' : ''} ${error ? 'error' : ''} ${inputValue && !isFocused ? 'filled' : ''}`}>
|
onManualInput={onManualInput}
|
||||||
{/* 드롭다운 */}
|
onManualButtonClick={() => {
|
||||||
<div className="hero-dropdown-container" ref={dropdownRef}>
|
if (isLoggedIn()) {
|
||||||
<button
|
setIsManualModalOpen(true);
|
||||||
type="button"
|
} else {
|
||||||
className="hero-dropdown-trigger"
|
setIsLoginPromptOpen(true);
|
||||||
onClick={() => setIsDropdownOpen(!isDropdownOpen)}
|
}
|
||||||
>
|
}}
|
||||||
<span>{searchTypeOptions.find(opt => opt.value === searchType)?.label}</span>
|
error={externalError || testError || null}
|
||||||
<svg
|
/>
|
||||||
width="12"
|
|
||||||
height="12"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
fill="none"
|
|
||||||
stroke="currentColor"
|
|
||||||
strokeWidth="2"
|
|
||||||
className={`hero-dropdown-arrow ${isDropdownOpen ? 'open' : ''}`}
|
|
||||||
>
|
|
||||||
<path d="M6 9l6 6 6-6" />
|
|
||||||
</svg>
|
|
||||||
</button>
|
|
||||||
{isDropdownOpen && (
|
|
||||||
<div className="hero-dropdown-menu">
|
|
||||||
{searchTypeOptions.map((option) => (
|
|
||||||
<button
|
|
||||||
key={option.value}
|
|
||||||
type="button"
|
|
||||||
className={`hero-dropdown-item ${searchType === option.value ? 'active' : ''}`}
|
|
||||||
onClick={() => {
|
|
||||||
setSearchType(option.value);
|
|
||||||
setIsDropdownOpen(false);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{option.label}
|
|
||||||
</button>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="hero-input-container" ref={autocompleteRef}>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
value={inputValue}
|
|
||||||
onChange={(e) => {
|
|
||||||
let value = e.target.value;
|
|
||||||
|
|
||||||
// URL 모드일 때 URL만 추출 (예: "[네이버 지도] https://...")
|
|
||||||
if (searchType === 'url') {
|
|
||||||
const urlMatch = value.match(/https?:\/\/\S+/);
|
|
||||||
if (urlMatch && urlMatch[0] !== value) {
|
|
||||||
value = urlMatch[0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
setInputValue(value);
|
|
||||||
setHighlightedIndex(-1);
|
|
||||||
hideOnInput(value);
|
|
||||||
if (localError) setLocalError('');
|
|
||||||
|
|
||||||
// 업체명 검색일 때 자동완성 검색 (디바운스)
|
|
||||||
if (searchType === 'name') {
|
|
||||||
if (debounceRef.current) {
|
|
||||||
clearTimeout(debounceRef.current);
|
|
||||||
}
|
|
||||||
debounceRef.current = setTimeout(() => {
|
|
||||||
handleAutocompleteSearch(value);
|
|
||||||
}, 300);
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
onPaste={(e: React.ClipboardEvent<HTMLInputElement>) => {
|
|
||||||
if (searchType !== 'url') return;
|
|
||||||
const pasted = e.clipboardData.getData('text');
|
|
||||||
const urlMatch = pasted.match(/https?:\/\/[^\s]+/);
|
|
||||||
if (urlMatch) {
|
|
||||||
e.preventDefault();
|
|
||||||
setInputValue(urlMatch[0]);
|
|
||||||
if (localError) setLocalError('');
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
onFocus={() => {
|
|
||||||
setIsFocused(true);
|
|
||||||
if (searchType === 'name' && autocompleteResults.length > 0) {
|
|
||||||
setShowAutocomplete(true);
|
|
||||||
}
|
|
||||||
openHistory(inputValue);
|
|
||||||
}}
|
|
||||||
onBlur={() => { setIsFocused(false); setTimeout(() => closeHistory(), 150); }}
|
|
||||||
onKeyDown={handleKeyDown}
|
|
||||||
placeholder={getPlaceholder()}
|
|
||||||
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' && (
|
|
||||||
<div className="hero-autocomplete-dropdown">
|
|
||||||
{isAutocompleteLoading ? (
|
|
||||||
<div className="hero-autocomplete-loading">{t('landing.hero.searching')}</div>
|
|
||||||
) : (
|
|
||||||
autocompleteResults.map((item, index) => (
|
|
||||||
<button
|
|
||||||
key={index}
|
|
||||||
type="button"
|
|
||||||
className={`hero-autocomplete-item ${highlightedIndex === index ? 'highlighted' : ''}`}
|
|
||||||
onMouseDown={(e) => {
|
|
||||||
e.preventDefault();
|
|
||||||
handleSelectAutocomplete(item);
|
|
||||||
}}
|
|
||||||
onMouseEnter={() => setHighlightedIndex(index)}
|
|
||||||
>
|
|
||||||
<div className="hero-autocomplete-title" dangerouslySetInnerHTML={{ __html: item.title }} />
|
|
||||||
<div className="hero-autocomplete-address">{item.roadAddress || item.address}</div>
|
|
||||||
</button>
|
|
||||||
))
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
{inputValue && (
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
className="hero-input-clear"
|
|
||||||
onClick={() => {
|
|
||||||
setInputValue('');
|
|
||||||
setLocalError('');
|
|
||||||
setAutocompleteResults([]);
|
|
||||||
setShowAutocomplete(false);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<img src="/assets/images/input-clear-icon.svg" alt="Clear" />
|
|
||||||
</button>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
<span className="hero-input-hint">{getGuideText()}</span>
|
|
||||||
{error && (
|
|
||||||
<p className="hero-error">{error}</p>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<button onClick={handleStart} className="hero-button">
|
|
||||||
{t('landing.hero.analyzeButton')}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Footer Indicator */}
|
{/* Footer Indicator */}
|
||||||
<button onClick={onNext} className="scroll-indicator">
|
<button onClick={onNext} className="scroll-indicator">
|
||||||
<span className="scroll-indicator-text">{t('landing.hero.scrollMore')}</span>
|
<span className="scroll-indicator-text">{t('landing.hero.scrollMore')}</span>
|
||||||
<div className="scroll-indicator-icon">
|
<div className="scroll-indicator-icon">
|
||||||
<svg
|
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1" strokeLinecap="round" strokeLinejoin="round">
|
||||||
width="24"
|
|
||||||
height="24"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
fill="none"
|
|
||||||
stroke="currentColor"
|
|
||||||
strokeWidth="1"
|
|
||||||
strokeLinecap="round"
|
|
||||||
strokeLinejoin="round"
|
|
||||||
>
|
|
||||||
<path d="M7 10l5 5 5-5" />
|
<path d="M7 10l5 5 5-5" />
|
||||||
</svg>
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
{/* 테스트 버튼 (VITE_IS_TESTPAGE=true일 때만 표시) */}
|
{/* 테스트 버튼 */}
|
||||||
{isTestPage && onTestData && (
|
{isTestPage && onTestData && (
|
||||||
<button
|
<button onClick={handleTestData} disabled={isLoadingTest} className="test-data-button">
|
||||||
onClick={handleTestData}
|
|
||||||
disabled={isLoadingTest}
|
|
||||||
className="test-data-button"
|
|
||||||
>
|
|
||||||
{isLoadingTest ? t('landing.hero.testDataLoading') : t('landing.hero.testData')}
|
{isLoadingTest ? t('landing.hero.testDataLoading') : t('landing.hero.testData')}
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{tutorial.isActive && (
|
{tutorial.isActive && !isManualModalOpen && (
|
||||||
<TutorialOverlay
|
<TutorialOverlay
|
||||||
hints={tutorial.hints}
|
hints={tutorial.hints}
|
||||||
currentIndex={tutorial.currentHintIndex}
|
currentIndex={tutorial.currentHintIndex}
|
||||||
@@ -555,6 +210,21 @@ const HeroSection: React.FC<HeroSectionProps> = ({ onAnalyze, onAutocomplete, on
|
|||||||
groupProgress={tutorial.groupProgress}
|
groupProgress={tutorial.groupProgress}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{isManualModalOpen && (
|
||||||
|
<BusinessNameInputModal
|
||||||
|
onClose={() => setIsManualModalOpen(false)}
|
||||||
|
onSubmit={(businessName, address) => {
|
||||||
|
if (tutorial.isActive) tutorial.nextHint();
|
||||||
|
setIsManualModalOpen(false);
|
||||||
|
onManualInput?.(businessName, address);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{isLoginPromptOpen && (
|
||||||
|
<LoginPromptModal onClose={() => setIsLoginPromptOpen(false)} />
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ const LoginSection: React.FC<LoginSectionProps> = ({ onBack, onLogin }) => {
|
|||||||
<div className="login-content">
|
<div className="login-content">
|
||||||
{/* Logo */}
|
{/* Logo */}
|
||||||
<div className="login-logo">
|
<div className="login-logo">
|
||||||
<img src="/assets/images/ado2-login-logo.svg" alt="ADO2" />
|
<img src="/assets/images/ADO2_with Slogan_white.svg" alt="ADO2" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Error Message */}
|
{/* Error Message */}
|
||||||
|
|||||||
+66
-3
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 노래 생성 응답
|
// 노래 생성 응답
|
||||||
@@ -141,6 +143,13 @@ export interface SongDownloadResponse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 영상 생성 응답
|
// 영상 생성 응답
|
||||||
|
// 자막 상태 확인 응답
|
||||||
|
export interface SubtitleStatusResponse {
|
||||||
|
task_id: string;
|
||||||
|
status: string; // 'pending' | 'processing' | 'completed' | 'failed' | 'error'
|
||||||
|
message: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface VideoGenerateResponse {
|
export interface VideoGenerateResponse {
|
||||||
success: boolean;
|
success: boolean;
|
||||||
task_id: string;
|
task_id: string;
|
||||||
@@ -258,14 +267,29 @@ export interface UserCreditsResponse {
|
|||||||
credits: number;
|
credits: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 비디오 목록 아이템
|
// 비디오 목록 아이템 (갤러리용)
|
||||||
export interface VideoListItem {
|
export interface VideoListItem {
|
||||||
video_id: number;
|
video_id: number;
|
||||||
store_name: string;
|
store_name: string;
|
||||||
region: string;
|
region: string;
|
||||||
task_id: string;
|
task_id: string;
|
||||||
result_movie_url: string;
|
result_movie_url: string;
|
||||||
|
thumbnail_url?: string;
|
||||||
created_at: string;
|
created_at: string;
|
||||||
|
like_count: number;
|
||||||
|
comment_count: number;
|
||||||
|
is_liked_by_me?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 비디오 상세 아이템
|
||||||
|
export interface VideoDetailItem {
|
||||||
|
video_id: number;
|
||||||
|
result_movie_url: string;
|
||||||
|
store_name: string;
|
||||||
|
region: string;
|
||||||
|
created_at: string;
|
||||||
|
like_count: number;
|
||||||
|
is_liked_by_me: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 비디오 목록 응답
|
// 비디오 목록 응답
|
||||||
@@ -279,6 +303,45 @@ export interface VideosListResponse {
|
|||||||
has_prev: boolean;
|
has_prev: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 댓글 대댓글
|
||||||
|
export interface CommentReply {
|
||||||
|
id: number;
|
||||||
|
nickname: string;
|
||||||
|
content: string | null;
|
||||||
|
is_deleted: boolean;
|
||||||
|
is_mine: boolean;
|
||||||
|
created_at: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 댓글 아이템
|
||||||
|
export interface CommentItem {
|
||||||
|
id: number;
|
||||||
|
nickname: string;
|
||||||
|
content: string | null;
|
||||||
|
is_deleted: boolean;
|
||||||
|
is_mine: boolean;
|
||||||
|
created_at: string;
|
||||||
|
replies: CommentReply[];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 댓글 목록 응답
|
||||||
|
export interface CommentsResponse {
|
||||||
|
items: CommentItem[];
|
||||||
|
total: number;
|
||||||
|
page: number;
|
||||||
|
page_size: number;
|
||||||
|
total_pages: number;
|
||||||
|
has_next: boolean;
|
||||||
|
has_prev: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 좋아요 토글 응답
|
||||||
|
export interface LikeToggleResponse {
|
||||||
|
video_id: number;
|
||||||
|
is_liked: boolean;
|
||||||
|
like_count: number;
|
||||||
|
}
|
||||||
|
|
||||||
// ============================================
|
// ============================================
|
||||||
// Social OAuth Types
|
// Social OAuth Types
|
||||||
// ============================================
|
// ============================================
|
||||||
|
|||||||
+187
-5
@@ -8,6 +8,7 @@ import {
|
|||||||
SongGenerateResponse,
|
SongGenerateResponse,
|
||||||
SongStatusResponse,
|
SongStatusResponse,
|
||||||
SongDownloadResponse,
|
SongDownloadResponse,
|
||||||
|
SubtitleStatusResponse,
|
||||||
VideoGenerateResponse,
|
VideoGenerateResponse,
|
||||||
VideoStatusResponse,
|
VideoStatusResponse,
|
||||||
VideoDownloadResponse,
|
VideoDownloadResponse,
|
||||||
@@ -29,6 +30,10 @@ import {
|
|||||||
YTAutoSeoRequest,
|
YTAutoSeoRequest,
|
||||||
YTAutoSeoResponse,
|
YTAutoSeoResponse,
|
||||||
UserCreditsResponse,
|
UserCreditsResponse,
|
||||||
|
VideoDetailItem,
|
||||||
|
CommentsResponse,
|
||||||
|
CommentItem,
|
||||||
|
LikeToggleResponse,
|
||||||
} 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';
|
||||||
@@ -162,6 +167,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}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -243,6 +250,52 @@ export async function waitForSongComplete(
|
|||||||
return poll();
|
return poll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 자막 상태 확인 API
|
||||||
|
export async function getSubtitleStatus(taskId: string): Promise<SubtitleStatusResponse> {
|
||||||
|
const response = await authenticatedFetch(`${API_URL}/lyric/subtitle/status/${taskId}`, {
|
||||||
|
method: 'GET',
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`HTTP error! status: ${response.status}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return response.json();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 자막 완료까지 폴링 (5초 간격, 10분 타임아웃)
|
||||||
|
const SUBTITLE_POLL_INTERVAL = 5000;
|
||||||
|
const SUBTITLE_POLL_TIMEOUT = 5 * 60 * 1000;
|
||||||
|
|
||||||
|
export async function waitForSubtitleComplete(
|
||||||
|
taskId: string,
|
||||||
|
onStatusChange?: (status: string) => void
|
||||||
|
): Promise<SubtitleStatusResponse> {
|
||||||
|
const startTime = Date.now();
|
||||||
|
|
||||||
|
const poll = async (): Promise<SubtitleStatusResponse> => {
|
||||||
|
if (Date.now() - startTime > SUBTITLE_POLL_TIMEOUT) {
|
||||||
|
throw new Error('TIMEOUT');
|
||||||
|
}
|
||||||
|
|
||||||
|
const response = await getSubtitleStatus(taskId);
|
||||||
|
onStatusChange?.(response.status);
|
||||||
|
|
||||||
|
if (response.status === 'completed') {
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (response.status === 'failed' || response.status === 'error') {
|
||||||
|
throw new Error(response.message || '자막 생성에 실패했습니다.');
|
||||||
|
}
|
||||||
|
|
||||||
|
await new Promise(resolve => setTimeout(resolve, SUBTITLE_POLL_INTERVAL));
|
||||||
|
return poll();
|
||||||
|
};
|
||||||
|
|
||||||
|
return poll();
|
||||||
|
}
|
||||||
|
|
||||||
// 영상 생성 API
|
// 영상 생성 API
|
||||||
export async function generateVideo(taskId: string, orientation: 'vertical' | 'horizontal' = 'vertical'): Promise<VideoGenerateResponse> {
|
export async function generateVideo(taskId: string, orientation: 'vertical' | 'horizontal' = 'vertical'): Promise<VideoGenerateResponse> {
|
||||||
const response = await authenticatedFetch(`${API_URL}/video/generate/${taskId}?orientation=${orientation}`, {
|
const response = await authenticatedFetch(`${API_URL}/video/generate/${taskId}?orientation=${orientation}`, {
|
||||||
@@ -324,6 +377,99 @@ export async function deleteVideo(videoId: number): Promise<void> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 전체 사용자 영상 목록 조회 API (ADO2 콘텐츠 갤러리용)
|
||||||
|
export async function getAllVideos(
|
||||||
|
page: number = 1,
|
||||||
|
pageSize: number = 20,
|
||||||
|
sortBy: 'created_at' | 'like_count' | 'comment_count' = 'created_at',
|
||||||
|
storeName: string = '',
|
||||||
|
order: 'desc' | 'asc' = 'desc',
|
||||||
|
region: string = '',
|
||||||
|
): Promise<VideosListResponse> {
|
||||||
|
const params = new URLSearchParams({
|
||||||
|
page: String(page),
|
||||||
|
page_size: String(pageSize),
|
||||||
|
sort_by: sortBy,
|
||||||
|
order,
|
||||||
|
});
|
||||||
|
if (storeName.trim()) params.set('store_name', storeName.trim());
|
||||||
|
if (region.trim()) params.set('region', region.trim());
|
||||||
|
const response = await authenticatedFetch(`${API_URL}/video/all?${params.toString()}`, {
|
||||||
|
method: 'GET',
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`HTTP error! status: ${response.status}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return response.json();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 단일 영상 상세 조회 API
|
||||||
|
export async function getVideoById(videoId: string): Promise<VideoDetailItem> {
|
||||||
|
const response = await authenticatedFetch(`${API_URL}/video/${videoId}`, {
|
||||||
|
method: 'GET',
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`HTTP error! status: ${response.status}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return response.json();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 댓글 목록 조회
|
||||||
|
export async function getVideoComments(videoId: string, page: number = 1, pageSize: number = 20): Promise<CommentsResponse> {
|
||||||
|
const response = await authenticatedFetch(`${API_URL}/comment/video/${videoId}?page=${page}&page_size=${pageSize}`, {
|
||||||
|
method: 'GET',
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`HTTP error! status: ${response.status}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return response.json();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 댓글 작성
|
||||||
|
export async function postVideoComment(videoId: string, content: string, nickname?: string, parentId?: number): Promise<CommentItem> {
|
||||||
|
const response = await authenticatedFetch(`${API_URL}/comment/video/${videoId}`, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
body: JSON.stringify({ content, nickname: nickname || '익명', parent_id: parentId ?? null }),
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`HTTP error! status: ${response.status}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return response.json();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 댓글 삭제
|
||||||
|
export async function deleteComment(commentId: number): Promise<void> {
|
||||||
|
const response = await authenticatedFetch(`${API_URL}/comment/${commentId}`, {
|
||||||
|
method: 'DELETE',
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`HTTP error! status: ${response.status}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 좋아요 토글
|
||||||
|
export async function toggleVideoLike(videoId: string): Promise<LikeToggleResponse> {
|
||||||
|
const response = await authenticatedFetch(`${API_URL}/video/${videoId}/like`, {
|
||||||
|
method: 'POST',
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`HTTP error! status: ${response.status}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return response.json();
|
||||||
|
}
|
||||||
|
|
||||||
// 이미지 업로드 API (multipart/form-data)
|
// 이미지 업로드 API (multipart/form-data)
|
||||||
// 타임아웃: 5분 (많은 이미지 업로드 시 시간이 오래 걸릴 수 있음)
|
// 타임아웃: 5분 (많은 이미지 업로드 시 시간이 오래 걸릴 수 있음)
|
||||||
const IMAGE_UPLOAD_TIMEOUT = 5 * 60 * 1000;
|
const IMAGE_UPLOAD_TIMEOUT = 5 * 60 * 1000;
|
||||||
@@ -477,14 +623,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;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -501,7 +653,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;
|
||||||
}
|
}
|
||||||
@@ -749,6 +900,37 @@ export async function autocomplete(request: AutocompleteRequest): Promise<Crawli
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 업체명·주소 직접 입력으로 마케팅 분석
|
||||||
|
export async function marketingAnalysis(storeName: string, address: string): Promise<CrawlingResponse> {
|
||||||
|
const controller = new AbortController();
|
||||||
|
const timeoutId = setTimeout(() => controller.abort(), CRAWL_TIMEOUT);
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await authenticatedFetch(`${API_URL}/marketing`, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
body: JSON.stringify({ store_name: storeName, address }),
|
||||||
|
signal: controller.signal,
|
||||||
|
});
|
||||||
|
|
||||||
|
clearTimeout(timeoutId);
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`HTTP error! status: ${response.status}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return response.json();
|
||||||
|
} catch (error) {
|
||||||
|
clearTimeout(timeoutId);
|
||||||
|
if (error instanceof Error && error.name === 'AbortError') {
|
||||||
|
throw new Error('요청 시간이 초과되었습니다. 다시 시도해주세요.');
|
||||||
|
}
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ============================================
|
// ============================================
|
||||||
// Social OAuth TOKEN_EXPIRED 처리
|
// Social OAuth TOKEN_EXPIRED 처리
|
||||||
// ============================================
|
// ============================================
|
||||||
|
|||||||
Reference in new issue
Block a user