import React, { Fragment, useMemo, useRef } from 'react'; import { TableStyle, FormWrapper, TableWrapper, ListOption, TableInfoContent, TextInput, Label, Notice, } from '../../styles/Components'; import { ItemAcquireIndexSearchBar, ItemConsumeIndexSearchBar, useItemAcquireIndexSearch, useItemConsumeIndexSearch, } from '../searchBar'; import { TopButton, ViewTableInfo } from '../common'; import { TableSkeleton } from '../Skeleton/TableSkeleton'; import { numberFormatter } from '../../utils'; import { useTranslation } from 'react-i18next'; import { AnimatedPageWrapper } from '../common/Layout'; import CSVDownloadButton from '../common/button/CsvDownButton'; import styled from 'styled-components'; const ItemConsumeContent = () => { const { t } = useTranslation(); const token = sessionStorage.getItem('token'); const tableRef = useRef(null); const { searchParams, loading: dataLoading, data: dataList, handleSearch, handleReset, updateSearchParams } = useItemConsumeIndexSearch(token); const tableHeaders = useMemo(() => { return [ { id: 'logDay', label: '일자', width: '100px' }, { id: 'shopSell', label: '상점 판매', width: '80px' }, { id: 'itemUse', label: '아이템 사용', width: '80px' }, { id: 'beaconShop', label: '비컨상점', width: '80px' }, { id: 'beacon', label: '비컨', width: '80px' }, { id: 'quest', label: '퀘스트', width: '80px' }, { id: 'ugq', label: 'UGQ', width: '80px' }, { id: 'randomBox', label: '랜덤박스', width: '80px' }, { id: 'myHome', label: '마이홈', width: '80px' }, { id: 'craft', label: '크래프트', width: '80px' }, { id: 'etc', label: '기타', width: '80px' }, { id: 'summary', label: '합계', width: '80px' }, ]; }, []); return ( { if (executeSearch) { handleSearch(newParams); } else { updateSearchParams(newParams); } }} onReset={handleReset} /> {dataList?.item_list && dataList.item_list.length > 0 && * 확인되지 않은 액션이 있을 수 있습니다 } {dataLoading ? : <> {tableHeaders.map(header => { return ( {header.label} ); })} {dataList?.item_list?.map((item, index) => ( {item.logDay} {numberFormatter.formatCurrency(item.actionSummary.ShopSell)} {numberFormatter.formatCurrency(item.actionSummary.ItemUse)} {numberFormatter.formatCurrency((item.actionSummary.BeaconShopRegisterItem || 0))} {numberFormatter.formatCurrency((item.actionSummary.BeaconEdit || 0) + (item.actionSummary.BeaconCreate || 0))} {numberFormatter.formatCurrency((item.actionSummary.QuestTaskUpdate || 0))} {numberFormatter.formatCurrency(item.actionSummary.UgqAbort)} {numberFormatter.formatCurrency(item.actionSummary.ItemRandomBoxUse)} {numberFormatter.formatCurrency((item.actionSummary.SaveMyhome || 0))} {numberFormatter.formatCurrency((item.actionSummary.CraftStart || 0))} {numberFormatter.formatCurrency( (item.actionSummary.SummonParty || 0) + (item.actionSummary.ItemDestroy || 0) + (item.actionSummary.CreatePartyInstance || 0) + (item.actionSummary.ItemTattooChangeAttribute || 0) + (item.actionSummary.CheatCommandItem || 0) + (item.actionSummary.ItemDestoryByExpiration || 0) + (item.actionSummary.ItemDestroyByUser || 0) + (item.actionSummary.ItemTattooLevelUp || 0) )} {numberFormatter.formatCurrency(item.totalDeltaCount)} ))} } ); }; export default ItemConsumeContent;