fix: show sub-rows for single-subscription users + fix floating bar position

- Auto-expand ALL users with subscriptions (was only > 1), so users
  with single subscription also show their sub-row for selection
- FloatingActionBar: render via createPortal to document.body to
  ensure fixed positioning works correctly regardless of parent
  overflow/transform contexts (was trapped inside scrollable area)
This commit is contained in:
Fringg
2026-04-24 06:59:55 +03:00
parent c726d3d74e
commit 3cb15177cc

View File

@@ -1,4 +1,5 @@
import React, { useState, useEffect, useCallback, useMemo, useRef } from 'react';
import { createPortal } from 'react-dom';
import { useNavigate } from 'react-router';
import { useTranslation } from 'react-i18next';
import {
@@ -1451,10 +1452,10 @@ export default function AdminBulkActions() {
);
setUsers(data.users);
setTotal(data.total);
// Auto-expand all users with multiple subscriptions
// Auto-expand all users who have subscriptions
const autoExpand: Record<number, boolean> = {};
for (const u of data.users) {
if ((u.subscriptions?.length ?? 0) > 1) {
if ((u.subscriptions?.length ?? 0) > 0) {
autoExpand[u.id] = true;
}
}
@@ -2181,7 +2182,8 @@ export default function AdminBulkActions() {
</div>
)}
{/* Floating action bar */}
{/* Floating action bar — portal to body for correct fixed positioning */}
{createPortal(
<FloatingActionBar
selectedUserCount={selectedUserIds.length}
selectedSubscriptionCount={selectedSubscriptionIds.length}
@@ -2189,7 +2191,9 @@ export default function AdminBulkActions() {
totalVisibleSubscriptionCount={allVisibleSubscriptionIds.length}
onAction={handleOpenAction}
onToggleAllSubscriptions={toggleAllSubscriptions}
/>
/>,
document.body,
)}
{/* Action modal */}
<ActionModal