優化個人資料顯示邏輯:移除不必要的onToggleProfile回調,簡化ProfileCard組件的屬性,並調整按鈕顯示內容。
This commit is contained in:
@@ -32,10 +32,9 @@ import { FriendSelectionItem } from "@/components/FriendSelection/data";
|
||||
import styles from "./Person.module.scss";
|
||||
interface PersonProps {
|
||||
contract: ContractData | weChatGroup;
|
||||
onToggleProfile?: () => void;
|
||||
}
|
||||
|
||||
const Person: React.FC<PersonProps> = ({ contract, onToggleProfile }) => {
|
||||
const Person: React.FC<PersonProps> = ({ contract }) => {
|
||||
const [messageApi, contextHolder] = message.useMessage();
|
||||
const [isEditingRemark, setIsEditingRemark] = useState(false);
|
||||
const [remarkValue, setRemarkValue] = useState(contract.conRemark || "");
|
||||
@@ -504,10 +503,6 @@ const Person: React.FC<PersonProps> = ({ contract, onToggleProfile }) => {
|
||||
chatroomOperateType: 4, // 4 for quit
|
||||
});
|
||||
messageApi.success("已退出群聊");
|
||||
// 可能还需要一个回调来关闭侧边栏或切换到另一个聊天
|
||||
if (onToggleProfile) {
|
||||
onToggleProfile();
|
||||
}
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
@@ -11,10 +11,9 @@ const { Sider } = Layout;
|
||||
|
||||
interface PersonProps {
|
||||
contract: ContractData | weChatGroup;
|
||||
onToggleProfile?: () => void;
|
||||
}
|
||||
|
||||
const Person: React.FC<PersonProps> = ({ contract, onToggleProfile }) => {
|
||||
const Person: React.FC<PersonProps> = ({ contract }) => {
|
||||
const [activeKey, setActiveKey] = useState("profile");
|
||||
const isGroup = "chatroomId" in contract;
|
||||
console.log(contract);
|
||||
@@ -50,12 +49,7 @@ const Person: React.FC<PersonProps> = ({ contract, onToggleProfile }) => {
|
||||
/>
|
||||
}
|
||||
>
|
||||
{activeKey === "profile" && (
|
||||
<ProfileModules
|
||||
contract={contract}
|
||||
onToggleProfile={onToggleProfile}
|
||||
/>
|
||||
)}
|
||||
{activeKey === "profile" && <ProfileModules contract={contract} />}
|
||||
{activeKey === "quickwords" && (
|
||||
<QuickWords
|
||||
words={[]}
|
||||
|
||||
@@ -3,7 +3,6 @@ import { Layout, Button, Avatar, Space, Tooltip, Dropdown } from "antd";
|
||||
import {
|
||||
UserOutlined,
|
||||
TeamOutlined,
|
||||
InfoCircleOutlined,
|
||||
RobotOutlined,
|
||||
DownOutlined,
|
||||
} from "@ant-design/icons";
|
||||
@@ -107,12 +106,9 @@ const ChatWindow: React.FC<ChatWindowProps> = ({ contract }) => {
|
||||
)}
|
||||
|
||||
<Tooltip title="个人资料">
|
||||
<Button
|
||||
onClick={onToggleProfile}
|
||||
type="text"
|
||||
icon={<InfoCircleOutlined />}
|
||||
className={styles.headerButton}
|
||||
/>
|
||||
<Button onClick={onToggleProfile} icon={<UserOutlined />}>
|
||||
客户信息
|
||||
</Button>
|
||||
</Tooltip>
|
||||
</Space>
|
||||
</Header>
|
||||
@@ -127,11 +123,9 @@ const ChatWindow: React.FC<ChatWindowProps> = ({ contract }) => {
|
||||
</Layout>
|
||||
|
||||
{/* 右侧个人资料卡片 */}
|
||||
<ProfileCard
|
||||
contract={contract}
|
||||
showProfile={showProfile}
|
||||
onToggleProfile={onToggleProfile}
|
||||
/>
|
||||
{showProfile && (
|
||||
<ProfileCard contract={contract} onToggleProfile={onToggleProfile} />
|
||||
)}
|
||||
</Layout>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user