import React, { Fragment, useMemo, useRef, useState } from 'react'; import { CircularProgressWrapper, FormWrapper, TableStyle, TableWrapper, } from '../../styles/Components'; import { useTranslation } from 'react-i18next'; import { TableSkeleton } from '../Skeleton/TableSkeleton'; import { UserSnapshotLogSearchBar, useUserSnapshotLogSearch } from '../searchBar'; import { TopButton, ViewTableInfo } from '../common'; import Pagination from '../common/Pagination/Pagination'; import { INITIAL_PAGE_LIMIT, } from '../../assets/data/adminConstants'; import ExcelExportButton from '../common/button/ExcelExportButton'; import CircularProgress from '../common/CircularProgress'; import { AnimatedPageWrapper } from '../common/Layout'; import { numberFormatter } from '../../utils'; const UserSnapshotLogContent = ({ active }) => { const { t } = useTranslation(); const token = sessionStorage.getItem('token'); const tableRef = useRef(null); const [downloadState, setDownloadState] = useState({ loading: false, progress: 0 }); const { searchParams, loading: dataLoading, data: dataList, handleSearch, handleReset, handlePageChange, updateSearchParams } = useUserSnapshotLogSearch(token, 500); const tableHeaders = useMemo(() => { return [ { id: 'logDay', label: '일자', width: '80px' }, { id: 'accountId', label: 'account ID', width: '80px' }, { id: 'userGuid', label: 'GUID', width: '180px' }, { id: 'userNickname', label: '아바타명', width: '150px' }, { id: 'gold', label: '골드', width: '80px' }, { id: 'sapphire', label: '사파이어', width: '80px' }, { id: 'calium', label: '칼리움', width: '80px' }, { id: 'ruby', label: '루비', width: '80px' }, { id: 'item_13080002', label: '퀘스트 메달', width: '80px' }, { id: 'item_13080004', label: '보급품 메달', width: '80px' }, { id: 'item_13080005', label: '제작 메달', width: '80px' }, { id: 'item_13080006', label: '에테론 315 포드', width: '80px' }, { id: 'item_13080007', label: '에테론 316 포드', width: '80px' }, { id: 'item_13080008', label: '에테론 317 포드', width: '80px' }, { id: 'item_13080009', label: '에테론 318 포드', width: '80px' }, { id: 'item_11570001', label: '강화잉크', width: '80px' }, { id: 'item_11570002', label: '연성잉크', width: '80px' }, { id: 'lastLogoutTime', label: '마지막 로그아웃 일자', width: '150px' }, ]; }, []); if(!active) return null; return ( { if (executeSearch) { handleSearch(newParams); } else { updateSearchParams(newParams); } }} onReset={handleReset} /> {downloadState.loading && ( )} {dataLoading ? : <> {tableHeaders.map(header => ( {header.label} ))} {dataList?.snapshot_list?.map((item, index) => ( {item.logDay} {item.accountId} {item.userGuid} {item.userNickname} {numberFormatter.formatCurrency(item.gold)} {numberFormatter.formatCurrency(item.sapphire)} {numberFormatter.formatCurrency(item.calium)} {numberFormatter.formatCurrency(item.ruby)} {item.item_13080002} {item.item_13080004} {item.item_13080005} {item.item_13080006} {item.item_13080007} {item.item_13080008} {item.item_13080009} {item.item_11570001} {item.item_11570002} {item.lastLogoutTime} ))} {dataList?.snapshot_list && } } ); }; export default UserSnapshotLogContent;