diff --git a/frontend/src/components/ServerGroupsManagerModal.jsx b/frontend/src/components/ServerGroupsManagerModal.jsx
index 5e3005ec..2d403aa1 100644
--- a/frontend/src/components/ServerGroupsManagerModal.jsx
+++ b/frontend/src/components/ServerGroupsManagerModal.jsx
@@ -12,7 +12,7 @@ const ServerGroupsManagerModal = ({
opened={isOpen}
onClose={onClose}
title="Server Groups"
- size="lg"
+ size="md"
centered
>
{isOpen ? (
diff --git a/frontend/src/components/tables/ServerGroupsTable.jsx b/frontend/src/components/tables/ServerGroupsTable.jsx
index acad57f4..54500294 100644
--- a/frontend/src/components/tables/ServerGroupsTable.jsx
+++ b/frontend/src/components/tables/ServerGroupsTable.jsx
@@ -11,42 +11,39 @@ import {
Button,
Center,
Flex,
- Paper,
Stack,
Text,
} from '@mantine/core';
import { SquareMinus, SquarePen, SquarePlus } from 'lucide-react';
import { CustomTable, useTable } from './CustomTable';
-import useLocalStorage from '../../hooks/useLocalStorage';
import './table.css';
-const RowActions = ({ row, editServerGroup, deleteServerGroup }) => {
- return (
-
- editServerGroup(row.original)}
- >
-
-
- deleteServerGroup(row.original.id)}
- >
-
-
-
- );
-};
+const TABLE_WIDTH = 360;
+const ACTIONS_COLUMN_SIZE = 76;
+const ACCOUNTS_COLUMN_SIZE = 72;
-const ServerGroupsTable = ({
- onGroupCreated,
- openCreateOnMount = false,
-}) => {
+const RowActions = ({ row, editServerGroup, deleteServerGroup }) => (
+
+ editServerGroup(row.original)}
+ >
+
+
+ deleteServerGroup(row.original.id)}
+ >
+
+
+
+);
+
+const ServerGroupsTable = ({ onGroupCreated, openCreateOnMount = false }) => {
const [serverGroup, setServerGroup] = useState(null);
const [serverGroupModalOpen, setServerGroupModalOpen] = useState(false);
const [confirmDeleteOpen, setConfirmDeleteOpen] = useState(false);
@@ -63,7 +60,6 @@ const ServerGroupsTable = ({
(state) => state.fetchServerGroups
);
const playlists = usePlaylistsStore((state) => state.playlists);
- const [tableSize] = useLocalStorage('table-size', 'default');
const tableData = useMemo(
() =>
@@ -81,22 +77,33 @@ const ServerGroupsTable = ({
{
header: 'Name',
accessorKey: 'name',
- size: 150,
- cell: ({ cell }) => {cell.getValue()} ,
+ grow: true,
+ minSize: 100,
+ cell: ({ cell }) => (
+
+ {cell.getValue()}
+
+ ),
},
{
header: 'Accounts',
accessorKey: 'accountCount',
- size: 80,
- cell: ({ cell }) => {cell.getValue() ?? 0} ,
+ size: ACCOUNTS_COLUMN_SIZE,
+ minSize: 65,
+ cell: ({ cell }) => (
+
+ {cell.getValue() ?? 0}
+
+ ),
},
{
id: 'actions',
header: 'Actions',
- size: tableSize == 'compact' ? 50 : 75,
+ size: ACTIONS_COLUMN_SIZE,
+ minSize: 65,
},
],
- [tableSize]
+ []
);
const [isLoading, setIsLoading] = useState(true);
@@ -160,20 +167,19 @@ const ServerGroupsTable = ({
);
- const renderBodyCell = ({ row }) => {
- return (
-
- );
- };
+ const renderBodyCell = ({ row }) => (
+
+ );
const table = useTable({
columns,
data: tableData,
allRowIds: tableData.map((group) => group.id),
+ enableColumnResizing: false,
bodyCellRenderFns: {
actions: renderBodyCell,
},
@@ -186,23 +192,23 @@ const ServerGroupsTable = ({
if (isLoading) {
return (
-
+
Loading server groups...
);
}
return (
-
-
-
-
+
+
+ Group accounts that share the same provider login so their connection
+ limits are enforced together. Assign a group when editing an M3U
+ account.
+
+
+
+
+
}
variant="light"
@@ -220,32 +226,28 @@ const ServerGroupsTable = ({
Add Server Group
-
-
-
-
-
-
-
-
-
+
+ {tableData.length === 0 ? (
+
+
+ No server groups yet.
+
+
+ ) : (
+
+ )}
+
+
+
({
default: () => null,
}));
-vi.mock('../../../hooks/useLocalStorage', () => ({
- default: () => ['default', vi.fn()],
-}));
-
describe('ServerGroupsTable', () => {
beforeEach(() => {
vi.clearAllMocks();