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

fix: Sender with actions missing SpeechButton #549

Merged
merged 3 commits into from
Feb 21, 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
38 changes: 38 additions & 0 deletions components/sender/__tests__/__snapshots__/demo-extend.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,44 @@ exports[`renders components/sender/demo/actions.tsx extend context correctly 1`]
</span>
</button>
</div>
<div
class="ant-space-item"
>
<button
class="ant-btn ant-btn-text ant-btn-color-primary ant-btn-variant-text ant-btn-icon-only ant-sender-actions-btn ant-sender-actions-btn-disabled"
type="button"
>
<span
class="ant-btn-icon"
>
<span
aria-label="audio-muted"
class="anticon anticon-audio-muted"
role="img"
>
<svg
aria-hidden="true"
data-icon="audio-muted"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<defs>
<style />
</defs>
<path
d="M682 455V311l-76 76v68c-.1 50.7-42 92.1-94 92a95.8 95.8 0 01-52-15l-54 55c29.1 22.4 65.9 36 106 36 93.8 0 170-75.1 170-168z"
/>
<path
d="M833 446h-60c-4.4 0-8 3.6-8 8 0 140.3-113.7 254-254 254-63 0-120.7-23-165-61l-54 54a334.01 334.01 0 00179 81v102H326c-13.9 0-24.9 14.3-25 32v36c.1 4.4 2.9 8 6 8h408c3.2 0 6-3.6 6-8v-36c0-17.7-11-32-25-32H547V782c165.3-17.9 294-157.9 294-328 0-4.4-3.6-8-8-8zm13.1-377.7l-43.5-41.9a8 8 0 00-11.2.1l-129 129C634.3 101.2 577 64 511 64c-93.9 0-170 75.3-170 168v224c0 6.7.4 13.3 1.2 19.8l-68 68A252.33 252.33 0 01258 454c-.2-4.4-3.8-8-8-8h-60c-4.4 0-8 3.6-8 8 0 53 12.5 103 34.6 147.4l-137 137a8.03 8.03 0 000 11.3l42.7 42.7c3.1 3.1 8.2 3.1 11.3 0L846.2 79.8l.1-.1c3.1-3.2 3-8.3-.2-11.4zM417 401V232c0-50.6 41.9-92 94-92 46 0 84.1 32.3 92.3 74.7L417 401z"
/>
</svg>
</span>
</span>
</button>
</div>
<div
class="ant-space-item"
>
Expand Down
38 changes: 38 additions & 0 deletions components/sender/__tests__/__snapshots__/demo.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,44 @@ exports[`renders components/sender/demo/actions.tsx correctly 1`] = `
</span>
</button>
</div>
<div
class="ant-space-item"
>
<button
class="ant-btn ant-btn-text ant-btn-color-primary ant-btn-variant-text ant-btn-icon-only ant-sender-actions-btn ant-sender-actions-btn-disabled"
type="button"
>
<span
class="ant-btn-icon"
>
<span
aria-label="audio-muted"
class="anticon anticon-audio-muted"
role="img"
>
<svg
aria-hidden="true"
data-icon="audio-muted"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<defs>
<style />
</defs>
<path
d="M682 455V311l-76 76v68c-.1 50.7-42 92.1-94 92a95.8 95.8 0 01-52-15l-54 55c29.1 22.4 65.9 36 106 36 93.8 0 170-75.1 170-168z"
/>
<path
d="M833 446h-60c-4.4 0-8 3.6-8 8 0 140.3-113.7 254-254 254-63 0-120.7-23-165-61l-54 54a334.01 334.01 0 00179 81v102H326c-13.9 0-24.9 14.3-25 32v36c.1 4.4 2.9 8 6 8h408c3.2 0 6-3.6 6-8v-36c0-17.7-11-32-25-32H547V782c165.3-17.9 294-157.9 294-328 0-4.4-3.6-8-8-8zm13.1-377.7l-43.5-41.9a8 8 0 00-11.2.1l-129 129C634.3 101.2 577 64 511 64c-93.9 0-170 75.3-170 168v224c0 6.7.4 13.3 1.2 19.8l-68 68A252.33 252.33 0 01258 454c-.2-4.4-3.8-8-8-8h-60c-4.4 0-8 3.6-8 8 0 53 12.5 103 34.6 147.4l-137 137a8.03 8.03 0 000 11.3l42.7 42.7c3.1 3.1 8.2 3.1 11.3 0L846.2 79.8l.1-.1c3.1-3.2 3-8.3-.2-11.4zM417 401V232c0-50.6 41.9-92 94-92 46 0 84.1 32.3 92.3 74.7L417 401z"
/>
</svg>
</span>
</span>
</button>
</div>
<div
class="ant-space-item"
>
Expand Down
3 changes: 2 additions & 1 deletion components/sender/demo/actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,15 @@ const Demo: React.FC = () => {
setLoading(false);
}}
actions={(_, info) => {
const { SendButton, LoadingButton, ClearButton } = info.components;
const { SendButton, LoadingButton, ClearButton, SpeechButton } = info.components;

return (
<Space size="small">
<Typography.Text type="secondary">
<small>`Shift + Enter` to submit</small>
</Typography.Text>
<ClearButton />
<SpeechButton />
{loading ? (
<LoadingButton type="default" icon={<Spin size="small" />} disabled />
) : (
Expand Down
2 changes: 2 additions & 0 deletions components/sender/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export type ActionsRender = (
SendButton: React.ComponentType<ButtonProps>;
ClearButton: React.ComponentType<ButtonProps>;
LoadingButton: React.ComponentType<ButtonProps>;
SpeechButton: React.ComponentType<ButtonProps>;
};
},
) => React.ReactNode;
Expand Down Expand Up @@ -270,6 +271,7 @@ const ForwardSender = React.forwardRef<SenderRef, SenderProps>((props, ref) => {
SendButton,
ClearButton,
LoadingButton,
SpeechButton,
},
});
} else if (actions) {
Expand Down
Loading