Skip to content

Commit

Permalink
add user usage detail in nodes (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongfq authored May 2, 2023
1 parent 613f1a3 commit 42f1592
Show file tree
Hide file tree
Showing 24 changed files with 2,065 additions and 678 deletions.
4 changes: 2 additions & 2 deletions app/dashboard/build/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
<meta name="msapplication-TileColor" content="#2b5797" />
<meta name="msapplication-config" content="/favicon/browserconfig.xml" />
<meta name="theme-color" content="#3B81F6" />
<script type="module" crossorigin src="/dashboard/assets/index.31644f25.js"></script>
<link rel="modulepreload" crossorigin href="/dashboard/assets/vendor.8e672767.js">
<script type="module" crossorigin src="/dashboard/assets/index.01b5eeb0.js"></script>
<link rel="modulepreload" crossorigin href="/dashboard/assets/vendor.b7d32f1b.js">
<link rel="stylesheet" href="/dashboard/assets/index.16216361.css">
</head>
<body>
Expand Down
27 changes: 27 additions & 0 deletions app/dashboard/build/assets/index.01b5eeb0.js

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions app/dashboard/build/assets/index.31644f25.js

This file was deleted.

443 changes: 0 additions & 443 deletions app/dashboard/build/assets/vendor.8e672767.js

This file was deleted.

1,127 changes: 1,127 additions & 0 deletions app/dashboard/build/assets/vendor.b7d32f1b.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions app/dashboard/build/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
<meta name="msapplication-TileColor" content="#2b5797" />
<meta name="msapplication-config" content="/favicon/browserconfig.xml" />
<meta name="theme-color" content="#3B81F6" />
<script type="module" crossorigin src="/dashboard/assets/index.31644f25.js"></script>
<link rel="modulepreload" crossorigin href="/dashboard/assets/vendor.8e672767.js">
<script type="module" crossorigin src="/dashboard/assets/index.01b5eeb0.js"></script>
<link rel="modulepreload" crossorigin href="/dashboard/assets/vendor.b7d32f1b.js">
<link rel="stylesheet" href="/dashboard/assets/index.16216361.css">
</head>
<body>
Expand Down
195 changes: 195 additions & 0 deletions app/dashboard/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions app/dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"@emotion/styled": "^11.10.5",
"@heroicons/react": "^2.0.12",
"@hookform/resolvers": "^2.9.10",
"apexcharts": "^3.40.0",
"classnames": "^2.3.2",
"dayjs": "^1.11.6",
"framer-motion": "^7.6.6",
Expand All @@ -24,6 +25,7 @@
"ohmyfetch": "^0.4.21",
"qrcode.react": "^3.1.0",
"react": "^18.2.0",
"react-apexcharts": "^1.4.0",
"react-copy-to-clipboard": "^5.1.0",
"react-datepicker": "^4.8.0",
"react-dom": "^18.2.0",
Expand Down
13 changes: 12 additions & 1 deletion app/dashboard/src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
import {
ArrowLeftOnRectangleIcon,
Bars3Icon,
ChartPieIcon,
CurrencyDollarIcon,
DocumentMinusIcon,
LinkIcon,
Expand Down Expand Up @@ -42,6 +43,7 @@ const LightIcon = chakra(SunIcon, {
},
});


type HeaderProps = {
actions?: ReactNode;
};
Expand All @@ -57,6 +59,7 @@ const LogoutIcon = chakra(ArrowLeftOnRectangleIcon, iconProps);
const DonationIcon = chakra(CurrencyDollarIcon, iconProps);
const HostsIcon = chakra(LinkIcon, iconProps);
const NodesIcon = chakra(SquaresPlusIcon, iconProps);
const NodesUsageIcon = chakra(ChartPieIcon, iconProps);
const ResetUsageIcon = chakra(DocumentMinusIcon, iconProps);
const NotificationCircle = chakra(Box, {
baseStyle: {
Expand All @@ -71,7 +74,7 @@ const NotificationCircle = chakra(Box, {
const NOTIFICATION_KEY = "marzban-menu-notification";

export const Header: FC<HeaderProps> = ({ actions }) => {
const { onEditingHosts, onResetAllUsage, onEditingNodes } = useDashboard();
const { onEditingHosts, onResetAllUsage, onEditingNodes, onShowingNodesUsage } = useDashboard();
const { t } = useTranslation();
const { colorMode, toggleColorMode } = useColorMode();
const [notificationsChecked, setNotificationChecked] = useState(
Expand Down Expand Up @@ -153,6 +156,14 @@ export const Header: FC<HeaderProps> = ({ actions }) => {
>
{t("header.nodesSetting")}
</MenuItem>
<MenuItem
maxW="170px"
fontSize="sm"
icon={<NodesUsageIcon />}
onClick={onShowingNodesUsage.bind(null, true)}
>
{t("header.nodesUsage")}
</MenuItem>
<MenuItem
maxW="170px"
fontSize="sm"
Expand Down
Loading

0 comments on commit 42f1592

Please sign in to comment.