From 91bcbd0b268ffe99686b9c13f9998719fe18e1da Mon Sep 17 00:00:00 2001 From: Joel Date: Tue, 30 May 2023 15:26:26 +0800 Subject: [PATCH] fix: svg attr in ts file (#260) --- .../[datasetId]/layout.tsx | 66 +++++++------- web/app/components/app-sidebar/basic.tsx | 26 +++--- web/app/components/app/log/index.tsx | 20 ++--- .../saved-items/no-data/index.tsx | 13 +-- web/app/components/base/input/index.tsx | 2 +- .../documents/detail/embedding/index.tsx | 86 +++++++++---------- .../components/datasets/documents/index.tsx | 9 +- .../components/datasets/documents/list.tsx | 70 +++++++-------- web/app/components/explore/app-card/index.tsx | 19 ++-- web/app/components/explore/sidebar/index.tsx | 49 +++++------ 10 files changed, 182 insertions(+), 178 deletions(-) diff --git a/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/layout.tsx b/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/layout.tsx index 48b0bbc9c5..5b16a827bd 100644 --- a/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/layout.tsx +++ b/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/layout.tsx @@ -1,14 +1,14 @@ 'use client' import type { FC } from 'react' import React, { useEffect } from 'react' -import { usePathname, useSelectedLayoutSegments } from 'next/navigation' +import { usePathname } from 'next/navigation' import useSWR from 'swr' import { useTranslation } from 'react-i18next' -import { getLocaleOnClient } from '@/i18n/client' import { Cog8ToothIcon, // CommandLineIcon, Squares2X2Icon, + // eslint-disable-next-line sort-imports PuzzlePieceIcon, DocumentTextIcon, } from '@heroicons/react/24/outline' @@ -18,9 +18,10 @@ import { DocumentTextIcon as DocumentTextSolidIcon, } from '@heroicons/react/24/solid' import Link from 'next/link' +import s from './style.module.css' import { fetchDataDetail, fetchDatasetRelatedApps } from '@/service/datasets' import type { RelatedApp } from '@/models/datasets' -import s from './style.module.css' +import { getLocaleOnClient } from '@/i18n/client' import AppSideBar from '@/app/components/app-sidebar' import Divider from '@/app/components/base/divider' import Indicator from '@/app/components/header/indicator' @@ -38,7 +39,7 @@ export type IAppDetailLayoutProps = { const LikedItem: FC<{ type?: 'plugin' | 'app'; appStatus?: boolean; detail: RelatedApp }> = ({ type = 'app', appStatus = true, - detail + detail, }) => { return ( @@ -58,7 +59,7 @@ const LikedItem: FC<{ type?: 'plugin' | 'app'; appStatus?: boolean; detail: Rela const TargetIcon: FC<{ className?: string }> = ({ className }) => { return - + @@ -79,7 +80,7 @@ const TargetSolidIcon: FC<{ className?: string }> = ({ className }) => { const BookOpenIcon: FC<{ className?: string }> = ({ className }) => { return - + } @@ -109,9 +110,8 @@ const DatasetDetailLayout: FC = (props) => { ] useEffect(() => { - if (datasetRes) { + if (datasetRes) document.title = `${datasetRes.name || 'Dataset'} - Dify` - } }, [datasetRes]) const ExtraInfo: FC = () => { @@ -119,32 +119,34 @@ const DatasetDetailLayout: FC = (props) => { return
- {relatedApps?.data?.length ? ( - <> -
{relatedApps?.total || '--'} {t('common.datasetMenus.relatedApp')}
- {relatedApps?.data?.map((item) => ())} - - ) : ( -
-
-
- -
-
- + {relatedApps?.data?.length + ? ( + <> +
{relatedApps?.total || '--'} {t('common.datasetMenus.relatedApp')}
+ {relatedApps?.data?.map(item => ())} + + ) + : ( +
+
+
+ +
+
+ +
+
{t('common.datasetMenus.emptyTip')}
+ + + {t('common.datasetMenus.viewDoc')} +
-
{t('common.datasetMenus.emptyTip')}
- - - {t('common.datasetMenus.viewDoc')} - -
- )} + )}
} diff --git a/web/app/components/app-sidebar/basic.tsx b/web/app/components/app-sidebar/basic.tsx index 55094c6190..1a8c0f03f1 100644 --- a/web/app/components/app-sidebar/basic.tsx +++ b/web/app/components/app-sidebar/basic.tsx @@ -15,8 +15,8 @@ export function randomString(length: number) { export type IAppBasicProps = { iconType?: 'app' | 'api' | 'dataset' - icon?: string, - icon_background?: string, + icon?: string + icon_background?: string name: string type: string | React.ReactNode hoverTip?: string @@ -24,12 +24,12 @@ export type IAppBasicProps = { } const AlgorithmSvg = - - - - - - + + + + + + const DatasetSvg = @@ -37,9 +37,9 @@ const DatasetSvg = const ICON_MAP = { - 'app': , - 'api': , - 'dataset': + app: , + api: , + dataset: , } export default function AppBasic({ icon, icon_background, name, type, hoverTip, textStyle, iconType = 'app' }: IAppBasicProps) { @@ -50,8 +50,8 @@ export default function AppBasic({ icon, icon_background, name, type, hoverTip,
)} - {iconType !== 'app' && -
+ {iconType !== 'app' + &&
{ICON_MAP[iconType]}
diff --git a/web/app/components/app/log/index.tsx b/web/app/components/app/log/index.tsx index eb4dbdd636..6930000a26 100644 --- a/web/app/components/app/log/index.tsx +++ b/web/app/components/app/log/index.tsx @@ -31,7 +31,7 @@ const limit = 10 const ThreeDotsIcon: FC<{ className?: string }> = ({ className }) => { return - + } @@ -63,9 +63,9 @@ const Logs: FC = ({ appId }) => { limit, ...(queryParams.period !== 'all' ? { - start: dayjs().subtract(queryParams.period as number, 'day').format('YYYY-MM-DD HH:mm'), - end: dayjs().format('YYYY-MM-DD HH:mm'), - } + start: dayjs().subtract(queryParams.period as number, 'day').format('YYYY-MM-DD HH:mm'), + end: dayjs().format('YYYY-MM-DD HH:mm'), + } : {}), ...omit(queryParams, ['period']), } @@ -77,16 +77,16 @@ const Logs: FC = ({ appId }) => { // When the details are obtained, proceed to the next request const { data: chatConversations, mutate: mutateChatList } = useSWR(() => isChatMode ? { - url: `/apps/${appId}/chat-conversations`, - params: query, - } + url: `/apps/${appId}/chat-conversations`, + params: query, + } : null, fetchChatConversations) const { data: completionConversations, mutate: mutateCompletionList } = useSWR(() => !isChatMode ? { - url: `/apps/${appId}/completion-conversations`, - params: query, - } + url: `/apps/${appId}/completion-conversations`, + params: query, + } : null, fetchCompletionConversations) const total = isChatMode ? chatConversations?.total : completionConversations?.total diff --git a/web/app/components/app/text-generate/saved-items/no-data/index.tsx b/web/app/components/app/text-generate/saved-items/no-data/index.tsx index bd7fe29bc1..f11740b920 100644 --- a/web/app/components/app/text-generate/saved-items/no-data/index.tsx +++ b/web/app/components/app/text-generate/saved-items/no-data/index.tsx @@ -1,24 +1,25 @@ 'use client' -import React, { FC } from 'react' +import type { FC } from 'react' +import React from 'react' import { useTranslation } from 'react-i18next' -import Button from '@/app/components/base/button' import { PlusIcon } from '@heroicons/react/24/outline' -export interface INoDataProps { +import Button from '@/app/components/base/button' +export type INoDataProps = { onStartCreateContent: () => void } const markIcon = ( - + ) const lightIcon = ( - + ) const NoData: FC = ({ - onStartCreateContent + onStartCreateContent, }) => { const { t } = useTranslation() diff --git a/web/app/components/base/input/index.tsx b/web/app/components/base/input/index.tsx index eff2cee749..de2db34944 100644 --- a/web/app/components/base/input/index.tsx +++ b/web/app/components/base/input/index.tsx @@ -18,7 +18,7 @@ type InputProps = { const GlassIcon: FC<{ className?: string }> = ({ className }) => ( - + ) diff --git a/web/app/components/datasets/documents/detail/embedding/index.tsx b/web/app/components/datasets/documents/detail/embedding/index.tsx index 40ce2713e7..720400f5c6 100644 --- a/web/app/components/datasets/documents/detail/embedding/index.tsx +++ b/web/app/components/datasets/documents/detail/embedding/index.tsx @@ -1,28 +1,27 @@ -import { FC, useCallback, useMemo, useState } from 'react' -import React from 'react' +import type { FC } from 'react' +import React, { useCallback, useMemo, useState } from 'react' import useSWR from 'swr' import { useRouter } from 'next/navigation' import { useContext } from 'use-context-selector' import { useTranslation } from 'react-i18next' import { omit } from 'lodash-es' import cn from 'classnames' +import { ArrowRightIcon } from '@heroicons/react/24/solid' +import SegmentCard from '../completed/SegmentCard' +import { FieldInfo } from '../metadata' +import style from '../completed/style.module.css' +import { DocumentContext } from '../index' +import s from './style.module.css' import Button from '@/app/components/base/button' import Divider from '@/app/components/base/divider' -import Loading from '@/app/components/base/loading' import { ToastContext } from '@/app/components/base/toast' -import { FullDocumentDetail, ProcessRuleResponse } from '@/models/datasets' +import type { FullDocumentDetail, ProcessRuleResponse } from '@/models/datasets' import type { CommonResponse } from '@/models/common' import { asyncRunSafe } from '@/utils' import { formatNumber } from '@/utils/format' -import { fetchProcessRule, fetchIndexingEstimate, fetchIndexingStatus, pauseDocIndexing, resumeDocIndexing } from '@/service/datasets' -import SegmentCard from '../completed/SegmentCard' -import { FieldInfo } from '../metadata' -import s from './style.module.css' -import style from '../completed/style.module.css' -import { DocumentContext } from '../index' +import { fetchIndexingEstimate, fetchIndexingStatus, fetchProcessRule, pauseDocIndexing, resumeDocIndexing } from '@/service/datasets' import DatasetDetailContext from '@/context/dataset-detail' import StopEmbeddingModal from '@/app/components/datasets/create/stop-embedding-modal' -import { ArrowRightIcon } from '@heroicons/react/24/solid' type Props = { detail?: FullDocumentDetail @@ -35,7 +34,7 @@ type Props = { const StopIcon: FC<{ className?: string }> = ({ className }) => { return - + @@ -47,9 +46,8 @@ const StopIcon: FC<{ className?: string }> = ({ className }) => { const ResumeIcon: FC<{ className?: string }> = ({ className }) => { return - + - } const RuleDetail: FC<{ sourceData?: ProcessRuleResponse; docName?: string }> = ({ sourceData, docName }) => { @@ -61,43 +59,43 @@ const RuleDetail: FC<{ sourceData?: ProcessRuleResponse; docName?: string }> = ( segmentLength: t('datasetDocuments.embedding.segmentLength'), textCleaning: t('datasetDocuments.embedding.textCleaning'), } + + const getRuleName = (key: string) => { + if (key === 'remove_extra_spaces') + return t('datasetCreation.stepTwo.removeExtraSpaces') + + if (key === 'remove_urls_emails') + return t('datasetCreation.stepTwo.removeUrlEmails') + + if (key === 'remove_stopwords') + return t('datasetCreation.stepTwo.removeStopwords') + } + const getValue = useCallback((field: string) => { - let value: string | number | undefined = '-'; + let value: string | number | undefined = '-' switch (field) { case 'docName': value = docName - break; + break case 'mode': - value = sourceData?.mode === 'automatic' ? (t('datasetDocuments.embedding.automatic') as string) : (t('datasetDocuments.embedding.custom') as string); - break; + value = sourceData?.mode === 'automatic' ? (t('datasetDocuments.embedding.automatic') as string) : (t('datasetDocuments.embedding.custom') as string) + break case 'segmentLength': value = sourceData?.rules?.segmentation?.max_tokens - break; + break default: - value = sourceData?.mode === 'automatic' ? - (t('datasetDocuments.embedding.automatic') as string) : - sourceData?.rules?.pre_processing_rules?.map(rule => { - if (rule.enabled) { + value = sourceData?.mode === 'automatic' + ? (t('datasetDocuments.embedding.automatic') as string) + // eslint-disable-next-line array-callback-return + : sourceData?.rules?.pre_processing_rules?.map((rule) => { + if (rule.enabled) return getRuleName(rule.id) - } }).filter(Boolean).join(';') - break; + break } return value }, [sourceData, docName]) - const getRuleName = (key: string) => { - if (key === 'remove_extra_spaces') { - return t('datasetCreation.stepTwo.removeExtraSpaces') - } - if (key === 'remove_urls_emails') { - return t('datasetCreation.stepTwo.removeUrlEmails') - } - if (key === 'remove_stopwords') { - return t('datasetCreation.stepTwo.removeStopwords') - } - } - return
{Object.keys(segmentationRuleMap).map((field) => { return = ({ detail, stopPosition = 'top', datasetId: d datasetId: localDatasetId, documentId: localDocumentId, }, apiParams => fetchIndexingEstimate(omit(apiParams, 'action')), { - revalidateOnFocus: false + revalidateOnFocus: false, }) const { data: ruleDetail, error: ruleError } = useSWR({ action: 'fetchProcessRule', - params: { documentId: localDocumentId } + params: { documentId: localDocumentId }, }, apiParams => fetchProcessRule(omit(apiParams, 'action')), { revalidateOnFocus: false, }) @@ -159,7 +157,8 @@ const EmbeddingDetail: FC = ({ detail, stopPosition = 'top', datasetId: d const percent = useMemo(() => { const completedCount = indexingStatusDetail?.completed_segments || 0 const totalCount = indexingStatusDetail?.total_segments || 0 - if (totalCount === 0) return 0 + if (totalCount === 0) + return 0 const percent = Math.round(completedCount * 100 / totalCount) return percent > 100 ? 100 : percent }, [indexingStatusDetail]) @@ -170,7 +169,8 @@ const EmbeddingDetail: FC = ({ detail, stopPosition = 'top', datasetId: d if (!e) { notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') }) statusMutate() - } else { + } + else { notify({ type: 'error', message: t('common.actionMsg.modificationFailed') }) } } @@ -211,7 +211,7 @@ const EmbeddingDetail: FC = ({ detail, stopPosition = 'top', datasetId: d (isEmbeddingPaused || isEmbeddingError) && s.barPaused, indexingStatusDetail?.indexing_status === 'completed' && 'rounded-r-md') } - style={{ width: `${percent}%` }} + style={{ width: `${percent}%` }} />
@@ -255,7 +255,7 @@ const EmbeddingDetail: FC = ({ detail, stopPosition = 'top', datasetId: d
{t('datasetDocuments.embedding.previewTip')}
- {[1, 2, 3].map((v) => ( + {[1, 2, 3].map(v => ( ))}
diff --git a/web/app/components/datasets/documents/index.tsx b/web/app/components/datasets/documents/index.tsx index bd7a9f56f4..8fa1e74ebd 100644 --- a/web/app/components/datasets/documents/index.tsx +++ b/web/app/components/datasets/documents/index.tsx @@ -1,13 +1,12 @@ 'use client' import type { FC } from 'react' -import React, { useState, useMemo } from 'react' +import React, { useMemo, useState } from 'react' import useSWR from 'swr' import { useTranslation } from 'react-i18next' import { useRouter } from 'next/navigation' -import { debounce } from 'lodash-es' +import { debounce, omit } from 'lodash-es' // import Link from 'next/link' import { PlusIcon } from '@heroicons/react/24/solid' -import { omit } from 'lodash-es' import List from './list' import s from './style.module.css' import Loading from '@/app/components/base/loading' @@ -22,13 +21,13 @@ const limit = 15 const FolderPlusIcon: FC<{ className?: string }> = ({ className }) => { return - + } const ThreeDotsIcon: FC<{ className?: string }> = ({ className }) => { return - + } diff --git a/web/app/components/datasets/documents/list.tsx b/web/app/components/datasets/documents/list.tsx index f53c63f032..b77e305a07 100644 --- a/web/app/components/datasets/documents/list.tsx +++ b/web/app/components/datasets/documents/list.tsx @@ -1,13 +1,16 @@ +/* eslint-disable no-mixed-operators */ 'use client' import type { FC } from 'react' -import React, { useState, useEffect } from 'react' -import { TrashIcon, ArrowDownIcon } from '@heroicons/react/24/outline' +import React, { useEffect, useState } from 'react' +import { ArrowDownIcon, TrashIcon } from '@heroicons/react/24/outline' import { ExclamationCircleIcon } from '@heroicons/react/24/solid' import dayjs from 'dayjs' import { pick } from 'lodash-es' import { useContext } from 'use-context-selector' import { useRouter } from 'next/navigation' import { useTranslation } from 'react-i18next' +import cn from 'classnames' +import s from './style.module.css' import Switch from '@/app/components/base/switch' import Divider from '@/app/components/base/divider' import Popover from '@/app/components/base/popover' @@ -20,26 +23,24 @@ import Indicator from '@/app/components/header/indicator' import { asyncRunSafe } from '@/utils' import { formatNumber } from '@/utils/format' import { archiveDocument, deleteDocument, disableDocument, enableDocument } from '@/service/datasets' -import type { DocumentListResponse, DocumentDisplayStatus } from '@/models/datasets' +import type { DocumentDisplayStatus, DocumentListResponse } from '@/models/datasets' import type { CommonResponse } from '@/models/common' -import cn from 'classnames' -import s from './style.module.css' export const SettingsIcon: FC<{ className?: string }> = ({ className }) => { return - + } export const FilePlusIcon: FC<{ className?: string }> = ({ className }) => { return - + } export const ArchiveIcon: FC<{ className?: string }> = ({ className }) => { return - + } @@ -59,12 +60,12 @@ export const useIndexStatus = () => { // status item for list export const StatusItem: FC<{ - status: DocumentDisplayStatus; - reverse?: boolean; + status: DocumentDisplayStatus + reverse?: boolean scene?: 'list' | 'detail' textCls?: string }> = ({ status, reverse = false, scene = 'list', textCls = '' }) => { - const DOC_INDEX_STATUS_MAP = useIndexStatus(); + const DOC_INDEX_STATUS_MAP = useIndexStatus() const localStatus = status.toLowerCase() as keyof typeof DOC_INDEX_STATUS_MAP return
void scene?: 'list' | 'detail' className?: string @@ -95,7 +96,7 @@ export const OperationAction: FC<{ const { notify } = useContext(ToastContext) const { t } = useTranslation() - const isListScene = scene === 'list'; + const isListScene = scene === 'list' const onOperate = async (operationName: OperationName) => { let opApi = deleteDocument @@ -123,16 +124,16 @@ export const OperationAction: FC<{ return
e.stopPropagation()} + onClick={e => e.stopPropagation()} > {isListScene && <> - {archived ? - + {archived + ?
{ }} disabled={true} size='md' />
-
: - onOperate(v ? 'enable' : 'disable')} size='md' /> +
+ : onOperate(v ? 'enable' : 'disable')} size='md' /> } } @@ -187,7 +188,7 @@ export const OperationAction: FC<{ trigger='click' position='br' btnElement={
} - btnClassName={(open) => cn(isListScene ? s.actionIconWrapperList : s.actionIconWrapperDetail, open ? '!bg-gray-100 !shadow-none' : '!bg-transparent')} + btnClassName={open => cn(isListScene ? s.actionIconWrapperList : s.actionIconWrapperDetail, open ? '!bg-gray-100 !shadow-none' : '!bg-transparent')} className={`!w-[200px] h-fit !z-20 ${className}`} /> {showModal && setShowModal(false)} className={s.delModal} closable> @@ -221,12 +222,12 @@ export const renderTdValue = (value: string | number | null, isEmptyStyle = fals } const renderCount = (count: number | undefined) => { - if (!count) { + if (!count) return renderTdValue(0, true) - } - if (count < 1000) { - return count; - } + + if (count < 1000) + return count + return `${formatNumber((count / 1000).toFixed(1))}k` } @@ -242,20 +243,21 @@ type IDocumentListProps = { const DocumentList: FC = ({ documents = [], datasetId, onUpdate }) => { const { t } = useTranslation() const router = useRouter() - const [localDocs, setLocalDocs] = useState(documents); - const [enableSort, setEnableSort] = useState(false); + const [localDocs, setLocalDocs] = useState(documents) + const [enableSort, setEnableSort] = useState(false) useEffect(() => { setLocalDocs(documents) }, [documents]) const onClickSort = () => { - setEnableSort(!enableSort); + setEnableSort(!enableSort) if (!enableSort) { - const sortedDocs = [...localDocs].sort((a, b) => dayjs(a.created_at).isBefore(dayjs(b.created_at)) ? -1 : 1); - setLocalDocs(sortedDocs); - } else { - setLocalDocs(documents); + const sortedDocs = [...localDocs].sort((a, b) => dayjs(a.created_at).isBefore(dayjs(b.created_at)) ? -1 : 1) + setLocalDocs(sortedDocs) + } + else { + setLocalDocs(documents) } } @@ -290,7 +292,7 @@ const DocumentList: FC = ({ documents = [], datasetId, onUpd {doc.position}
- {doc?.name?.replace(/\.[^/.]+$/, "")}.{suffix} + {doc?.name?.replace(/\.[^/.]+$/, '')}.{suffix} {renderCount(doc.word_count)} {renderCount(doc.hit_count)} diff --git a/web/app/components/explore/app-card/index.tsx b/web/app/components/explore/app-card/index.tsx index ff56b457f2..24f38d666b 100644 --- a/web/app/components/explore/app-card/index.tsx +++ b/web/app/components/explore/app-card/index.tsx @@ -1,25 +1,24 @@ 'use client' import cn from 'classnames' import { useTranslation } from 'react-i18next' -import { App } from '@/models/explore' -import AppModeLabel from '@/app/(commonLayout)/apps/AppModeLabel' -import AppIcon from '@/app/components/base/app-icon' import { PlusIcon } from '@heroicons/react/20/solid' import Button from '../../base/button' - import s from './style.module.css' +import type { App } from '@/models/explore' +import AppModeLabel from '@/app/(commonLayout)/apps/AppModeLabel' +import AppIcon from '@/app/components/base/app-icon' const CustomizeBtn = ( - + ) export type AppCardProps = { - app: App, - canCreate: boolean, - onCreate: () => void, - onAddToWorkspace: (appId: string) => void, + app: App + canCreate: boolean + onCreate: () => void + onAddToWorkspace: (appId: string) => void } const AppCard = ({ @@ -29,7 +28,7 @@ const AppCard = ({ onAddToWorkspace, }: AppCardProps) => { const { t } = useTranslation() - const {app: appBasicInfo} = app + const { app: appBasicInfo } = app return (
diff --git a/web/app/components/explore/sidebar/index.tsx b/web/app/components/explore/sidebar/index.tsx index 2d44676100..5a9df13771 100644 --- a/web/app/components/explore/sidebar/index.tsx +++ b/web/app/components/explore/sidebar/index.tsx @@ -1,14 +1,15 @@ 'use client' -import React, { FC, useEffect, useState } from 'react' +import type { FC } from 'react' +import React, { useEffect, useState } from 'react' import { useTranslation } from 'react-i18next' import { useContext } from 'use-context-selector' -import ExploreContext from '@/context/explore-context' import cn from 'classnames' import { useSelectedLayoutSegments } from 'next/navigation' import Link from 'next/link' -import Item from './app-nav-item' -import { fetchInstalledAppList as doFetchInstalledAppList, uninstallApp, updatePinStatus } from '@/service/explore' import Toast from '../../base/toast' +import Item from './app-nav-item' +import { fetchInstalledAppList as doFetchInstalledAppList, uninstallApp, updatePinStatus } from '@/service/explore' +import ExploreContext from '@/context/explore-context' import Confirm from '@/app/components/base/confirm' const SelectedDiscoveryIcon = () => ( @@ -19,12 +20,12 @@ const SelectedDiscoveryIcon = () => ( const DiscoveryIcon = () => ( - + ) const SideBar: FC<{ - controlUpdateInstalledApps: number, + controlUpdateInstalledApps: number }> = ({ controlUpdateInstalledApps, }) => { @@ -35,10 +36,10 @@ const SideBar: FC<{ const { installedApps, setInstalledApps } = useContext(ExploreContext) const fetchInstalledAppList = async () => { - const {installed_apps} : any = await doFetchInstalledAppList() + const { installed_apps }: any = await doFetchInstalledAppList() setInstalledApps(installed_apps) } - + const [showConfirm, setShowConfirm] = useState(false) const [currId, setCurrId] = useState('') const handleDelete = async () => { @@ -47,7 +48,7 @@ const SideBar: FC<{ setShowConfirm(false) Toast.notify({ type: 'success', - message: t('common.api.remove') + message: t('common.api.remove'), }) fetchInstalledAppList() } @@ -56,7 +57,7 @@ const SideBar: FC<{ await updatePinStatus(id, isPinned) Toast.notify({ type: 'success', - message: t('common.api.success') + message: t('common.api.success'), }) fetchInstalledAppList() } @@ -74,8 +75,8 @@ const SideBar: FC<{
{isDiscoverySelected ? : }
{t('explore.sidebar.discovery')}
@@ -86,12 +87,12 @@ const SideBar: FC<{
{t('explore.sidebar.workspace')}
- {installedApps.map(({id, is_pinned, uninstallable, app : { name, icon, icon_background }}) => { + {installedApps.map(({ id, is_pinned, uninstallable, app: { name, icon, icon_background } }) => { return ( - )} {showConfirm && ( - setShowConfirm(false)} - onConfirm={handleDelete} - onCancel={() => setShowConfirm(false)} - /> - )} + setShowConfirm(false)} + onConfirm={handleDelete} + onCancel={() => setShowConfirm(false)} + /> + )}
) }