Skip to content

Commit 64b86f3

Browse files
committed
feat: add detailed user usage traffic statistics
- Upgraded @remnawave/backend-contract in package.json and package-lock.json. - Added new localization entries for user deletion confirmation in English, Persian, and Russian locale files. - Improved DeleteUserFeature to utilize translations for modal prompts. - Enhanced ViewUserModal to include GetUserUsageFeature for better user insights.
1 parent 94b6f80 commit 64b86f3

File tree

17 files changed

+786
-64
lines changed

17 files changed

+786
-64
lines changed

package-lock.json

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"@mantine/nprogress": "^7.17.2",
4646
"@monaco-editor/react": "^4.7.0",
4747
"@paralleldrive/cuid2": "2.2.2",
48-
"@remnawave/backend-contract": "0.3.49",
48+
"@remnawave/backend-contract": "0.3.52",
4949
"@stablelib/base64": "^2.0.1",
5050
"@stablelib/x25519": "^2.0.1",
5151
"@tabler/icons-react": "^3.31.0",

public/locales/en/remnawave.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -728,5 +728,41 @@
728728
"show-links": "Show links",
729729
"no-available-hosts-found-for-this-user": "No available hosts found for this user"
730730
}
731+
},
732+
"delete-user": {
733+
"feature": {
734+
"delete-user": "Delete user",
735+
"are-you-sure": "Are you sure you want to delete the user? This action is irreversible.",
736+
"delete": "Delete",
737+
"cancel": "Cancel"
738+
}
739+
},
740+
"user-usage-modal": {
741+
"widget": {
742+
"no-data-available-for-the-selected-period": "No data available for the selected period",
743+
"no-data-available": "No data available",
744+
"click-to-show-all": "Click to show all",
745+
"click-to-highlight-only-this-node": "Click to highlight only this node",
746+
"traffic-statistics": "Traffic statistics",
747+
"usage-by-period": "Usage by period",
748+
"7-days": "7 days",
749+
"14-days": "14 days",
750+
"30-days": "30 days",
751+
"60-days": "60 days",
752+
"90-days": "90 days",
753+
"180-days": "180 days",
754+
"365-days": "365 days",
755+
"total-traffic": "Total traffic",
756+
"top-nodes": "Top nodes",
757+
"stacked": "Stacked",
758+
"grouped": "Grouped",
759+
"filter-nodes": "Filter nodes",
760+
"bar-chart": "Bar chart"
761+
}
762+
},
763+
"get-user-usage": {
764+
"feature": {
765+
"show-usage": "Show usage"
766+
}
731767
}
732768
}

public/locales/fa/remnawave.json

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -728,5 +728,41 @@
728728
"subscription-links": "پیوندهای اشتراک",
729729
"no-available-hosts-found-for-this-user": "هیچ میزبان موجود برای این کاربر یافت نمی شود"
730730
}
731+
},
732+
"delete-user": {
733+
"feature": {
734+
"delete-user": "Delete user",
735+
"are-you-sure": "Are you sure you want to delete the user? This action is irreversible.",
736+
"delete": "Delete",
737+
"cancel": "Cancel"
738+
}
739+
},
740+
"user-usage-modal": {
741+
"widget": {
742+
"no-data-available-for-the-selected-period": "No data available for the selected period",
743+
"no-data-available": "No data available",
744+
"click-to-show-all": "Click to show all",
745+
"click-to-highlight-only-this-node": "Click to highlight only this node",
746+
"traffic-statistics": "Traffic statistics",
747+
"usage-by-period": "Usage by period",
748+
"7-days": "7 days",
749+
"14-days": "14 days",
750+
"30-days": "30 days",
751+
"60-days": "60 days",
752+
"90-days": "90 days",
753+
"180-days": "180 days",
754+
"365-days": "365 days",
755+
"total-traffic": "Total traffic",
756+
"top-nodes": "Top nodes",
757+
"stacked": "Stacked",
758+
"grouped": "Grouped",
759+
"filter-nodes": "Filter nodes",
760+
"bar-chart": "Bar chart"
761+
}
762+
},
763+
"get-user-usage": {
764+
"feature": {
765+
"show-usage": "Show usage"
766+
}
731767
}
732-
}
768+
}

public/locales/ru/remnawave.json

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -728,5 +728,41 @@
728728
"subscription-links": "Подписные ссылки",
729729
"no-available-hosts-found-for-this-user": "Для этого пользователя не найдено доступных хостов"
730730
}
731+
},
732+
"delete-user": {
733+
"feature": {
734+
"delete-user": "Delete user",
735+
"are-you-sure": "Are you sure you want to delete the user? This action is irreversible.",
736+
"delete": "Delete",
737+
"cancel": "Cancel"
738+
}
739+
},
740+
"user-usage-modal": {
741+
"widget": {
742+
"no-data-available-for-the-selected-period": "No data available for the selected period",
743+
"no-data-available": "No data available",
744+
"click-to-show-all": "Click to show all",
745+
"click-to-highlight-only-this-node": "Click to highlight only this node",
746+
"traffic-statistics": "Traffic statistics",
747+
"usage-by-period": "Usage by period",
748+
"7-days": "7 days",
749+
"14-days": "14 days",
750+
"30-days": "30 days",
751+
"60-days": "60 days",
752+
"90-days": "90 days",
753+
"180-days": "180 days",
754+
"365-days": "365 days",
755+
"total-traffic": "Total traffic",
756+
"top-nodes": "Top nodes",
757+
"stacked": "Stacked",
758+
"grouped": "Grouped",
759+
"filter-nodes": "Filter nodes",
760+
"bar-chart": "Bar chart"
761+
}
762+
},
763+
"get-user-usage": {
764+
"feature": {
765+
"show-usage": "Show usage"
766+
}
731767
}
732-
}
768+
}

src/features/ui/dashboard/users/delete-user/delete-user.feature.tsx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { ActionIcon, Text, Tooltip } from '@mantine/core'
22
import { PiTrashDuotone } from 'react-icons/pi'
3+
import { useTranslation } from 'react-i18next'
34
import { modals } from '@mantine/modals'
45

56
import { useUserModalStoreActions } from '@entities/dashboard/user-modal-store/user-modal-store'
@@ -9,6 +10,8 @@ import { IProps } from './interfaces'
910

1011
export function DeleteUserFeature(props: IProps) {
1112
const { userUuid } = props
13+
const { t } = useTranslation()
14+
1215
const actions = useUserModalStoreActions()
1316

1417
const { mutate: deleteUser, isPending: isDeleteUserPending } = useDeleteUser({
@@ -29,21 +32,20 @@ export function DeleteUserFeature(props: IProps) {
2932

3033
const openModal = () =>
3134
modals.openConfirmModal({
32-
title: 'Delete user',
33-
children: (
34-
<Text size="sm">
35-
Are you sure you want to delete the user? This action is irreversible.
36-
</Text>
37-
),
38-
labels: { confirm: 'Delete', cancel: 'Cancel' },
35+
title: t('delete-user.feature.delete-user'),
36+
children: <Text size="sm">t('delete-user.feature.are-you-sure')</Text>,
37+
labels: {
38+
confirm: t('delete-user.feature.delete'),
39+
cancel: t('delete-user.feature.cancel')
40+
},
3941
centered: true,
4042
confirmProps: { color: 'red' },
4143
onConfirm: () => handleDeleteUser()
4244
})
4345

4446
return (
45-
<Tooltip label="Delete user">
46-
<ActionIcon color="red" loading={isDeleteUserPending} onClick={openModal} size="xl">
47+
<Tooltip label={t('delete-user.feature.delete-user')}>
48+
<ActionIcon color="red.5" loading={isDeleteUserPending} onClick={openModal} size="xl">
4749
<PiTrashDuotone size="1.5rem" />
4850
</ActionIcon>
4951
</Tooltip>

src/features/ui/dashboard/users/get-user-subscription-links/get-user-subscription-links.feature.tsx

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import {
22
ActionIcon,
3-
Button,
43
Center,
54
CopyButton,
65
Drawer,
@@ -22,6 +21,7 @@ import { IProps } from './interfaces'
2221
export function GetUserSubscriptionLinksFeature(props: IProps) {
2322
const { shortUuid } = props
2423
const { t } = useTranslation()
24+
2525
const [opened, handlers] = useDisclosure(false)
2626

2727
const {
@@ -103,15 +103,9 @@ export function GetUserSubscriptionLinksFeature(props: IProps) {
103103
)}
104104
</Drawer>
105105
<Tooltip label={t('get-user-subscription-links.feature.subscription-links')}>
106-
<Button
107-
color="green"
108-
leftSection={<PiLinkBreakDuotone size="1.5rem" />}
109-
onClick={handlers.open}
110-
size="md"
111-
type="button"
112-
>
113-
{t('get-user-subscription-links.feature.show-links')}
114-
</Button>
106+
<ActionIcon color="teal.5" onClick={handlers.open} size="xl">
107+
<PiLinkBreakDuotone size="1.5rem" />
108+
</ActionIcon>
115109
</Tooltip>
116110
</>
117111
)
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { PiChartBarDuotone } from 'react-icons/pi'
2+
import { useDisclosure } from '@mantine/hooks'
3+
import { useTranslation } from 'react-i18next'
4+
import { Button } from '@mantine/core'
5+
6+
import { UserUsageModalWidget } from '@widgets/dashboard/users/user-usage-modal/user-usage-modal.widget'
7+
8+
import { IProps } from './interfaces'
9+
10+
export function GetUserUsageFeature(props: IProps) {
11+
const { userUuid } = props
12+
const { t } = useTranslation()
13+
14+
const [opened, handlers] = useDisclosure(false)
15+
16+
return (
17+
<>
18+
<Button
19+
color="grape"
20+
leftSection={<PiChartBarDuotone size="1rem" />}
21+
onClick={handlers.open}
22+
size="md"
23+
variant="outline"
24+
>
25+
{t('get-user-usage.feature.show-usage')}
26+
</Button>
27+
<UserUsageModalWidget onClose={handlers.close} opened={opened} userUuid={userUuid} />
28+
</>
29+
)
30+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './get-user-usage.feature'
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './props.interface'

0 commit comments

Comments
 (0)