Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 对话列表最后一条常态化显示action #25

Merged
merged 1 commit into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/ChatItem/demos/Tmarkdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
avatar={avatar}
editing={edit}
onEditingChange={setEdit}
type="pure"

Check warning on line 58 in src/ChatItem/demos/Tmarkdown.tsx

View check run for this annotation

Codecov / codecov/patch

src/ChatItem/demos/Tmarkdown.tsx#L58

Added line #L58 was not covered by tests
/>
</StoryBook>
);
Expand Down
2 changes: 2 additions & 0 deletions src/ChatItem/demos/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@
}
avatar={avatar}
editing={edit}
isLatest={true}

Check warning on line 51 in src/ChatItem/demos/index.tsx

View check run for this annotation

Codecov / codecov/patch

src/ChatItem/demos/index.tsx#L51

Added line #L51 was not covered by tests
onEditingChange={setEdit}
type="pure"

Check warning on line 53 in src/ChatItem/demos/index.tsx

View check run for this annotation

Codecov / codecov/patch

src/ChatItem/demos/index.tsx#L53

Added line #L53 was not covered by tests
/>
</StoryBook>
);
Expand Down
4 changes: 3 additions & 1 deletion src/ChatItem/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
import BorderSpacing from '@lobehub/ui/es/chat/ChatItem/components/BorderSpacing';
import ErrorContent from '@lobehub/ui/es/chat/ChatItem/components/ErrorContent';
import Title from '@lobehub/ui/es/chat/ChatItem/components/Title';
import { useStyles } from '@lobehub/ui/es/chat/ChatItem/style';
import { useResponsive } from 'antd-style';
import { memo } from 'react';
import { Flexbox } from 'react-layout-kit';

import MessageContent from './components/MessageContent';
import { useStyles } from './style';

Check warning on line 13 in src/ChatItem/index.tsx

View check run for this annotation

Codecov / codecov/patch

src/ChatItem/index.tsx#L13

Added line #L13 was not covered by tests
import { ChatItemProps } from './type';

const MOBILE_AVATAR_SIZE = 32;
Expand Down Expand Up @@ -42,6 +42,7 @@
fontSize,
markdownProps,
markdownClassname,
isLatest,

Check warning on line 45 in src/ChatItem/index.tsx

View check run for this annotation

Codecov / codecov/patch

src/ChatItem/index.tsx#L45

Added line #L45 was not covered by tests
...rest
}) => {
const { mobile } = useResponsive();
Expand All @@ -53,6 +54,7 @@
time,
title: avatar.title,
type,
isLatest,

Check warning on line 57 in src/ChatItem/index.tsx

View check run for this annotation

Codecov / codecov/patch

src/ChatItem/index.tsx#L57

Added line #L57 was not covered by tests
});

return (
Expand Down
6 changes: 4 additions & 2 deletions src/ChatItem/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
avatarSize,
editing,
time,
isLatest,

Check warning on line 15 in src/ChatItem/style.ts

View check run for this annotation

Codecov / codecov/patch

src/ChatItem/style.ts#L15

Added line #L15 was not covered by tests
}: {
avatarSize?: number;
editing?: boolean;
Expand All @@ -21,6 +22,7 @@
time?: number;
title?: string;
type?: 'block' | 'pure';
isLatest?: boolean;
}
) => {
const blockStylish = css`
Expand Down Expand Up @@ -101,8 +103,8 @@

time,
div[role='menubar'] {
pointer-events: none;
opacity: 0;
pointer-events: ${isLatest ? 'unset' : 'none'};
opacity: ${isLatest ? 1 : 0};

Check warning on line 107 in src/ChatItem/style.ts

View check run for this annotation

Codecov / codecov/patch

src/ChatItem/style.ts#L106-L107

Added lines #L106 - L107 were not covered by tests
transition: opacity 200ms ${token.motionEaseOut};
}

Expand Down
4 changes: 4 additions & 0 deletions src/ChatItem/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,8 @@ export interface ChatItemProps {
* @description The markdownClassname of the chat item
*/
markdownClassname?: string;
/**
* @description Whether this message is latest
*/
isLatest?: boolean;
}
Loading