로컬라이제이션 적용 (영어 / 한국어 )
This commit is contained in:
1 parent
29fdb7e65c
commit
ad6f9e09a1
30 files changed
+1474
-309
No files matched your search
@@ -1,5 +1,6 @@
|
||||
|
||||
import React, { useState, useEffect, useRef } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { getSocialAccounts, uploadToSocial, waitForUploadComplete, TokenExpiredError, handleSocialReconnect } from '../utils/api';
|
||||
import { SocialAccount, VideoListItem, SocialUploadStatusResponse } from '../types/api';
|
||||
import UploadProgressModal, { UploadStatus } from './UploadProgressModal';
|
||||
@@ -30,6 +31,7 @@ const SocialPostingModal: React.FC<SocialPostingModalProps> = ({
|
||||
onClose,
|
||||
video
|
||||
}) => {
|
||||
const { t } = useTranslation();
|
||||
const [socialAccounts, setSocialAccounts] = useState<SocialAccount[]>([]);
|
||||
const [selectedChannel, setSelectedChannel] = useState<string>('');
|
||||
const [title, setTitle] = useState('');
|
||||
@@ -93,7 +95,7 @@ const SocialPostingModal: React.FC<SocialPostingModalProps> = ({
|
||||
}
|
||||
} catch (error) {
|
||||
if (error instanceof TokenExpiredError) {
|
||||
alert('YouTube 인증이 만료되었습니다. 재연동 페이지로 이동합니다.');
|
||||
alert(t('social.youtubeExpiredAlert'));
|
||||
handleSocialReconnect(error.reconnectUrl);
|
||||
return;
|
||||
}
|
||||
@@ -105,20 +107,20 @@ const SocialPostingModal: React.FC<SocialPostingModalProps> = ({
|
||||
|
||||
const handlePost = async () => {
|
||||
if (!selectedChannel || !title.trim() || !video) {
|
||||
alert('채널과 제목을 입력해주세요.');
|
||||
alert(t('social.channelAndTitleRequired'));
|
||||
return;
|
||||
}
|
||||
|
||||
const selectedAcc = socialAccounts.find(acc => acc.platform_user_id === selectedChannel);
|
||||
if (!selectedAcc) {
|
||||
alert('채널을 선택해주세요.');
|
||||
alert(t('social.selectChannel'));
|
||||
return;
|
||||
}
|
||||
|
||||
// video.video_id 검증 - 반드시 존재해야 함
|
||||
if (!video.video_id) {
|
||||
console.error('Video object missing video_id:', video);
|
||||
alert('영상 정보가 올바르지 않습니다. (video_id 누락)');
|
||||
alert(t('social.invalidVideoInfo'));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -157,7 +159,7 @@ const SocialPostingModal: React.FC<SocialPostingModalProps> = ({
|
||||
const uploadResponse = await uploadToSocial(requestPayload);
|
||||
|
||||
if (!uploadResponse.success) {
|
||||
throw new Error(uploadResponse.message || '업로드 시작에 실패했습니다.');
|
||||
throw new Error(uploadResponse.message || t('social.uploadStartFailed'));
|
||||
}
|
||||
|
||||
// Poll for upload completion
|
||||
@@ -180,13 +182,13 @@ const SocialPostingModal: React.FC<SocialPostingModalProps> = ({
|
||||
} catch (error) {
|
||||
if (error instanceof TokenExpiredError) {
|
||||
setShowUploadProgress(false);
|
||||
alert('YouTube 인증이 만료되었습니다. 재연동 페이지로 이동합니다.');
|
||||
alert(t('social.youtubeExpiredAlert'));
|
||||
handleSocialReconnect(error.reconnectUrl);
|
||||
return;
|
||||
}
|
||||
console.error('Upload failed:', error);
|
||||
setUploadStatus('failed');
|
||||
setUploadErrorMessage(error instanceof Error ? error.message : '업로드에 실패했습니다.');
|
||||
setUploadErrorMessage(error instanceof Error ? error.message : t('social.uploadFailed'));
|
||||
} finally {
|
||||
setIsPosting(false);
|
||||
}
|
||||
@@ -221,9 +223,9 @@ const SocialPostingModal: React.FC<SocialPostingModalProps> = ({
|
||||
const selectedAccount = socialAccounts.find(acc => acc.platform_user_id === selectedChannel);
|
||||
|
||||
const privacyOptions = [
|
||||
{ value: 'public', label: '공개' },
|
||||
{ value: 'unlisted', label: '미등록 (링크로만 접근)' },
|
||||
{ value: 'private', label: '비공개' }
|
||||
{ value: 'public', label: t('social.privacyPublic') },
|
||||
{ value: 'unlisted', label: t('social.privacyUnlisted') },
|
||||
{ value: 'private', label: t('social.privacyPrivate') }
|
||||
];
|
||||
|
||||
const selectedPrivacyOption = privacyOptions.find(opt => opt.value === privacy);
|
||||
@@ -253,7 +255,7 @@ const SocialPostingModal: React.FC<SocialPostingModalProps> = ({
|
||||
<div className="social-posting-modal" onClick={(e) => e.stopPropagation()}>
|
||||
{/* Header */}
|
||||
<div className="social-posting-header">
|
||||
<h2 className="social-posting-title">소셜 미디어 포스팅</h2>
|
||||
<h2 className="social-posting-title">{t('social.title')}</h2>
|
||||
<button className="social-posting-close" onClick={handleClose}>
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
|
||||
<line x1="18" y1="6" x2="6" y2="18"/>
|
||||
@@ -280,7 +282,7 @@ const SocialPostingModal: React.FC<SocialPostingModalProps> = ({
|
||||
<div className="social-posting-form">
|
||||
{/* Video Info */}
|
||||
<div className="social-posting-video-info">
|
||||
<span className="social-posting-label-badge">게시물 1</span>
|
||||
<span className="social-posting-label-badge">{t('social.postNumber')}</span>
|
||||
<span className="social-posting-add-btn">+</span>
|
||||
</div>
|
||||
|
||||
@@ -288,20 +290,20 @@ const SocialPostingModal: React.FC<SocialPostingModalProps> = ({
|
||||
<p className="social-posting-video-title">
|
||||
{video.store_name} {new Date(video.created_at).toLocaleString('ko-KR')}
|
||||
</p>
|
||||
<p className="social-posting-video-specs">1080x1920 · 10초</p>
|
||||
<p className="social-posting-video-specs">{t('social.videoSpecs')}</p>
|
||||
</div>
|
||||
|
||||
{/* Channel Selector - Custom Dropdown */}
|
||||
<div className="social-posting-field">
|
||||
<label className="social-posting-label">
|
||||
게시 채널 <span className="required">*</span>
|
||||
{t('social.channelLabel')} <span className="required">*</span>
|
||||
</label>
|
||||
{isLoadingAccounts ? (
|
||||
<div className="social-posting-loading">계정 로딩 중...</div>
|
||||
<div className="social-posting-loading">{t('social.loadingAccounts')}</div>
|
||||
) : socialAccounts.length === 0 ? (
|
||||
<div className="social-posting-no-accounts">
|
||||
<p>연결된 소셜 계정이 없습니다.</p>
|
||||
<p className="social-posting-no-accounts-hint">내 정보에서 계정을 연결해주세요.</p>
|
||||
<p>{t('social.noAccounts')}</p>
|
||||
<p className="social-posting-no-accounts-hint">{t('social.noAccountsHint')}</p>
|
||||
</div>
|
||||
) : (
|
||||
<div className="social-posting-channel-dropdown" ref={channelDropdownRef}>
|
||||
@@ -355,13 +357,13 @@ const SocialPostingModal: React.FC<SocialPostingModalProps> = ({
|
||||
{/* Title */}
|
||||
<div className="social-posting-field">
|
||||
<label className="social-posting-label">
|
||||
게시물 제목 <span className="required">*</span>
|
||||
{t('social.postTitleLabel')} <span className="required">*</span>
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
value={title}
|
||||
onChange={(e) => setTitle(e.target.value)}
|
||||
placeholder="게시물 제목을 입력하세요."
|
||||
placeholder={t('social.postTitlePlaceholder')}
|
||||
className="social-posting-input"
|
||||
maxLength={100}
|
||||
/>
|
||||
@@ -370,11 +372,11 @@ const SocialPostingModal: React.FC<SocialPostingModalProps> = ({
|
||||
|
||||
{/* Description */}
|
||||
<div className="social-posting-field">
|
||||
<label className="social-posting-label">게시물 내용</label>
|
||||
<label className="social-posting-label">{t('social.postContentLabel')}</label>
|
||||
<textarea
|
||||
value={description}
|
||||
onChange={(e) => setDescription(e.target.value)}
|
||||
placeholder="게시물 내용을 입력하세요."
|
||||
placeholder={t('social.postContentPlaceholder')}
|
||||
className="social-posting-textarea"
|
||||
maxLength={5000}
|
||||
rows={4}
|
||||
@@ -384,12 +386,12 @@ const SocialPostingModal: React.FC<SocialPostingModalProps> = ({
|
||||
|
||||
{/* Tags */}
|
||||
<div className="social-posting-field">
|
||||
<label className="social-posting-label">태그</label>
|
||||
<label className="social-posting-label">{t('social.tagsLabel')}</label>
|
||||
<input
|
||||
type="text"
|
||||
value={tags}
|
||||
onChange={(e) => setTags(e.target.value)}
|
||||
placeholder="태그를 입력하세요. (쉼표로 구분)"
|
||||
placeholder={t('social.tagsPlaceholder')}
|
||||
className="social-posting-input"
|
||||
maxLength={500}
|
||||
/>
|
||||
@@ -399,7 +401,7 @@ const SocialPostingModal: React.FC<SocialPostingModalProps> = ({
|
||||
{/* Privacy - Custom Dropdown */}
|
||||
<div className="social-posting-field">
|
||||
<label className="social-posting-label">
|
||||
게시물 공개 범위 <span className="required">*</span>
|
||||
{t('social.privacyLabel')} <span className="required">*</span>
|
||||
</label>
|
||||
<div className="social-posting-channel-dropdown" ref={privacyDropdownRef}>
|
||||
<button
|
||||
@@ -437,7 +439,7 @@ const SocialPostingModal: React.FC<SocialPostingModalProps> = ({
|
||||
{/* Publish Time */}
|
||||
<div className="social-posting-field">
|
||||
<label className="social-posting-label">
|
||||
게시 시간 <span className="required">*</span>
|
||||
{t('social.publishTimeLabel')} <span className="required">*</span>
|
||||
</label>
|
||||
<div className="social-posting-radio-group">
|
||||
<label className="social-posting-radio">
|
||||
@@ -448,7 +450,7 @@ const SocialPostingModal: React.FC<SocialPostingModalProps> = ({
|
||||
checked={publishTime === 'now'}
|
||||
onChange={() => setPublishTime('now')}
|
||||
/>
|
||||
<span className="radio-label">지금 게시</span>
|
||||
<span className="radio-label">{t('social.publishNow')}</span>
|
||||
</label>
|
||||
<label className="social-posting-radio">
|
||||
<input
|
||||
@@ -459,7 +461,7 @@ const SocialPostingModal: React.FC<SocialPostingModalProps> = ({
|
||||
onChange={() => setPublishTime('schedule')}
|
||||
disabled
|
||||
/>
|
||||
<span className="radio-label disabled">시간 설정 (준비 중)</span>
|
||||
<span className="radio-label disabled">{t('social.publishSchedule')}</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
@@ -469,7 +471,7 @@ const SocialPostingModal: React.FC<SocialPostingModalProps> = ({
|
||||
{/* Footer */}
|
||||
<div className="social-posting-footer">
|
||||
<p className="social-posting-footer-note">
|
||||
게시는 <a href="#" className="social-posting-link">요금제 업그레이드</a> 후 가능합니다.
|
||||
{t('social.footerNote', { link: '' })}<a href="#" className="social-posting-link">{t('social.footerNoteLink')}</a>
|
||||
</p>
|
||||
<div className="social-posting-actions">
|
||||
<button
|
||||
@@ -477,14 +479,14 @@ const SocialPostingModal: React.FC<SocialPostingModalProps> = ({
|
||||
onClick={handleClose}
|
||||
disabled={isPosting}
|
||||
>
|
||||
취소
|
||||
{t('social.cancel')}
|
||||
</button>
|
||||
<button
|
||||
className="social-posting-btn submit"
|
||||
onClick={handlePost}
|
||||
disabled={isPosting || socialAccounts.length === 0 || !title.trim()}
|
||||
>
|
||||
{isPosting ? '게시 중...' : '게시'}
|
||||
{isPosting ? t('social.posting') : t('social.post')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user