feat: 모바일 하단 내비게이션·설정 패널 도입
This commit is contained in:
1 parent
bb0ab91bcc
commit
54e5d14127
11 files changed
+613
-375
No files matched your search
@@ -3,16 +3,21 @@ import React, { useState, useEffect } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { getSocialAccounts, getYouTubeConnectUrl, disconnectSocialAccount, TokenExpiredError, handleSocialReconnect, getUserCredits, requestCreditCharge } from '../../utils/api';
|
||||
import { SocialAccount } from '../../types/api';
|
||||
import { MyInfoTab } from '../../components/navItems';
|
||||
import MyContentsPage from './MyContentsPage';
|
||||
import ContentCalendarContent from './ContentCalendarContent';
|
||||
import { useOverlayClose } from '../../hooks/useOverlayClose';
|
||||
|
||||
type TabType = 'basic' | 'payment' | 'business';
|
||||
type TabType = MyInfoTab;
|
||||
|
||||
interface MyInfoContentProps {
|
||||
initialTab?: TabType;
|
||||
onNavigate?: (id: string) => void;
|
||||
}
|
||||
|
||||
const MyInfoContent: React.FC<MyInfoContentProps> = ({ initialTab }) => {
|
||||
const MyInfoContent: React.FC<MyInfoContentProps> = ({ initialTab, onNavigate }) => {
|
||||
const { t } = useTranslation();
|
||||
const [activeTab, setActiveTab] = useState<TabType>(initialTab || 'business');
|
||||
const [activeTab, setActiveTab] = useState<TabType>(initialTab || 'contents');
|
||||
const [businessUrl, setBusinessUrl] = useState('');
|
||||
const [socialAccounts, setSocialAccounts] = useState<SocialAccount[]>([]);
|
||||
const [isLoadingAccounts, setIsLoadingAccounts] = useState(false);
|
||||
@@ -113,20 +118,33 @@ const MyInfoContent: React.FC<MyInfoContentProps> = ({ initialTab }) => {
|
||||
const hasConnectedAccounts = youtubeAccounts.length > 0 || instagramAccounts.length > 0;
|
||||
|
||||
const tabs = [
|
||||
// { id: 'basic' as TabType, label: t('myInfo.tabBasic') },
|
||||
{ id: 'contents' as TabType, label: t('myInfo.tabContents') },
|
||||
{ id: 'calendar' as TabType, label: t('myInfo.tabCalendar') },
|
||||
{ id: 'payment' as TabType, label: t('myInfo.tabPayment') },
|
||||
{ id: 'business' as TabType, label: t('myInfo.tabBusiness') },
|
||||
];
|
||||
|
||||
const isWideTab = activeTab === 'contents' || activeTab === 'calendar';
|
||||
|
||||
const handleChildNavigate = (id: string) => {
|
||||
if (id === '내 정보') { setActiveTab('business'); return; }
|
||||
if (id === '콘텐츠 캘린더') { setActiveTab('calendar'); return; }
|
||||
if (id === '내 콘텐츠') { setActiveTab('contents'); return; }
|
||||
onNavigate?.(id);
|
||||
};
|
||||
|
||||
const closeChargePopup = () => { setShowChargePopup(false); setChargeSuccess(false); setChargeAmount(''); setChargeNote(''); };
|
||||
const chargePopupOverlayHandlers = useOverlayClose(closeChargePopup);
|
||||
|
||||
return (
|
||||
<>
|
||||
{showChargePopup && (
|
||||
<div className="myinfo-popup-overlay" onClick={() => { setShowChargePopup(false); setChargeSuccess(false); setChargeAmount(''); setChargeNote(''); }}>
|
||||
<div className="myinfo-popup-overlay" {...chargePopupOverlayHandlers}>
|
||||
<div className="myinfo-popup" onClick={e => e.stopPropagation()}>
|
||||
{chargeSuccess ? (
|
||||
<>
|
||||
<p className="myinfo-popup-message">{t('myInfo.chargeSuccess')}</p>
|
||||
<button className="myinfo-popup-close" onClick={() => { setShowChargePopup(false); setChargeSuccess(false); setChargeAmount(''); setChargeNote(''); }}>{t('myInfo.chargeConfirm')}</button>
|
||||
<button className="myinfo-popup-close" onClick={closeChargePopup}>{t('myInfo.chargeConfirm')}</button>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
@@ -187,7 +205,7 @@ const MyInfoContent: React.FC<MyInfoContentProps> = ({ initialTab }) => {
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
<main className="myinfo-page">
|
||||
<main className={`myinfo-page ${isWideTab ? 'myinfo-page--wide' : ''}`}>
|
||||
<h1 className="myinfo-title">{t('myInfo.title')}</h1>
|
||||
|
||||
{/* 탭 네비게이션 */}
|
||||
@@ -205,11 +223,13 @@ const MyInfoContent: React.FC<MyInfoContentProps> = ({ initialTab }) => {
|
||||
|
||||
{/* 탭 컨텐츠 */}
|
||||
<div className="myinfo-content">
|
||||
{/* {activeTab === 'basic' && (
|
||||
<div className="myinfo-section">
|
||||
<p className="myinfo-placeholder">{t('myInfo.basicPlaceholder')}</p>
|
||||
</div>
|
||||
)} */}
|
||||
{activeTab === 'contents' && (
|
||||
<MyContentsPage onNavigate={handleChildNavigate} embedded />
|
||||
)}
|
||||
|
||||
{activeTab === 'calendar' && (
|
||||
<ContentCalendarContent onNavigate={handleChildNavigate} embedded />
|
||||
)}
|
||||
|
||||
{activeTab === 'payment' && (
|
||||
<div className="myinfo-section">
|
||||
|
||||
Reference in new issue
Block a user