From a5415c31f4ea50e46ea8058ba623a59f50fc5381 Mon Sep 17 00:00:00 2001 From: kevkevinpal Date: Tue, 31 Oct 2023 13:27:01 -0500 Subject: [PATCH] fix: date for topics table --- .../SourcesView/Topics/Table/index.tsx | 91 ++++++++++--------- src/types/index.ts | 2 +- 2 files changed, 50 insertions(+), 43 deletions(-) diff --git a/src/components/SourcesTableModal/SourcesView/Topics/Table/index.tsx b/src/components/SourcesTableModal/SourcesView/Topics/Table/index.tsx index ca4ee7f06..971e56cab 100644 --- a/src/components/SourcesTableModal/SourcesView/Topics/Table/index.tsx +++ b/src/components/SourcesTableModal/SourcesView/Topics/Table/index.tsx @@ -1,5 +1,5 @@ import { IconButton, Table as MaterialTable, TableRow } from '@mui/material' -import moment from 'moment' +// import moment from 'moment' import React, { useState } from 'react' import { MdCancel, MdCheckCircle } from 'react-icons/md' import { ClipLoader } from 'react-spinners' @@ -52,48 +52,55 @@ const Table: React.FC = ({ data, showMuted, setSelectedTopic }) {data?.length && ( - {data?.map((i: Topic) => ( - - - {i.topic.replace(/\n/g, '')} - {i.edgeCount} - - {i.edgeList.map((topic) => ( - {topic} - ))} - - - {i.date_added_to_graph ? {moment(i.date_added_to_graph).format('MM.DD.YYYY')} : null} - + {data?.map((i: Topic) => { + const date = i.date_added_to_graph.toString() + // const date2 = i.date_added_to_graph.toString().split('.')[1] - - -
- {loadingId === i.ref_id ? ( - - ) : ( - <> - {i.muted_topic ? ( - handleMute(i.ref_id, false)}> - - - ) : ( - handleMute(i.ref_id, true)}> - - - )} - - )} -
-
-
- - setSelectedTopic(i)}> - - - -
- ))} + console.log(date, i.date_added_to_graph) + + return ( + + + {i.topic.replace(/\n/g, '')} + {i.edgeCount} + + {i.edgeList.map((topic) => ( + {topic} + ))} + + + {new Date(Number(date) * 1000).toDateString()} + + + + +
+ {loadingId === i.ref_id ? ( + + ) : ( + <> + {i.muted_topic ? ( + handleMute(i.ref_id, false)}> + + + ) : ( + handleMute(i.ref_id, true)}> + + + )} + + )} +
+
+
+ + setSelectedTopic(i)}> + + + +
+ ) + })} )} diff --git a/src/types/index.ts b/src/types/index.ts index fd642c4ba..106e414ca 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -159,7 +159,7 @@ export type Topic = { muted_topic: string edgeList: Array edgeCount: number - date_added_to_graph: null + date_added_to_graph: string } export type TopicFilter = {