@nextjs-cms-plugins/cpanel-dashboard 0.1.25 → 0.1.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DashboardPage.d.ts","sourceRoot":"","sources":["../../src/client/DashboardPage.tsx"],"names":[],"mappings":"AAoBA,eAAO,MAAM,mBAAmB,+
|
|
1
|
+
{"version":3,"file":"DashboardPage.d.ts","sourceRoot":"","sources":["../../src/client/DashboardPage.tsx"],"names":[],"mappings":"AAoBA,eAAO,MAAM,mBAAmB,+CAqF/B,CAAA;AAUD,eAAe,mBAAmB,CAAA"}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import getString from 'nextjs-cms/translations';
|
|
4
3
|
import { humanReadableFileSize } from 'nextjs-cms/utils';
|
|
5
4
|
import { trpc as trpcClient } from 'nextjs-cms/api/trpc/client';
|
|
5
|
+
import { useI18n } from 'nextjs-cms/translations/client';
|
|
6
6
|
export const CpanelDashboardPage = () => {
|
|
7
|
+
const t = useI18n();
|
|
7
8
|
const trpc = trpcClient;
|
|
8
9
|
const query = trpc?.cpanelDashboard?.getData.useQuery;
|
|
9
10
|
const { data, isLoading, isError, error } = query ? query() : { isLoading: true, isError: true, error: null };
|
|
10
11
|
if (!query) {
|
|
11
12
|
return _jsx("div", { className: 'p-6 text-sm text-red-500', children: "cPanel dashboard plugin misconfigured: missing trpc client." });
|
|
12
13
|
}
|
|
13
|
-
return (_jsxs("div", { className: 'w-full', children: [_jsx("div", { className: 'bg-linear-to-r from-sky-200 via-emerald-300 to-blue-600 p-8 font-extrabold text-foreground dark:from-blue-800 dark:via-amber-700 dark:to-rose-900', children: _jsx("h1", { className: 'text-3xl', children:
|
|
14
|
+
return (_jsxs("div", { className: 'w-full', children: [_jsx("div", { className: 'bg-linear-to-r from-sky-200 via-emerald-300 to-blue-600 p-8 font-extrabold text-foreground dark:from-blue-800 dark:via-amber-700 dark:to-rose-900', children: _jsx("h1", { className: 'text-3xl', children: t('dashboard') }) }), _jsxs("div", { className: 'flex flex-col gap-4 p-4', children: [isLoading && _jsx("div", { className: 'text-sm text-muted-foreground', children: "Loading cPanel usage\u2026" }), isError && !isLoading && (_jsx("div", { className: 'rounded border border-destructive/50 bg-destructive/10 p-3 text-sm text-destructive', children: error instanceof Error ? error.message : 'Unable to load cPanel data' })), data ? (_jsxs(_Fragment, { children: [_jsxs("div", { className: 'grid grid-cols-1 gap-4 sm-sidebar:grid-cols-1 md-sidebar:grid-cols-2 lg-sidebar:grid-cols-2 2xl-sidebar:grid-cols-4', children: [_jsx(StatCard, { title: t('disk_space'), used: humanReadableFileSize(data.diskSpaceUsage), total: humanReadableFileSize(data.diskSpaceLimit) }), _jsx(StatCard, { title: t('this_moth_bandwidth'), used: humanReadableFileSize(data.bandwidthUsage), total: humanReadableFileSize(data.bandwidthLimit) }), _jsx(StatCard, { title: t('email_accounts'), used: data.emailsUsage.toString(), total: data.emailsLimit.toString() }), _jsx(StatCard, { title: 'MySQL\u00AE/MariaDB Databases', used: data.dbsCount.toString(), total: data.dbsLimit.toString() })] }), _jsxs("div", { className: 'grid grid-cols-1 gap-4 md:grid-cols-2', children: [_jsxs("div", { className: 'rounded-lg border bg-card p-4 text-card-foreground shadow-sm', children: [_jsx("div", { className: 'text-lg font-semibold', children: t('accountInformation') }), _jsxs("div", { className: 'text-sm text-muted-foreground', children: [_jsxs("div", { children: ["PHP Version: ", data?.phpVersion ?? 'N/A'] }), _jsxs("div", { children: ["Root: ", data?.documentRoot ?? 'N/A'] })] })] }), _jsxs("div", { className: 'rounded-lg border bg-card p-4 text-card-foreground shadow-sm', children: [_jsx("div", { className: 'text-lg font-semibold', children: "MySQL/MariaDB" }), _jsx("div", { className: 'text-sm text-muted-foreground', children: data?.dbInfo ? (_jsxs(_Fragment, { children: [_jsxs("div", { children: ["Version: ", data.dbInfo.version] }), _jsxs("div", { children: ["Remote: ", data.dbInfo.is_remote ? 'Yes' : 'No'] })] })) : (_jsx("div", { children: "MySQL/MariaDB is not installed" })) }), _jsx("div", { className: 'mt-3 space-y-2 text-sm', children: data?.dbsList?.map((db, index) => (_jsxs("div", { className: 'rounded border p-2', children: [_jsx("div", { className: 'font-semibold', children: db.database }), _jsxs("div", { className: 'text-muted-foreground', children: ["Disk Usage: ", humanReadableFileSize(db.disk_usage)] }), _jsxs("div", { className: 'text-muted-foreground', children: ["Users: ", db.users?.length ?? 0] })] }, `${db.name}_${db.database}_${index}`))) })] })] })] })) : null] })] }));
|
|
14
15
|
};
|
|
15
16
|
const StatCard = ({ title, used, total }) => (_jsxs("div", { className: 'rounded-lg border bg-card p-4 text-card-foreground shadow-sm', children: [_jsx("div", { className: 'text-base font-semibold', children: title }), _jsxs("div", { className: 'mt-2 text-sm text-muted-foreground', children: ["Used: ", used] }), _jsxs("div", { className: 'text-sm text-muted-foreground', children: ["Total: ", total] })] }));
|
|
16
17
|
export default CpanelDashboardPage;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nextjs-cms-plugins/cpanel-dashboard",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.26",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"react": "19.0.0",
|
|
28
28
|
"react-dom": "19.0.0",
|
|
29
|
-
"nextjs-cms": "0.5.
|
|
29
|
+
"nextjs-cms": "0.5.93"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/react": "~19.0.0",
|