From 99fec25ed5bca63a9059d138a2eb62f97a739393 Mon Sep 17 00:00:00 2001 From: GyDi Date: Wed, 9 Feb 2022 02:08:27 +0800 Subject: [PATCH] feat: profile item ui --- src/components/profile-item.tsx | 105 +++++++++++++++++++------------- src/services/types.ts | 1 + 2 files changed, 64 insertions(+), 42 deletions(-) diff --git a/src/components/profile-item.tsx b/src/components/profile-item.tsx index 542e452..9870477 100644 --- a/src/components/profile-item.tsx +++ b/src/components/profile-item.tsx @@ -59,6 +59,9 @@ const ProfileItem: React.FC = (props) => { const progress = Math.round(((download + upload) * 100) / (total + 0.1)); const fromnow = updated > 0 ? dayjs(updated * 1000).fromNow() : ""; + // url or file mode + const isUrlMode = itemData.url && extra; + const onView = async () => { setAnchorEl(null); try { @@ -111,6 +114,13 @@ const ProfileItem: React.FC = (props) => { event.preventDefault(); }; + const boxStyle = { + height: 26, + display: "flex", + alignItems: "center", + justifyContent: "space-between", + }; + return ( <> = (props) => { {name} - { - e.stopPropagation(); - onUpdateWrapper(false)(); - }} - > - - + {isUrlMode && ( + { + e.stopPropagation(); + onUpdateWrapper(false)(); + }} + > + + + )} - - - {from} - + {isUrlMode ? ( + <> + + + {from} + - - {fromnow} - - + + {fromnow} + + - - - {parseTraffic(upload + download)} / {parseTraffic(total)} - - {expire} - + + + {parseTraffic(upload + download)} / {parseTraffic(total)} + + {expire} + + + ) : ( + <> + + + {itemData.desc} + + + + + {parseExpire(updated)} + + + )}