deploy first
This commit is contained in:
@@ -29,6 +29,7 @@ export default function Page() {
|
||||
is_approved: boolean;
|
||||
icon: string;
|
||||
}[]>([]);
|
||||
const [stats, setStats] = useState<Record<string, { videoCount: number; views: number }>>({});
|
||||
|
||||
|
||||
const [registerCode, setRegisterCode] = useState<string>("");
|
||||
@@ -86,12 +87,23 @@ export default function Page() {
|
||||
const data = await resp.json();
|
||||
setChannelList(data.items);
|
||||
console.log('list_channel:', data);
|
||||
// 채널별 통계 로드
|
||||
const ids = (data.items || []).map((i: any) => i.id).filter(Boolean);
|
||||
if (ids.length > 0) {
|
||||
const sresp = await fetch(`/api/channel/stats?handleIds=${encodeURIComponent(ids.join(','))}`, { cache: 'no-store' });
|
||||
const sdata = await sresp.json();
|
||||
const map: Record<string, { videoCount: number; views: number }> = {};
|
||||
for (const it of (sdata.items || [])) map[it.handleId] = { videoCount: it.videoCount, views: it.views };
|
||||
setStats(map);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('list_channel 요청 에러:', e);
|
||||
}
|
||||
}
|
||||
|
||||
const delete_channel = async (handle: string) => {
|
||||
alert("삭제 비활성화 관리자에게 문의하세요.");
|
||||
return;
|
||||
if (isLoading) return;
|
||||
if (!handle) return;
|
||||
const ok = confirm(`정말 "${handle}" 채널 연결을 해제하시겠습니까?`);
|
||||
@@ -139,25 +151,21 @@ export default function Page() {
|
||||
<div className="
|
||||
border-1 border-[#e6e9ef] rounded-lg bg-white overflow-y-auto
|
||||
">
|
||||
<table className="w-full h-full border-separate border-spacing-y-1 table-fixed px-[10px]">
|
||||
<table className="w-full h-full border-separate border-spacing-y-1 table-fixed">
|
||||
<colgroup>
|
||||
<col className="min-w-[250px] max-w-[300px]"/>
|
||||
<col className="min-w-[250px] max-w-[500px]"/>
|
||||
<col className="w-[120px]"/>
|
||||
<col className="w-[80px]"/>
|
||||
<col className="w-[100px]"/>
|
||||
<col className="w-[100px]"/>
|
||||
<col className="w-[110px]"/>
|
||||
<col className="w-[90px]"/>
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr className="sticky top-0 bg-white h-[49px] ">
|
||||
<th className="border-b-1 right-border border-[#e6e9ef] ">채널 핸들</th>
|
||||
<th className="border-b-1 right-border border-[#e6e9ef] ">등록 날짜</th>
|
||||
<th className="border-b-1 right-border border-[#e6e9ef] ">승인여부</th>
|
||||
<th className="border-b-1 right-border border-[#e6e9ef] ">영상수</th>
|
||||
<th className="border-b-1 right-border border-[#e6e9ef] ">조회수</th>
|
||||
<th className="border-b-1 right-border border-[#e6e9ef] ">예상수익</th>
|
||||
<th className="border-b-1 border-[#e6e9ef] ">삭제</th>
|
||||
<th className="border-b-1 border-[#e6e9ef] rounded-tr-lg ">삭제</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -176,13 +184,11 @@ export default function Page() {
|
||||
</div>
|
||||
</td>
|
||||
<td className="right-border border-b-1 border-t-1 border-[#e6e9ef] text-center whitespace-nowrap overflow-hidden">{channel.createtime.split("T")[0]}</td>
|
||||
<td className="right-border border-b-1 border-t-1 border-[#e6e9ef] text-center whitespace-nowrap overflow-hidden">{channel.is_approved? "승인" : "미승인"}</td>
|
||||
<td className="right-border border-b-1 border-t-1 border-[#e6e9ef] text-center"> - </td>
|
||||
<td className="right-border border-b-1 border-t-1 border-[#e6e9ef] text-center"> - </td>
|
||||
<td className="right-border border-b-1 border-t-1 border-[#e6e9ef] text-center"> - </td>
|
||||
<td className="border-b-1 border-t-1 border-[#e6e9ef] border-r-1 rounded-r-lg text-center">
|
||||
<td className="right-border border-b-1 border-t-1 border-[#e6e9ef] text-center">{stats[channel.id]?.videoCount ?? '-'}</td>
|
||||
<td className="right-border border-b-1 border-t-1 border-[#e6e9ef] text-center">{stats[channel.id]?.views ?? '-'}</td>
|
||||
<td className="border-b-1 border-t-1 border-r-1 border-[#e6e9ef] rounded-r-lg text-center">
|
||||
<button
|
||||
className={`px-3 py-1 rounded-md ${isLoading ? 'bg-gray-300 cursor-not-allowed' : 'bg-red-500 hover:bg-red-600'} text-white`}
|
||||
className={`px-3 py-1 rounded-md bg-gray-300 text-white cursor-not-allowed' : 'bg-red-500 hover:bg-red-600'} text-white`}
|
||||
onClick={() => { if (!isLoading) delete_channel(channel.handle); }}
|
||||
>
|
||||
삭제
|
||||
|
||||
Reference in New Issue
Block a user