fix(clients): keep the client form footer inside a phone screen

The "Usage & change history" button made the edit form's footer four
labelled buttons in one row that cannot wrap. On a phone that row is
wider than the modal, so the modal grew past the screen and Cancel and
Save ended up outside it.

Below 768px the two extra actions, Reset Traffic and the history button,
now show only their icon and keep their name as an aria-label, so the
row fits again. The row may also wrap, as a guard for a locale whose
Cancel and Save labels are unusually long. Wider screens are unchanged.

Layout is out of reach of the jsdom tests. Measured in headless Chromium
at 360px on a running panel: before, three of the four buttons lay
outside the viewport; after, all four sit on one row inside it in
en-US, fa-IR and ru-RU, and at 1280px the labels are still shown.
This commit is contained in:
Sanaei
2026-11-29 15:00:25 +03:30
parent c23e1cb231
commit af917bc0af
2 changed files with 32 additions and 2 deletions
@@ -3,3 +3,29 @@
.client-form-modal .ant-tabs-content > .ant-form-item:last-child {
margin-bottom: 0;
}
/* Four labelled buttons are wider than a phone and would widen the modal past the
screen, so below the md breakpoint the two extra actions keep only their icon. */
.client-form-footer {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 8px;
}
.client-form-footer-actions {
display: flex;
gap: 8px;
margin-inline-start: auto;
}
@media (max-width: 767px) {
.client-form-footer-extra.ant-btn {
padding-inline: 0;
width: 32px;
}
.client-form-footer-extra.ant-btn > span:not(.ant-btn-icon) {
display: none;
}
}
@@ -890,7 +890,7 @@ export default function ClientFormModal({
onCancel={close}
afterClose={() => setActiveTab('basic')}
footer={
<div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
<div className="client-form-footer">
{isEdit && resetTraffic && (
<Popconfirm
title={t('pages.inbounds.resetTraffic')}
@@ -901,10 +901,12 @@ export default function ClientFormModal({
onConfirm={onResetTraffic}
>
<Button
className="client-form-footer-extra"
color="danger"
variant="filled"
icon={<RetweetOutlined aria-hidden />}
loading={resetting}
aria-label={t('pages.inbounds.resetTraffic')}
>
{t('pages.inbounds.resetTraffic')}
</Button>
@@ -912,13 +914,15 @@ export default function ClientFormModal({
)}
{isEdit && client?.email && (
<Button
className="client-form-footer-extra"
icon={<HistoryOutlined aria-hidden />}
aria-label={t('pages.clients.usageHistory')}
onClick={() => setUsageHistoryOpen(true)}
>
{t('pages.clients.usageHistory')}
</Button>
)}
<div style={{ marginInlineStart: 'auto', display: 'flex', gap: 8 }}>
<div className="client-form-footer-actions">
<Button onClick={close}>{t('cancel')}</Button>
<Button type="primary" loading={submitting} onClick={onSubmit}>
{isEdit ? t('save') : t('create')}