mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-07-11 15:16:07 +00:00
feat(sub): add Copy All Configs button to subscription page (#5163)
* feat(sub): add Copy All Configs button to subscription page * fix(sub): include links in copyAll dependency array Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * chore: fmt * fix(sub): drop module-level links from copyAll deps to satisfy exhaustive-deps links is derived from window.__SUB_PAGE_DATA__ at module scope, so listing it in the useCallback dependency array triggers a react-hooks/exhaustive-deps warning (outer-scope value). Matches the existing single-link copy callback's deps. --------- Co-authored-by: nikan <nikan> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Co-authored-by: Sanaei <ho3ein.sanaei@gmail.com>
This commit is contained in:
@@ -111,6 +111,13 @@ export default function SubPage() {
|
||||
if (ok) messageApi.success(t('copied'));
|
||||
}, [t, messageApi]);
|
||||
|
||||
const copyAll = useCallback(async () => {
|
||||
if (links.length === 0) return;
|
||||
const allLinks = links.join('\n');
|
||||
const ok = await ClipboardManager.copyText(allLinks);
|
||||
if (ok) messageApi.success(t('subscription.copyAllConfigsCopied'));
|
||||
}, [t, messageApi]);
|
||||
|
||||
const open = useCallback((url: string) => {
|
||||
if (!url) return;
|
||||
window.open(url, '_blank');
|
||||
@@ -393,6 +400,18 @@ export default function SubPage() {
|
||||
<>
|
||||
<Divider>{t('pages.inbounds.copyLink')}</Divider>
|
||||
<div className="links-section">
|
||||
<div className="sub-link-row">
|
||||
<span className="sub-link-title">{t('subscription.copyAllConfigs')}</span>
|
||||
<div className="sub-link-actions">
|
||||
<Button
|
||||
size="small"
|
||||
icon={<CopyOutlined />}
|
||||
onClick={copyAll}
|
||||
aria-label={t('subscription.copyAllConfigs')}
|
||||
title={t('subscription.copyAllConfigs')}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
{links.map((link, idx) => {
|
||||
const parts = parseLinkParts(link, linkEmails[idx] || '');
|
||||
const fallback = `Link ${idx + 1}`;
|
||||
|
||||
Reference in New Issue
Block a user