fix(web): my sharing app add empty
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
* @Author: ZhaoYing
|
* @Author: ZhaoYing
|
||||||
* @Date: 2026-02-03 16:34:12
|
* @Date: 2026-02-03 16:34:12
|
||||||
* @Last Modified by: ZhaoYing
|
* @Last Modified by: ZhaoYing
|
||||||
* @Last Modified time: 2026-03-18 10:44:32
|
* @Last Modified time: 2026-03-18 11:20:45
|
||||||
*/
|
*/
|
||||||
import React, { useState, useEffect, useMemo } from 'react';
|
import React, { useState, useEffect, useMemo } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
@@ -11,6 +11,7 @@ import clsx from 'clsx';
|
|||||||
|
|
||||||
import type { MySharedOutItem } from './types';
|
import type { MySharedOutItem } from './types';
|
||||||
import { mySharedOutList, cancelShare, cancelSpaceShare } from '@/api/application'
|
import { mySharedOutList, cancelShare, cancelSpaceShare } from '@/api/application'
|
||||||
|
import BodyWrapper from '@/components/Empty/BodyWrapper'
|
||||||
|
|
||||||
const MySharing: React.FC = () => {
|
const MySharing: React.FC = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -20,7 +21,8 @@ const MySharing: React.FC = () => {
|
|||||||
useEffect(() => { getList() }, [])
|
useEffect(() => { getList() }, [])
|
||||||
|
|
||||||
const getList = () => {
|
const getList = () => {
|
||||||
mySharedOutList().then(res => setData(res as MySharedOutItem[]))
|
mySharedOutList()
|
||||||
|
.then(res => setData(res as MySharedOutItem[]))
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Group items by target_workspace_id */
|
/** Group items by target_workspace_id */
|
||||||
@@ -73,85 +75,87 @@ const MySharing: React.FC = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Flex vertical gap={12}>
|
<Flex vertical gap={12} className="rb:h-[calc(100vh-148px)]! rb:overflow-y-auto!">
|
||||||
{grouped.map(({ workspace, items }) => (
|
<BodyWrapper loading={false} empty={data.length === 0}>
|
||||||
<Collapse
|
{grouped.map(({ workspace, items }) => (
|
||||||
key={workspace.target_workspace_id}
|
<Collapse
|
||||||
defaultActiveKey={[workspace.target_workspace_id]}
|
key={workspace.target_workspace_id}
|
||||||
items={[{
|
defaultActiveKey={[workspace.target_workspace_id]}
|
||||||
key: workspace.target_workspace_id,
|
items={[{
|
||||||
label: (
|
key: workspace.target_workspace_id,
|
||||||
<Flex align="center" gap={12}>
|
label: (
|
||||||
{workspace.target_workspace_icon
|
<Flex align="center" gap={12}>
|
||||||
? <img src={workspace.target_workspace_icon} className="rb:w-8 rb:h-8 rb:rounded-lg rb:object-cover" />
|
{workspace.target_workspace_icon
|
||||||
: <div className="rb:w-8 rb:h-8 rb:rounded-lg rb:bg-[#155eef] rb:flex rb:items-center rb:justify-center rb:text-[14px] rb:text-white">
|
? <img src={workspace.target_workspace_icon} className="rb:w-8 rb:h-8 rb:rounded-lg rb:object-cover" />
|
||||||
{workspace.target_workspace_name[0]}
|
: <div className="rb:w-8 rb:h-8 rb:rounded-lg rb:bg-[#155eef] rb:flex rb:items-center rb:justify-center rb:text-[14px] rb:text-white">
|
||||||
</div>
|
{workspace.target_workspace_name[0]}
|
||||||
}
|
|
||||||
<div>
|
|
||||||
<span className="rb:font-medium">{workspace.target_workspace_name}</span>
|
|
||||||
<div className="rb:text-[#5B6167] rb:text-[12px]">{t('application.appCount', { count: items.length })}</div>
|
|
||||||
</div>
|
|
||||||
</Flex>
|
|
||||||
),
|
|
||||||
extra: (
|
|
||||||
<Button
|
|
||||||
size="small"
|
|
||||||
onClick={e => { e.stopPropagation(); handleAllCancel(workspace); }}
|
|
||||||
>
|
|
||||||
{t('application.allCancel')}
|
|
||||||
</Button>
|
|
||||||
),
|
|
||||||
children: (
|
|
||||||
<Row gutter={[12, 12]}>
|
|
||||||
{items.map(item => (
|
|
||||||
<Col key={item.id} span={6} className="rb:bg-[#F6F6F6] rb:rounded-lg rb:py-3! rb:px-4! rb:relative">
|
|
||||||
<div
|
|
||||||
className="rb:absolute rb:top-3 rb:right-3 rb:cursor-pointer rb:size-4 rb:bg-cover rb:bg-[url('@/assets/images/close.svg')]"
|
|
||||||
onClick={() => handleCancelOne(item)}
|
|
||||||
/>
|
|
||||||
<Flex gap={8} align="center">
|
|
||||||
<div className="rb:size-7 rb:rounded-lg rb:bg-[#155eef] rb:flex rb:items-center rb:justify-center rb:text-[14px] rb:text-white">
|
|
||||||
{item.source_app_name[0]}
|
|
||||||
</div>
|
</div>
|
||||||
<div className="rb:font-medium">{item.source_app_name}</div>
|
}
|
||||||
</Flex>
|
<div>
|
||||||
<Flex vertical gap={4} className="rb:mt-3! rb:text-[12px]!">
|
<span className="rb:font-medium">{workspace.target_workspace_name}</span>
|
||||||
<Flex gap={5} justify="space-between">
|
<div className="rb:text-[#5B6167] rb:text-[12px]">{t('application.appCount', { count: items.length })}</div>
|
||||||
<span className="rb:text-[#5B6167]">{t('application.type')}</span>
|
</div>
|
||||||
<span className={clsx({
|
</Flex>
|
||||||
'rb:text-[#155EEF] rb:font-medium': item.source_app_type === 'agent',
|
),
|
||||||
'rb:text-[#369F21] rb:font-medium': item.source_app_type === 'multi_agent',
|
extra: (
|
||||||
})}>
|
<Button
|
||||||
{t(`application.${item.source_app_type}`)}
|
size="small"
|
||||||
</span>
|
onClick={e => { e.stopPropagation(); handleAllCancel(workspace); }}
|
||||||
|
>
|
||||||
|
{t('application.allCancel')}
|
||||||
|
</Button>
|
||||||
|
),
|
||||||
|
children: (
|
||||||
|
<Row gutter={[12, 12]}>
|
||||||
|
{items.map(item => (
|
||||||
|
<Col key={item.id} span={6} className="rb:bg-[#F6F6F6] rb:rounded-lg rb:py-3! rb:px-4! rb:relative">
|
||||||
|
<div
|
||||||
|
className="rb:absolute rb:top-3 rb:right-3 rb:cursor-pointer rb:size-4 rb:bg-cover rb:bg-[url('@/assets/images/close.svg')]"
|
||||||
|
onClick={() => handleCancelOne(item)}
|
||||||
|
/>
|
||||||
|
<Flex gap={8} align="center">
|
||||||
|
<div className="rb:size-7 rb:rounded-lg rb:bg-[#155eef] rb:flex rb:items-center rb:justify-center rb:text-[14px] rb:text-white">
|
||||||
|
{item.source_app_name[0]}
|
||||||
|
</div>
|
||||||
|
<div className="rb:font-medium">{item.source_app_name}</div>
|
||||||
</Flex>
|
</Flex>
|
||||||
<Flex gap={5} justify="space-between">
|
<Flex vertical gap={4} className="rb:mt-3! rb:text-[12px]!">
|
||||||
<span className="rb:text-[#5B6167]">{t('application.version')}</span>
|
<Flex gap={5} justify="space-between">
|
||||||
<span>{item.source_app_version}</span>
|
<span className="rb:text-[#5B6167]">{t('application.type')}</span>
|
||||||
|
<span className={clsx({
|
||||||
|
'rb:text-[#155EEF] rb:font-medium': item.source_app_type === 'agent',
|
||||||
|
'rb:text-[#369F21] rb:font-medium': item.source_app_type === 'multi_agent',
|
||||||
|
})}>
|
||||||
|
{t(`application.${item.source_app_type}`)}
|
||||||
|
</span>
|
||||||
|
</Flex>
|
||||||
|
<Flex gap={5} justify="space-between">
|
||||||
|
<span className="rb:text-[#5B6167]">{t('application.version')}</span>
|
||||||
|
<span>{item.source_app_version}</span>
|
||||||
|
</Flex>
|
||||||
|
<Flex gap={5} justify="space-between">
|
||||||
|
<span className="rb:text-[#5B6167]">{t('application.permission')}</span>
|
||||||
|
<span className={clsx({
|
||||||
|
'rb:text-[#369F21] rb:font-medium': item.permission === 'editable',
|
||||||
|
'rb:text-[#5B6167] rb:font-medium': item.permission === 'readonly',
|
||||||
|
})}>
|
||||||
|
{t(`application.${item.permission}`)}
|
||||||
|
</span>
|
||||||
|
</Flex>
|
||||||
|
<Flex gap={5} justify="space-between">
|
||||||
|
<span className="rb:text-[#5B6167]">{t('application.souceStatus')}</span>
|
||||||
|
<span>{item.source_app_is_active ? t('application.sourceActive') : t('application.sourceInactive')}</span>
|
||||||
|
</Flex>
|
||||||
</Flex>
|
</Flex>
|
||||||
<Flex gap={5} justify="space-between">
|
</Col>
|
||||||
<span className="rb:text-[#5B6167]">{t('application.permission')}</span>
|
))}
|
||||||
<span className={clsx({
|
</Row>
|
||||||
'rb:text-[#369F21] rb:font-medium': item.permission === 'editable',
|
),
|
||||||
'rb:text-[#5B6167] rb:font-medium': item.permission === 'readonly',
|
}]}
|
||||||
})}>
|
/>
|
||||||
{t(`application.${item.permission}`)}
|
))}
|
||||||
</span>
|
</BodyWrapper>
|
||||||
</Flex>
|
</Flex>
|
||||||
<Flex gap={5} justify="space-between">
|
|
||||||
<span className="rb:text-[#5B6167]">{t('application.souceStatus')}</span>
|
|
||||||
<span>{item.source_app_is_active ? t('application.sourceActive') : t('application.sourceInactive')}</span>
|
|
||||||
</Flex>
|
|
||||||
</Flex>
|
|
||||||
</Col>
|
|
||||||
))}
|
|
||||||
</Row>
|
|
||||||
),
|
|
||||||
}]}
|
|
||||||
/>
|
|
||||||
))}
|
|
||||||
</Flex>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user