Skip to content

Commit 6965d8c

Browse files
committed
refactor: internal squad drawer
1 parent f7aea17 commit 6965d8c

File tree

21 files changed

+293
-781
lines changed

21 files changed

+293
-781
lines changed

package-lock.json

Lines changed: 19 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
"@monaco-editor/react": "^4.7.0",
6060
"@noble/post-quantum": "^0.5.2",
6161
"@paralleldrive/cuid2": "2.2.2",
62-
"@remnawave/backend-contract": "2.3.10",
62+
"@remnawave/backend-contract": "2.3.11",
6363
"@simplewebauthn/browser": "^13.2.2",
6464
"@stablelib/base64": "^2.0.1",
6565
"@stablelib/x25519": "^2.0.1",
@@ -87,7 +87,7 @@
8787
"json-edit-react": "^1.29.0",
8888
"lodash": "^4.17.21",
8989
"lottie-react": "^2.4.1",
90-
"mantine-datatable": "8.3.6",
90+
"mantine-datatable": "8.3.8",
9191
"mantine-form-zod-resolver": "^1.3.0",
9292
"mantine-react-table": "^2.0.0-beta.9",
9393
"monaco-editor": "^0.52.2",
@@ -104,6 +104,7 @@
104104
"react-layout-masonry": "^2.0.0",
105105
"react-markdown": "^10.1.0",
106106
"react-router-dom": "6.27.0",
107+
"react-virtuoso": "^4.14.1",
107108
"recharts": "^2.15.3",
108109
"rehype-raw": "^7.0.0",
109110
"remark-gfm": "^4.0.1",

src/entities/dashboard/modal-store/modal-states.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import {
22
GetConfigProfilesCommand,
33
GetInfraProvidersCommand,
4-
GetInternalSquadsCommand,
54
UpdateHostCommand
65
} from '@remnawave/backend-contract'
76

@@ -48,7 +47,9 @@ export interface ModalInternalStates {
4847
INTERNAL_SQUAD_ACCESSIBLE_NODES_DRAWER: {
4948
squadUuid: string
5049
}
51-
INTERNAL_SQUAD_SHOW_INBOUNDS: GetInternalSquadsCommand.Response['response']['internalSquads'][number]
50+
INTERNAL_SQUAD_SHOW_INBOUNDS: {
51+
squadUuid: string
52+
}
5253
RENAME_SQUAD_OR_CONFIG_PROFILE_MODAL: {
5354
name: string
5455
uuid: string

src/features/ui/dashboard/internal-squads/header-action-buttons/header-action-buttons.feature.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ export const InternalSquadsHeaderActionButtonsFeature = (props: IProps) => {
5858
nameField.reset()
5959
handleUpdate()
6060

61-
openModalWithData(MODALS.INTERNAL_SQUAD_SHOW_INBOUNDS, data)
61+
openModalWithData(MODALS.INTERNAL_SQUAD_SHOW_INBOUNDS, {
62+
squadUuid: data.uuid
63+
})
6264
},
6365

6466
onError: (error) => {

src/pages/dashboard/config-profiles/components/config-profiles.page.component.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { useTranslation } from 'react-i18next'
33
import { ConfigProfilesSpotlightWidget } from '@widgets/dashboard/config-profiles/config-profiles-spotlight/config-profiles-spotlight'
44
import { ConfigProfilesGridWidget } from '@widgets/dashboard/config-profiles/config-profiles-grid/config-profiles-grid.widget'
55
import { ConfigProfilesHeaderActionButtonsFeature } from '@features/ui/dashboard/config-profiles/header-action-buttons'
6+
import { InternalSquadsDrawerWithStore } from '@widgets/dashboard/users/internal-squads-drawer-with-store'
67
import { PageHeaderShared } from '@shared/ui/page-header/page-header.shared'
78
import { RenameModalShared } from '@shared/ui/modals/rename-modal.shared'
89
import { XrayLogo } from '@shared/ui/logos'
@@ -35,6 +36,7 @@ export const ConfigPageComponent = (props: Props) => {
3536
)}
3637

3738
<RenameModalShared key="rename-config-profile-modal" renameFrom="configProfile" />
39+
<InternalSquadsDrawerWithStore key="internal-squads-drawer-with-store" />
3840
</Page>
3941
)
4042
}

src/pages/dashboard/users/ui/components/users.page.component.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { Stack } from '@mantine/core'
66

77
import { UserAccessibleNodesModalWidget } from '@widgets/dashboard/users/user-accessible-nodes-modal/user-accessible-nodes.modal.widget'
88
import { DetailedUserInfoDrawerWidget } from '@widgets/dashboard/users/detailed-user-info-drawer/detailed-user-info-drawer.widget'
9+
import { InternalSquadsDrawerWithStore } from '@widgets/dashboard/users/internal-squads-drawer-with-store'
910
import { MobileWarningOverlay } from '@shared/ui/mobile-warning-overlay/mobile-warning-overlay'
1011
import { CreateUserModalWidget } from '@widgets/dashboard/users/create-user-modal'
1112
import { ViewUserModal } from '@widgets/dashboard/users/view-user-modal'
@@ -54,6 +55,7 @@ export default function UsersPageComponent() {
5455
<CreateUserModalWidget key="create-user-widget" />
5556
<DetailedUserInfoDrawerWidget key="detailed-user-info-drawer" />
5657
<UserAccessibleNodesModalWidget key="user-accessible-nodes-modal" />
58+
<InternalSquadsDrawerWithStore key="internal-squads-drawer-with-store" />
5759
</Page>
5860
)
5961
}

src/shared/ui/config-profiles/config-profile-card/config-profile-card.shared.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ export const ConfigProfileCardShared = memo((props: IProps) => {
3030
onInboundToggle,
3131
onSelectAllInbounds,
3232
onUnselectAllInbounds,
33-
3433
isOpen
3534
} = props
3635

Lines changed: 37 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import { Badge, Card, Group, Text } from '@mantine/core'
22
import { TbCirclesRelation } from 'react-icons/tb'
33
import { PiTag, PiUsers } from 'react-icons/pi'
4-
import { useDisclosure } from '@mantine/hooks'
54
import { memo } from 'react'
65

7-
import { InternalSquadsDrawer } from '@widgets/dashboard/users/internal-squads-drawer'
6+
import { MODALS, useModalsStoreOpenWithData } from '@entities/dashboard/modal-store'
87
import { formatInt } from '@shared/utils/misc'
98

109
import classes from './Checkbox.module.css'
@@ -13,58 +12,49 @@ import { IProps } from './interfaces'
1312
export const InternalSquadCardShared = memo((props: IProps) => {
1413
const { internalSquad } = props
1514

16-
const [opened, handlers] = useDisclosure(false)
15+
const openModalWithData = useModalsStoreOpenWithData()
16+
17+
const handleOpenEditModal = (squadUuid: string) => {
18+
openModalWithData(MODALS.INTERNAL_SQUAD_SHOW_INBOUNDS, {
19+
squadUuid
20+
})
21+
}
1722

1823
if (!internalSquad) {
1924
return null
2025
}
2126

2227
return (
23-
<>
24-
<Card
25-
className={classes.compactRoot}
26-
key={internalSquad.uuid}
27-
onClick={() => {
28-
handlers.open()
29-
}}
30-
>
31-
<Group align="center" gap="xs" justify="space-between" wrap="nowrap">
32-
<Group align="center" gap="xs" style={{ flex: 1, minWidth: 0 }} wrap="nowrap">
33-
<TbCirclesRelation size={20} />
34-
<Text className={classes.compactLabel} size="xs" truncate>
35-
{internalSquad.name}
36-
</Text>
37-
</Group>
38-
39-
<Group gap="xs" wrap="nowrap">
40-
<Badge
41-
color="teal"
42-
leftSection={<PiUsers size="16" />}
43-
size="md"
44-
variant="light"
45-
visibleFrom="sm"
46-
>
47-
{formatInt(internalSquad.info.membersCount, {
48-
thousandSeparator: ','
49-
})}{' '}
50-
</Badge>
51-
<Badge
52-
color="blue"
53-
leftSection={<PiTag size="16" />}
54-
size="md"
55-
variant="light"
56-
>
57-
{internalSquad.info.inboundsCount}
58-
</Badge>
59-
</Group>
28+
<Card
29+
className={classes.compactRoot}
30+
key={internalSquad.uuid}
31+
onClick={() => handleOpenEditModal(internalSquad.uuid)}
32+
>
33+
<Group align="center" gap="xs" justify="space-between" wrap="nowrap">
34+
<Group align="center" gap="xs" style={{ flex: 1, minWidth: 0 }} wrap="nowrap">
35+
<TbCirclesRelation size={20} />
36+
<Text className={classes.compactLabel} size="xs" truncate>
37+
{internalSquad.name}
38+
</Text>
6039
</Group>
61-
</Card>
6240

63-
<InternalSquadsDrawer
64-
internalSquad={internalSquad}
65-
onClose={handlers.close}
66-
opened={opened}
67-
/>
68-
</>
41+
<Group gap="xs" wrap="nowrap">
42+
<Badge
43+
color="teal"
44+
leftSection={<PiUsers size="16" />}
45+
size="md"
46+
variant="light"
47+
visibleFrom="sm"
48+
>
49+
{formatInt(internalSquad.info.membersCount, {
50+
thousandSeparator: ','
51+
})}{' '}
52+
</Badge>
53+
<Badge color="blue" leftSection={<PiTag size="16" />} size="md" variant="light">
54+
{internalSquad.info.inboundsCount}
55+
</Badge>
56+
</Group>
57+
</Group>
58+
</Card>
6959
)
7060
})

0 commit comments

Comments
 (0)