From 6916d2e5c2c85978b20fc69348c5a71f79b805b5 Mon Sep 17 00:00:00 2001 From: foxxy Date: Tue, 1 Oct 2024 14:29:19 +0300 Subject: [PATCH 1/4] MSP-4163 fix createdAt field in tokens table --- src/components/TokenContent/index.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/components/TokenContent/index.tsx b/src/components/TokenContent/index.tsx index 6461118..b1f5a96 100644 --- a/src/components/TokenContent/index.tsx +++ b/src/components/TokenContent/index.tsx @@ -123,10 +123,8 @@ const TokenContent = ({ id }: TokenPropTypes) => { title: 'Дата/Время выпуска', dataIndex: 'createdAt', key: 'createdAt', - render: (record) => { - const formatTime = dayjs(record.createdAt).format( - dateFormats.fullFormat - ) + render: (value) => { + const formatTime = dayjs(value).format(dateFormats.fullFormat) return
{formatTime}
} }, From 245b7c4e79ec7d04938487677a6286e1daab5ee7 Mon Sep 17 00:00:00 2001 From: foxxy Date: Tue, 1 Oct 2024 14:29:32 +0300 Subject: [PATCH 2/4] MSP-4163 add memo for tokensOptions --- src/components/TokenContent/index.tsx | 49 ++++++++++++++------------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/src/components/TokenContent/index.tsx b/src/components/TokenContent/index.tsx index b1f5a96..ef0d99c 100644 --- a/src/components/TokenContent/index.tsx +++ b/src/components/TokenContent/index.tsx @@ -7,7 +7,7 @@ import 'dayjs/locale/ru' import duration from 'dayjs/plugin/duration' import relativeTime from 'dayjs/plugin/relativeTime' import { FormComponents, Layout } from 'isp-ui-kit' -import { useEffect, useState } from 'react' +import { useEffect, useMemo, useState } from 'react' import { useForm } from 'react-hook-form' import { dateFormats } from '@constants/date.ts' @@ -172,28 +172,31 @@ const TokenContent = ({ id }: TokenPropTypes) => { } ] - const tokensOptions = [ - { - value: -1, - label: 'Бессрочно' - }, - { - value: 3600000, - label: 'Один час' - }, - { - value: 86400000, - label: 'Один день' - }, - { - value: 2592000000, - label: '30 дней' - }, - { - value: 31536000000, - label: 'Один год' - } - ] + const tokensOptions = useMemo( + () => [ + { + value: -1, + label: 'Бессрочно' + }, + { + value: 3600000, + label: 'Один час' + }, + { + value: 86400000, + label: 'Один день' + }, + { + value: 2592000000, + label: '30 дней' + }, + { + value: 31536000000, + label: 'Один год' + } + ], + [] + ) if (!id) { return } From 2640eda5fc88b98b25c0951417c58f5dd6a14edf Mon Sep 17 00:00:00 2001 From: foxxy Date: Tue, 1 Oct 2024 14:30:03 +0300 Subject: [PATCH 3/4] MSP-4163 beautify tokenContent --- src/components/TokenContent/index.tsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/TokenContent/index.tsx b/src/components/TokenContent/index.tsx index ef0d99c..e2bc8fb 100644 --- a/src/components/TokenContent/index.tsx +++ b/src/components/TokenContent/index.tsx @@ -24,10 +24,7 @@ import { import tokensApi from '@services/tokensService.ts' - - -import './tokens.scss'; - +import './tokens.scss' const { FormSelect } = FormComponents const { EmptyData } = Layout @@ -117,7 +114,7 @@ const TokenContent = ({ id }: TokenPropTypes) => { title: 'Токен', dataIndex: 'token', key: 'token', - render: (record) =>
{shortenString(record)}
+ render: (value) =>
{shortenString(value)}
}, { title: 'Дата/Время выпуска', @@ -133,7 +130,6 @@ const TokenContent = ({ id }: TokenPropTypes) => { dataIndex: 'expireTime', key: 'expireTime', render: (value, record) => { - if (value === -1) { return Никогда } @@ -156,7 +152,11 @@ const TokenContent = ({ id }: TokenPropTypes) => { return ( -