@@ -22,12 +22,12 @@ import {
2222 Skeleton ,
2323 Tooltip
2424} from "@mui/material" ;
25- import humanizeDuration from "humanize-duration" ;
2625import R from "ramda" ;
2726import React , { useEffect , useState } from "react" ;
2827import { store as RNC } from "react-notifications-component" ;
2928import { useDispatch , useSelector } from "react-redux" ;
3029import LinkComponent from "_atoms/LinkComponent" ;
30+ import { dateElapsed , dateToString } from "_frontend/utils/date" ;
3131import {
3232 attemptArchiveItem ,
3333 attemptDeleteItem ,
@@ -47,9 +47,7 @@ const borderRadius = {
4747// Maximum number of line of the content
4848const LINE_CLAMP = 4 ;
4949
50- const content = ( item , itemChildren ) => {
51- const dispatch = useDispatch ( ) ;
52-
50+ const renderContent = ( item , itemChildren ) => {
5351 if ( item == null || ! item . hasOwnProperty ( "content" ) ) return null ;
5452
5553 if ( item . type === "card" ) {
@@ -84,17 +82,6 @@ const content = (item, itemChildren) => {
8482 } ) ;
8583} ;
8684
87- const dateElapsed = ( date ) => {
88- const created = new Date ( date ) ;
89- const now = new Date ( ) ;
90- return `${ humanizeDuration ( now - created , {
91- language : "ko" ,
92- largest : 1 ,
93- spacer : "" ,
94- round : true ,
95- } ) } 전`;
96- } ;
97-
9885const statusIcon = {
9986 archived : mdiPackageDown ,
10087 public : mdiEarth ,
@@ -290,10 +277,7 @@ export default function Item({
290277 // don't render if visible is false
291278 if ( visible == false ) return null ;
292279
293- const createdDate = new Date ( item . created ) ;
294- const createdString = `${ createdDate . toLocaleDateString (
295- "ko-KR"
296- ) } ${ createdDate . toLocaleTimeString ( "en-GB" ) } `;
280+ const content = renderContent ( item , itemChildren )
297281
298282 return item == null ? (
299283 < div className = "item" key = { itemId } >
@@ -360,10 +344,18 @@ export default function Item({
360344 < div />
361345 ) }
362346 </ div >
363- < div className = "item-content" > { content ( item , itemChildren ) } </ div >
347+ { content != null ? (
348+ < div className = "item-content" > { content } </ div >
349+ ) : (
350+ < div className = "item-content" >
351+ < Skeleton width = "100%" />
352+ < Skeleton width = "100%" />
353+ < Skeleton width = "75%" />
354+ </ div >
355+ ) }
364356 </ ButtonBase >
365357 < div className = "item-footer" >
366- < Tooltip title = { createdString } arrow >
358+ < Tooltip title = { dateToString ( item . created ) } arrow >
367359 < div className = "item-description" >
368360 { `${ item . owner . rank } ${ item . owner . name } · ${ dateElapsed (
369361 item . created
0 commit comments