Skip to content

Commit

Permalink
🎨 chore: 添加触摸空状态提示
Browse files Browse the repository at this point in the history
  • Loading branch information
rdmclin2 committed Jul 14, 2024
1 parent cf9e64e commit 14084ff
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 13 deletions.
13 changes: 10 additions & 3 deletions src/app/settings/Settings/touch/ActionList/List/FemaleList.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Empty } from 'antd';
import { isEqual } from 'lodash-es';
import React, { memo } from 'react';
import { useTranslation } from 'react-i18next';
Expand All @@ -16,19 +17,19 @@ interface AreaListProps {

const AreaList = memo((props: AreaListProps) => {
const { currentTouchArea } = props;
const female = useSettingStore(
const items = useSettingStore(
(s) => configSelectors.getTouchActionsByGenderAndArea(s, GenderEnum.FEMALE, currentTouchArea),
isEqual,
);
const { t } = useTranslation('features');
const { t } = useTranslation(['features', 'panel']);

return (
<>
<Header
title={t('agent.female')}
extra={<AddOrEdit isEdit={false} touchArea={currentTouchArea} gender={GenderEnum.FEMALE} />}
/>
{female.map((item, index) => {
{items.map((item, index) => {
return (
<ListItem
item={item}
Expand All @@ -39,6 +40,12 @@ const AreaList = memo((props: AreaListProps) => {
/>
);
})}
{items.length === 0 && (
<Empty
description={t('touch.noTouchActions', { ns: 'panel' })}
image={Empty.PRESENTED_IMAGE_SIMPLE}
/>
)}
</>
);
});
Expand Down
13 changes: 10 additions & 3 deletions src/app/settings/Settings/touch/ActionList/List/MaleList.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Empty } from 'antd';
import { isEqual } from 'lodash-es';
import React, { memo } from 'react';
import { useTranslation } from 'react-i18next';
Expand All @@ -16,19 +17,19 @@ interface AreaListProps {

const AreaList = memo((props: AreaListProps) => {
const { currentTouchArea } = props;
const touchList = useSettingStore(
const items = useSettingStore(
(s) => configSelectors.getTouchActionsByGenderAndArea(s, GenderEnum.MALE, currentTouchArea),
isEqual,
);
const { t } = useTranslation('features');
const { t } = useTranslation(['features', 'panel']);

return (
<>
<Header
title={t('agent.male')}
extra={<AddOrEdit isEdit={false} touchArea={currentTouchArea} gender={GenderEnum.MALE} />}
/>
{touchList.map((item, index) => {
{items.map((item, index) => {
return (
<ListItem
item={item}
Expand All @@ -39,6 +40,12 @@ const AreaList = memo((props: AreaListProps) => {
/>
);
})}
{items.length === 0 && (
<Empty
description={t('touch.noTouchActions', { ns: 'panel' })}
image={Empty.PRESENTED_IMAGE_SIMPLE}
/>
)}
</>
);
});
Expand Down
13 changes: 10 additions & 3 deletions src/app/settings/Settings/touch/ActionList/List/OtherList.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Empty } from 'antd';
import { isEqual } from 'lodash-es';
import React, { memo } from 'react';
import { useTranslation } from 'react-i18next';
Expand All @@ -16,19 +17,19 @@ interface AreaListProps {

const AreaList = memo((props: AreaListProps) => {
const { currentTouchArea } = props;
const touchList = useSettingStore(
const items = useSettingStore(
(s) => configSelectors.getTouchActionsByGenderAndArea(s, GenderEnum.OTHER, currentTouchArea),
isEqual,
);
const { t } = useTranslation('features');
const { t } = useTranslation(['features', 'panel']);

return (
<>
<Header
title={t('agent.other')}
extra={<AddOrEdit isEdit={false} touchArea={currentTouchArea} gender={GenderEnum.OTHER} />}
/>
{touchList.map((item, index) => {
{items.map((item, index) => {
return (
<ListItem
item={item}
Expand All @@ -39,6 +40,12 @@ const AreaList = memo((props: AreaListProps) => {
/>
);
})}
{items.length === 0 && (
<Empty
description={t('touch.noTouchActions', { ns: 'panel' })}
image={Empty.PRESENTED_IMAGE_SIMPLE}
/>
)}
</>
);
});
Expand Down
3 changes: 2 additions & 1 deletion src/features/MarketInfo/actions/UnSubscribe.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ const UnSubscribe = memo((props: UnSubscribeButtonProps) => {
cancelText={t('cancel')}
description={t('delRoleDesc', { name: agent?.meta.name, ns: 'role' })}
key="delete"
overlayStyle={{ width: 416 }}
okText={t('confirm')}
okButtonProps={{ loading: loading }}
okButtonProps={{ loading: loading, danger: true }}
onConfirm={async () => {
if (!agent) return;
setLoading(true);
Expand Down
1 change: 1 addition & 0 deletions src/locales/default/panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export default {
inputActionEmotion: '请输入角色响应时的表情',
touchActionList: '触摸{{touchArea}}时的反应列表',
touchArea: '触摸区域',
noTouchActions: "暂无自定义响应动作,你可以通过点击 '+' 按钮添加",
},
upload: {
support: '支持单个文件上传,当前仅支持 .vrm 格式文件',
Expand Down
10 changes: 8 additions & 2 deletions src/panels/RolePanel/RoleEdit/Touch/ActionList/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Empty } from 'antd';
import { createStyles } from 'antd-style';
import classNames from 'classnames';
import { get } from 'lodash-es';
Expand Down Expand Up @@ -43,7 +44,9 @@ const AreaList = (props: AreaListProps) => {
const { currentTouchArea, style, className, areaOptions = [] } = props;
const [currentAgentTouch] = useAgentStore((s) => [agentSelectors.currentAgentTouch(s)]);
const { t } = useTranslation('panel');
const data = currentAgentTouch ? (get(currentAgentTouch, currentTouchArea) as TouchAction[]) : [];
const items = currentAgentTouch
? (get(currentAgentTouch, currentTouchArea) as TouchAction[])
: [];

const touchArea = areaOptions.find((item) => item.value === currentTouchArea)?.label;

Expand All @@ -53,7 +56,7 @@ const AreaList = (props: AreaListProps) => {
title={t('touch.touchActionList', { touchArea })}
extra={<AddOrEdit isEdit={false} touchArea={currentTouchArea} />}
/>
{data.map((item, index) => {
{items.map((item, index) => {
return (
<ListItem
key={`${item.text}_${index}`}
Expand All @@ -79,6 +82,9 @@ const AreaList = (props: AreaListProps) => {
/>
);
})}
{items.length === 0 && (
<Empty description={t('touch.noTouchActions')} image={Empty.PRESENTED_IMAGE_SIMPLE} />
)}
</Flexbox>
);
};
Expand Down
2 changes: 1 addition & 1 deletion src/store/session/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ export const createSessionStore: StateCreator<SessionStore, [['zustand/devtools'
set({ sessionList: sessions });

if (activeId === id) {
set({ activeId: sessions[0]?.agentId });
set({ activeId: LOBE_VIDOL_DEFAULT_AGENT_ID });
}
},
sendMessage: async (message: string) => {
Expand Down

0 comments on commit 14084ff

Please sign in to comment.