create-nextjs-cms 0.9.5 → 0.9.7
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.
- package/dist/helpers/check-directory.d.ts +1 -0
- package/dist/helpers/check-directory.d.ts.map +1 -1
- package/dist/helpers/check-directory.js +98 -23
- package/dist/index.js +13 -8
- package/dist/lib/create-project.js +1 -1
- package/package.json +3 -3
- package/templates/default/app/(auth)/auth-language-provider.tsx +34 -34
- package/templates/default/components/AnalyticsPage.tsx +22 -6
- package/templates/default/components/CategorySectionSelectInput.tsx +2 -2
- package/templates/default/components/form/Form.tsx +12 -2
- package/templates/default/components/form/FormInputs.tsx +25 -16
- package/templates/default/components/form/inputs/DateFormInput.tsx +110 -53
- package/templates/default/components/form/inputs/DateRangeFormInput.tsx +175 -0
- package/templates/default/components/form/inputs/TagsFormInput.tsx +6 -5
- package/templates/default/next-env.d.ts +1 -1
- package/templates/default/package.json +3 -3
- package/templates/default/proxy.ts +2 -2
- package/templates/default/app/(rootLayout)/dashboard-new/page.tsx +0 -7
- package/templates/default/components/DashboardNewPage.tsx +0 -253
- package/templates/default/components/DashboardPage.tsx +0 -188
- package/templates/default/components/EmailCard.tsx +0 -138
- package/templates/default/components/EmailPasswordForm.tsx +0 -85
- package/templates/default/components/EmailQuotaForm.tsx +0 -73
- package/templates/default/components/EmailsPage.tsx +0 -49
- package/templates/default/components/NewEmailForm.tsx +0 -132
- package/templates/default/components/form/DateRangeFormInput.tsx +0 -57
|
@@ -1,253 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
|
|
3
|
-
import React from 'react'
|
|
4
|
-
import { useI18n } from 'nextjs-cms/translations/client'
|
|
5
|
-
import { Chart as ChartJS, ArcElement, Tooltip, Legend } from 'chart.js'
|
|
6
|
-
import { LiveUsersCount } from '@/components/analytics/LiveUsersCount'
|
|
7
|
-
import { TotalPageViews } from '@/components/analytics/TotalPageViews'
|
|
8
|
-
import { TotalSessions } from '@/components/analytics/TotalSessions'
|
|
9
|
-
import { TotalUniqueUsers } from '@/components/analytics/TotalUniqueUsers'
|
|
10
|
-
import ContainerBox from '@/components/ContainerBox'
|
|
11
|
-
import LoadingSpinners from '@/components/LoadingSpinners'
|
|
12
|
-
import { trpc } from '@/app/_trpc/client'
|
|
13
|
-
import Link from 'next/link'
|
|
14
|
-
import { Button } from '@/components/ui/button'
|
|
15
|
-
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'
|
|
16
|
-
import { PlusCircle, FileText, BarChart3, Users, Settings, Eye } from 'lucide-react'
|
|
17
|
-
|
|
18
|
-
ChartJS.register(ArcElement, Tooltip, Legend)
|
|
19
|
-
|
|
20
|
-
const DashboardNewPage = () => {
|
|
21
|
-
const t = useI18n()
|
|
22
|
-
// Analytics date range - last 30 days
|
|
23
|
-
const [fromDate, setFromDate] = React.useState<Date | string>('30daysAgo')
|
|
24
|
-
const [toDate, setToDate] = React.useState<Date | string>('today')
|
|
25
|
-
|
|
26
|
-
// Get available sections
|
|
27
|
-
const { data: sectionsData, isLoading: sectionsLoading } = trpc.hasItemsSections.listItems.useQuery({
|
|
28
|
-
section: 'settings', // This might give us section metadata
|
|
29
|
-
page: 1,
|
|
30
|
-
limit: 100,
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
return (
|
|
34
|
-
<div className='w-full'>
|
|
35
|
-
<div className='text-foreground bg-linear-to-r from-sky-200 via-emerald-300 to-blue-600 p-8 font-extrabold dark:from-blue-800 dark:via-amber-700 dark:to-rose-900'>
|
|
36
|
-
<h1 className='text-3xl'>{t('dashboard')}</h1>
|
|
37
|
-
<p className='mt-2 text-lg opacity-90'>{t('cmsOverview')}</p>
|
|
38
|
-
</div>
|
|
39
|
-
|
|
40
|
-
<div className='flex flex-col gap-6 p-6'>
|
|
41
|
-
{/* Analytics Overview */}
|
|
42
|
-
<div>
|
|
43
|
-
<h2 className='mb-4 flex items-center gap-2 text-2xl font-semibold'>
|
|
44
|
-
<BarChart3 className='h-6 w-6' />
|
|
45
|
-
{t('analyticsOverview')}
|
|
46
|
-
</h2>
|
|
47
|
-
<div className='sm-sidebar:grid-cols-2 md-sidebar:grid-cols-2 lg-sidebar:grid-cols-4 grid grid-cols-1 gap-4'>
|
|
48
|
-
<LiveUsersCount />
|
|
49
|
-
<TotalPageViews fromDate={fromDate} toDate={toDate} />
|
|
50
|
-
<TotalSessions fromDate={fromDate} toDate={toDate} />
|
|
51
|
-
<TotalUniqueUsers fromDate={fromDate} toDate={toDate} />
|
|
52
|
-
</div>
|
|
53
|
-
</div>
|
|
54
|
-
|
|
55
|
-
{/* Content Statistics */}
|
|
56
|
-
<div>
|
|
57
|
-
<h2 className='mb-4 flex items-center gap-2 text-2xl font-semibold'>
|
|
58
|
-
<FileText className='h-6 w-6' />
|
|
59
|
-
{t('contentStatistics')}
|
|
60
|
-
</h2>
|
|
61
|
-
<div className='sm-sidebar:grid-cols-2 md-sidebar:grid-cols-3 lg-sidebar:grid-cols-4 grid grid-cols-1 gap-4'>
|
|
62
|
-
<Card>
|
|
63
|
-
<CardHeader className='flex flex-row items-center justify-between space-y-0 pb-2'>
|
|
64
|
-
<CardTitle className='text-sm font-medium'>{t('totalCars')}</CardTitle>
|
|
65
|
-
<FileText className='text-muted-foreground h-4 w-4' />
|
|
66
|
-
</CardHeader>
|
|
67
|
-
<CardContent>
|
|
68
|
-
<div className='text-2xl font-bold'>1,234</div>
|
|
69
|
-
<p className='text-muted-foreground text-xs'>+20.1% {t('fromLastMonth')}</p>
|
|
70
|
-
</CardContent>
|
|
71
|
-
</Card>
|
|
72
|
-
|
|
73
|
-
<Card>
|
|
74
|
-
<CardHeader className='flex flex-row items-center justify-between space-y-0 pb-2'>
|
|
75
|
-
<CardTitle className='text-sm font-medium'>{t('realEstate')}</CardTitle>
|
|
76
|
-
<FileText className='text-muted-foreground h-4 w-4' />
|
|
77
|
-
</CardHeader>
|
|
78
|
-
<CardContent>
|
|
79
|
-
<div className='text-2xl font-bold'>856</div>
|
|
80
|
-
<p className='text-muted-foreground text-xs'>+15.3% {t('fromLastMonth')}</p>
|
|
81
|
-
</CardContent>
|
|
82
|
-
</Card>
|
|
83
|
-
|
|
84
|
-
<Card>
|
|
85
|
-
<CardHeader className='flex flex-row items-center justify-between space-y-0 pb-2'>
|
|
86
|
-
<CardTitle className='text-sm font-medium'>{t('jobs')}</CardTitle>
|
|
87
|
-
<FileText className='text-muted-foreground h-4 w-4' />
|
|
88
|
-
</CardHeader>
|
|
89
|
-
<CardContent>
|
|
90
|
-
<div className='text-2xl font-bold'>432</div>
|
|
91
|
-
<p className='text-muted-foreground text-xs'>+7.2% {t('fromLastMonth')}</p>
|
|
92
|
-
</CardContent>
|
|
93
|
-
</Card>
|
|
94
|
-
|
|
95
|
-
<Card>
|
|
96
|
-
<CardHeader className='flex flex-row items-center justify-between space-y-0 pb-2'>
|
|
97
|
-
<CardTitle className='text-sm font-medium'>{t('services')}</CardTitle>
|
|
98
|
-
<FileText className='text-muted-foreground h-4 w-4' />
|
|
99
|
-
</CardHeader>
|
|
100
|
-
<CardContent>
|
|
101
|
-
<div className='text-2xl font-bold'>298</div>
|
|
102
|
-
<p className='text-muted-foreground text-xs'>+12.5% {t('fromLastMonth')}</p>
|
|
103
|
-
</CardContent>
|
|
104
|
-
</Card>
|
|
105
|
-
</div>
|
|
106
|
-
</div>
|
|
107
|
-
|
|
108
|
-
{/* Recent Activity */}
|
|
109
|
-
<div>
|
|
110
|
-
<h2 className='mb-4 text-2xl font-semibold'>{t('recentActivity')}</h2>
|
|
111
|
-
<Card>
|
|
112
|
-
<CardHeader>
|
|
113
|
-
<CardTitle>{t('latestContentUpdates')}</CardTitle>
|
|
114
|
-
<CardDescription>{t('recentlyAddedOrModified')}</CardDescription>
|
|
115
|
-
</CardHeader>
|
|
116
|
-
<CardContent>
|
|
117
|
-
<div className='space-y-4'>
|
|
118
|
-
<div className='flex items-center justify-between border-b pb-2'>
|
|
119
|
-
<div>
|
|
120
|
-
<p className='font-medium'>2024 BMW X5 - Cars Section</p>
|
|
121
|
-
<p className='text-muted-foreground text-sm'>Added 2 hours ago</p>
|
|
122
|
-
</div>
|
|
123
|
-
<Button variant='outline' size='sm' asChild>
|
|
124
|
-
<Link href='/browse/cars/1'>
|
|
125
|
-
<Eye className='mr-1 h-4 w-4' />
|
|
126
|
-
{t('view')}
|
|
127
|
-
</Link>
|
|
128
|
-
</Button>
|
|
129
|
-
</div>
|
|
130
|
-
|
|
131
|
-
<div className='flex items-center justify-between border-b pb-2'>
|
|
132
|
-
<div>
|
|
133
|
-
<p className='font-medium'>3BR Apartment in Downtown - Real Estate</p>
|
|
134
|
-
<p className='text-muted-foreground text-sm'>Added 4 hours ago</p>
|
|
135
|
-
</div>
|
|
136
|
-
<Button variant='outline' size='sm' asChild>
|
|
137
|
-
<Link href='/browse/real-estate/1'>
|
|
138
|
-
<Eye className='mr-1 h-4 w-4' />
|
|
139
|
-
{t('view')}
|
|
140
|
-
</Link>
|
|
141
|
-
</Button>
|
|
142
|
-
</div>
|
|
143
|
-
|
|
144
|
-
<div className='flex items-center justify-between border-b pb-2'>
|
|
145
|
-
<div>
|
|
146
|
-
<p className='font-medium'>Software Developer Position - Jobs</p>
|
|
147
|
-
<p className='text-muted-foreground text-sm'>Added 6 hours ago</p>
|
|
148
|
-
</div>
|
|
149
|
-
<Button variant='outline' size='sm' asChild>
|
|
150
|
-
<Link href='/browse/jobs/1'>
|
|
151
|
-
<Eye className='mr-1 h-4 w-4' />
|
|
152
|
-
{t('view')}
|
|
153
|
-
</Link>
|
|
154
|
-
</Button>
|
|
155
|
-
</div>
|
|
156
|
-
</div>
|
|
157
|
-
</CardContent>
|
|
158
|
-
</Card>
|
|
159
|
-
</div>
|
|
160
|
-
|
|
161
|
-
{/* Quick Actions */}
|
|
162
|
-
<div>
|
|
163
|
-
<h2 className='mb-4 text-2xl font-semibold'>{t('quickActions')}</h2>
|
|
164
|
-
<div className='sm-sidebar:grid-cols-2 md-sidebar:grid-cols-3 lg-sidebar:grid-cols-4 grid grid-cols-1 gap-4'>
|
|
165
|
-
<Card className='cursor-pointer transition-shadow hover:shadow-md'>
|
|
166
|
-
<CardHeader>
|
|
167
|
-
<CardTitle className='flex items-center gap-2'>
|
|
168
|
-
<PlusCircle className='h-5 w-5' />
|
|
169
|
-
{t('addNewCar')}
|
|
170
|
-
</CardTitle>
|
|
171
|
-
<CardDescription>{t('createCarListing')}</CardDescription>
|
|
172
|
-
</CardHeader>
|
|
173
|
-
<CardContent>
|
|
174
|
-
<Button asChild className='w-full'>
|
|
175
|
-
<Link href='/new/cars'>{t('create')}</Link>
|
|
176
|
-
</Button>
|
|
177
|
-
</CardContent>
|
|
178
|
-
</Card>
|
|
179
|
-
|
|
180
|
-
<Card className='cursor-pointer transition-shadow hover:shadow-md'>
|
|
181
|
-
<CardHeader>
|
|
182
|
-
<CardTitle className='flex items-center gap-2'>
|
|
183
|
-
<PlusCircle className='h-5 w-5' />
|
|
184
|
-
{t('addRealEstate')}
|
|
185
|
-
</CardTitle>
|
|
186
|
-
<CardDescription>{t('createPropertyListing')}</CardDescription>
|
|
187
|
-
</CardHeader>
|
|
188
|
-
<CardContent>
|
|
189
|
-
<Button asChild className='w-full'>
|
|
190
|
-
<Link href='/new/real-estate'>{t('create')}</Link>
|
|
191
|
-
</Button>
|
|
192
|
-
</CardContent>
|
|
193
|
-
</Card>
|
|
194
|
-
|
|
195
|
-
<Card className='cursor-pointer transition-shadow hover:shadow-md'>
|
|
196
|
-
<CardHeader>
|
|
197
|
-
<CardTitle className='flex items-center gap-2'>
|
|
198
|
-
<Users className='h-5 w-5' />
|
|
199
|
-
{t('manageAdmins')}
|
|
200
|
-
</CardTitle>
|
|
201
|
-
<CardDescription>{t('viewAndManageAdmins')}</CardDescription>
|
|
202
|
-
</CardHeader>
|
|
203
|
-
<CardContent>
|
|
204
|
-
<Button asChild variant='outline' className='w-full'>
|
|
205
|
-
<Link href='/admins'>{t('manageAdmins')}</Link>
|
|
206
|
-
</Button>
|
|
207
|
-
</CardContent>
|
|
208
|
-
</Card>
|
|
209
|
-
|
|
210
|
-
<Card className='cursor-pointer transition-shadow hover:shadow-md'>
|
|
211
|
-
<CardHeader>
|
|
212
|
-
<CardTitle className='flex items-center gap-2'>
|
|
213
|
-
<BarChart3 className='h-5 w-5' />
|
|
214
|
-
{t('viewAnalytics')}
|
|
215
|
-
</CardTitle>
|
|
216
|
-
<CardDescription>{t('detailedAnalytics')}</CardDescription>
|
|
217
|
-
</CardHeader>
|
|
218
|
-
<CardContent>
|
|
219
|
-
<Button asChild variant='outline' className='w-full'>
|
|
220
|
-
<Link href='/analytics'>{t('viewAnalytics')}</Link>
|
|
221
|
-
</Button>
|
|
222
|
-
</CardContent>
|
|
223
|
-
</Card>
|
|
224
|
-
</div>
|
|
225
|
-
</div>
|
|
226
|
-
|
|
227
|
-
{/* System Status */}
|
|
228
|
-
<div>
|
|
229
|
-
<h2 className='mb-4 text-2xl font-semibold'>{t('systemStatus')}</h2>
|
|
230
|
-
<div className='grid grid-cols-1 gap-4 md:grid-cols-2'>
|
|
231
|
-
<ContainerBox title={t('databaseStatus')}>
|
|
232
|
-
<div className='flex items-center gap-2'>
|
|
233
|
-
<div className='h-3 w-3 rounded-full bg-green-500'></div>
|
|
234
|
-
<span>{t('connected')}</span>
|
|
235
|
-
</div>
|
|
236
|
-
<p className='text-muted-foreground mt-2 text-sm'>{t('allConnectionsHealthy')}</p>
|
|
237
|
-
</ContainerBox>
|
|
238
|
-
|
|
239
|
-
<ContainerBox title={t('cacheStatus')}>
|
|
240
|
-
<div className='flex items-center gap-2'>
|
|
241
|
-
<div className='h-3 w-3 rounded-full bg-green-500'></div>
|
|
242
|
-
<span>{t('operational')}</span>
|
|
243
|
-
</div>
|
|
244
|
-
<p className='text-muted-foreground mt-2 text-sm'>{t('cacheFunctioning')}</p>
|
|
245
|
-
</ContainerBox>
|
|
246
|
-
</div>
|
|
247
|
-
</div>
|
|
248
|
-
</div>
|
|
249
|
-
</div>
|
|
250
|
-
)
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
export default DashboardNewPage
|
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
|
|
3
|
-
import React, { useEffect } from 'react'
|
|
4
|
-
import { useI18n } from 'nextjs-cms/translations/client'
|
|
5
|
-
import { Chart as ChartJS, ArcElement, Tooltip, Legend } from 'chart.js'
|
|
6
|
-
import { humanReadableFileSize } from 'nextjs-cms/utils'
|
|
7
|
-
import PieChartBox from '@/components/PieChartBox'
|
|
8
|
-
import LoadingSpinners from '@/components/LoadingSpinners'
|
|
9
|
-
import ContainerBox from '@/components/ContainerBox'
|
|
10
|
-
import { trpc } from '@/app/_trpc/client'
|
|
11
|
-
ChartJS.register(ArcElement, Tooltip, Legend)
|
|
12
|
-
|
|
13
|
-
const DashboardPage = () => {
|
|
14
|
-
const t = useI18n()
|
|
15
|
-
const { isLoading, isError, data, error } = trpc.cpanelDashboard.getData.useQuery()
|
|
16
|
-
|
|
17
|
-
useEffect(() => {}, [])
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<div className='w-full'>
|
|
21
|
-
<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'>
|
|
22
|
-
<h1 className='text-3xl'>{t('dashboard')}</h1>
|
|
23
|
-
</div>
|
|
24
|
-
<div className='flex flex-col gap-4 p-4'>
|
|
25
|
-
{isLoading && (
|
|
26
|
-
<div>
|
|
27
|
-
<LoadingSpinners />
|
|
28
|
-
</div>
|
|
29
|
-
)}
|
|
30
|
-
<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'>
|
|
31
|
-
{data ? (
|
|
32
|
-
<>
|
|
33
|
-
<PieChartBox
|
|
34
|
-
chartData={[
|
|
35
|
-
{
|
|
36
|
-
name: t('totalDiskSpace'),
|
|
37
|
-
value: data.diskSpaceLimit - data.diskSpaceUsage,
|
|
38
|
-
fill: '#00C49F',
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
name: t('usedDiskSpace'),
|
|
42
|
-
value: data.diskSpaceUsage,
|
|
43
|
-
fill: '#E1315B',
|
|
44
|
-
},
|
|
45
|
-
]}
|
|
46
|
-
chartBoxTitles={{
|
|
47
|
-
mainTitle: t('diskSpace'),
|
|
48
|
-
totalUnitSubtitle: {
|
|
49
|
-
key: t('totalDiskSpace'),
|
|
50
|
-
value: humanReadableFileSize(data.diskSpaceLimit),
|
|
51
|
-
},
|
|
52
|
-
usedUnitSubtitle: {
|
|
53
|
-
key: t('usedDiskSpace'),
|
|
54
|
-
value: humanReadableFileSize(data.diskSpaceUsage),
|
|
55
|
-
},
|
|
56
|
-
}}
|
|
57
|
-
/>
|
|
58
|
-
<PieChartBox
|
|
59
|
-
chartData={[
|
|
60
|
-
{
|
|
61
|
-
name: t('totalBandwidth'),
|
|
62
|
-
value: data.bandwidthLimit - data.bandwidthUsage,
|
|
63
|
-
fill: '#1c89f1',
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
name: t('usedBandwidth'),
|
|
67
|
-
value: data.bandwidthUsage,
|
|
68
|
-
fill: '#ff6688',
|
|
69
|
-
},
|
|
70
|
-
]}
|
|
71
|
-
chartBoxTitles={{
|
|
72
|
-
mainTitle: t('thisMothBandwidth'),
|
|
73
|
-
totalUnitSubtitle: {
|
|
74
|
-
key: t('totalBandwidth'),
|
|
75
|
-
value: humanReadableFileSize(data.bandwidthLimit),
|
|
76
|
-
},
|
|
77
|
-
usedUnitSubtitle: {
|
|
78
|
-
key: t('usedBandwidth'),
|
|
79
|
-
value: humanReadableFileSize(data.bandwidthUsage),
|
|
80
|
-
},
|
|
81
|
-
}}
|
|
82
|
-
/>
|
|
83
|
-
<PieChartBox
|
|
84
|
-
chartData={[
|
|
85
|
-
{
|
|
86
|
-
name: t('totalEmails'),
|
|
87
|
-
value: data.emailsLimit - data.emailsUsage,
|
|
88
|
-
fill: '#c4ba56',
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
name: t('usedEmails'),
|
|
92
|
-
value: data.emailsUsage,
|
|
93
|
-
fill: '#1404c4',
|
|
94
|
-
},
|
|
95
|
-
]}
|
|
96
|
-
chartBoxTitles={{
|
|
97
|
-
mainTitle: t('emailAccounts'),
|
|
98
|
-
totalUnitSubtitle: {
|
|
99
|
-
key: t('totalEmails'),
|
|
100
|
-
value: data.emailsLimit.toString(),
|
|
101
|
-
},
|
|
102
|
-
usedUnitSubtitle: {
|
|
103
|
-
key: t('usedEmails'),
|
|
104
|
-
value: data.emailsUsage.toString(),
|
|
105
|
-
},
|
|
106
|
-
}}
|
|
107
|
-
/>
|
|
108
|
-
<PieChartBox
|
|
109
|
-
chartData={[
|
|
110
|
-
{
|
|
111
|
-
name: t('totalDatabases'),
|
|
112
|
-
value: data.dbsLimit - data.dbsCount,
|
|
113
|
-
fill: '#56c4b4',
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
name: t('usedDatabases'),
|
|
117
|
-
value: data.dbsCount,
|
|
118
|
-
fill: '#625bb2',
|
|
119
|
-
},
|
|
120
|
-
]}
|
|
121
|
-
chartBoxTitles={{
|
|
122
|
-
mainTitle: t('mysqlDatabases'),
|
|
123
|
-
totalUnitSubtitle: {
|
|
124
|
-
key: t('totalDatabases'),
|
|
125
|
-
value: data.dbsLimit.toString(),
|
|
126
|
-
},
|
|
127
|
-
usedUnitSubtitle: {
|
|
128
|
-
key: t('usedDatabases'),
|
|
129
|
-
value: data.dbsCount.toString(),
|
|
130
|
-
},
|
|
131
|
-
}}
|
|
132
|
-
/>
|
|
133
|
-
</>
|
|
134
|
-
) : null}
|
|
135
|
-
</div>
|
|
136
|
-
<div className='grid grid-cols-1 gap-4 md:grid-cols-2'>
|
|
137
|
-
<ContainerBox title={t('accountInformation')}>
|
|
138
|
-
<div>{t('phpVersion')}: {data?.phpVersion}</div>
|
|
139
|
-
<div>{t('documentRoot')}: {data?.documentRoot}</div>
|
|
140
|
-
</ContainerBox>
|
|
141
|
-
|
|
142
|
-
<ContainerBox title={t('mysqlDatabases')}>
|
|
143
|
-
<div>
|
|
144
|
-
{data?.dbInfo ? (
|
|
145
|
-
<>
|
|
146
|
-
<div>{t('version')}: {data.dbInfo.version}</div>
|
|
147
|
-
<div>{t('remote')}: {data.dbInfo.is_remote}</div>
|
|
148
|
-
</>
|
|
149
|
-
) : (
|
|
150
|
-
<div>{t('mysqlNotInstalled')}</div>
|
|
151
|
-
)}
|
|
152
|
-
</div>
|
|
153
|
-
<div>
|
|
154
|
-
{data?.dbsList?.map((db: any, index: number) => (
|
|
155
|
-
<div key={`${db.name}_${db.database}_${index}`}>
|
|
156
|
-
<div>{t('database')}: {db.database}</div>
|
|
157
|
-
<div>{t('diskUsage')}: {humanReadableFileSize(db.disk_usage)}</div>
|
|
158
|
-
<div>{t('users')}: {db.users?.length}</div>
|
|
159
|
-
</div>
|
|
160
|
-
))}
|
|
161
|
-
</div>
|
|
162
|
-
</ContainerBox>
|
|
163
|
-
</div>
|
|
164
|
-
{/*<div>
|
|
165
|
-
<ContainerBox title={t('passengerApplications')}>
|
|
166
|
-
<div className='flex gap-4'>
|
|
167
|
-
{data?.passengerAppList?.map((app: any) => (
|
|
168
|
-
<ContainerBox title={app.name} key={app.name}>
|
|
169
|
-
<div key={app.name + app.path}>
|
|
170
|
-
<div>Name: {app.name}</div>
|
|
171
|
-
<div>Domain: {app.domain}</div>
|
|
172
|
-
<div>Path: {app.path}</div>
|
|
173
|
-
<div>Deployment: {app.deploymentMode}</div>
|
|
174
|
-
<div>Nodejs: {app.nodejs}</div>
|
|
175
|
-
<div>Base URL: {app.url}</div>
|
|
176
|
-
<div>Enabled: {app.enabled}</div>
|
|
177
|
-
</div>
|
|
178
|
-
</ContainerBox>
|
|
179
|
-
))}
|
|
180
|
-
</div>
|
|
181
|
-
</ContainerBox>
|
|
182
|
-
</div>*/}
|
|
183
|
-
</div>
|
|
184
|
-
</div>
|
|
185
|
-
)
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
export default DashboardPage
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import { useI18n } from 'nextjs-cms/translations/client'
|
|
2
|
-
import React from 'react'
|
|
3
|
-
import { EmailItem } from 'nextjs-cms/core/types'
|
|
4
|
-
import useModal from '@/hooks/useModal'
|
|
5
|
-
import { useToast } from '@/components/ui/use-toast'
|
|
6
|
-
import { Card, CardContent, CardFooter, CardHeader, CardTitle } from '@/components/ui/card'
|
|
7
|
-
import { Button } from '@/components/ui/button'
|
|
8
|
-
import ProgressBar from '@/components/ProgressBar'
|
|
9
|
-
import EmailQuotaForm from '@/components/EmailQuotaForm'
|
|
10
|
-
import EmailPasswordForm from '@/components/EmailPasswordForm'
|
|
11
|
-
import { trpc } from '@/app/_trpc/client'
|
|
12
|
-
|
|
13
|
-
export default function EmailCard({ email, action }: { email: EmailItem; action: any }) {
|
|
14
|
-
const t = useI18n()
|
|
15
|
-
const { setModal, modal, modalResponse, setModalResponse } = useModal()
|
|
16
|
-
const { toast } = useToast()
|
|
17
|
-
|
|
18
|
-
const deleteMutation = trpc.cpanelEmails.deleteEmail.useMutation({
|
|
19
|
-
onError: (error) => {
|
|
20
|
-
setModalResponse({
|
|
21
|
-
message: error.message,
|
|
22
|
-
messageColor: 'text-red-900',
|
|
23
|
-
borderColor: 'border-red-600',
|
|
24
|
-
bgColor: 'bg-red-200',
|
|
25
|
-
})
|
|
26
|
-
},
|
|
27
|
-
onSuccess: (data) => {
|
|
28
|
-
action()
|
|
29
|
-
setModal(null)
|
|
30
|
-
setModalResponse(null)
|
|
31
|
-
toast({
|
|
32
|
-
variant: 'success',
|
|
33
|
-
title: t('deleteEmailAccount'),
|
|
34
|
-
description: data.message,
|
|
35
|
-
})
|
|
36
|
-
},
|
|
37
|
-
})
|
|
38
|
-
const deleteEmail = async () => {
|
|
39
|
-
deleteMutation.mutate(email.user)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return (
|
|
43
|
-
<Card className='border border-gray-400 shadow-xs'>
|
|
44
|
-
<CardHeader>
|
|
45
|
-
<CardTitle>
|
|
46
|
-
<div className='flex flex-row items-center'>
|
|
47
|
-
<div className='flex flex-col break-all'>
|
|
48
|
-
<div className='text-sm font-medium text-foreground'>
|
|
49
|
-
<div className='me-2 font-bold'>{email.email}</div>
|
|
50
|
-
</div>
|
|
51
|
-
</div>
|
|
52
|
-
</div>
|
|
53
|
-
</CardTitle>
|
|
54
|
-
</CardHeader>
|
|
55
|
-
<CardContent>
|
|
56
|
-
{email.humandiskused} / {email.humandiskquota !== 'None' ? email.humandiskquota : email.diskquota}
|
|
57
|
-
<ProgressBar variant='determinate' value={parseInt(email.diskusedpercent)} />
|
|
58
|
-
</CardContent>
|
|
59
|
-
<CardFooter className='flex flex-wrap gap-1'>
|
|
60
|
-
<Button
|
|
61
|
-
size='sm'
|
|
62
|
-
variant='default'
|
|
63
|
-
onClick={() => {
|
|
64
|
-
setModal({
|
|
65
|
-
title: t('emailQuota'),
|
|
66
|
-
body: (
|
|
67
|
-
<div className='p-4'>
|
|
68
|
-
<EmailQuotaForm email={email.user} action={() => action()} />
|
|
69
|
-
</div>
|
|
70
|
-
),
|
|
71
|
-
headerColor: 'bg-sky-700',
|
|
72
|
-
titleColor: 'text-white',
|
|
73
|
-
lang: 'en',
|
|
74
|
-
})
|
|
75
|
-
}}
|
|
76
|
-
>
|
|
77
|
-
{t('quota')}
|
|
78
|
-
</Button>
|
|
79
|
-
<Button
|
|
80
|
-
size='sm'
|
|
81
|
-
variant='default'
|
|
82
|
-
onClick={() => {
|
|
83
|
-
setModal({
|
|
84
|
-
title: t('changePassword'),
|
|
85
|
-
body: (
|
|
86
|
-
<div className='p-4'>
|
|
87
|
-
<EmailPasswordForm email={email.user} action={() => action()} />
|
|
88
|
-
</div>
|
|
89
|
-
),
|
|
90
|
-
headerColor: 'bg-sky-700',
|
|
91
|
-
titleColor: 'text-white',
|
|
92
|
-
lang: 'en',
|
|
93
|
-
})
|
|
94
|
-
}}
|
|
95
|
-
>
|
|
96
|
-
{t('password')}
|
|
97
|
-
</Button>
|
|
98
|
-
<Button
|
|
99
|
-
size='sm'
|
|
100
|
-
variant='destructive'
|
|
101
|
-
onClick={() => {
|
|
102
|
-
setModal({
|
|
103
|
-
title: t('delete'),
|
|
104
|
-
body: (
|
|
105
|
-
<div className='p-4'>
|
|
106
|
-
<div className='flex flex-col gap-4'>
|
|
107
|
-
<div>{t('deleteEmailText')}</div>
|
|
108
|
-
<div className='flex gap-2'>
|
|
109
|
-
<button
|
|
110
|
-
className='rounded bg-green-600 px-2 py-1 text-white'
|
|
111
|
-
onClick={deleteEmail}
|
|
112
|
-
>
|
|
113
|
-
{t('yes')}
|
|
114
|
-
</button>
|
|
115
|
-
<button
|
|
116
|
-
className='rounded bg-red-800 px-2 py-1 text-white'
|
|
117
|
-
onClick={() => {
|
|
118
|
-
setModal(null)
|
|
119
|
-
}}
|
|
120
|
-
>
|
|
121
|
-
{t('no')}
|
|
122
|
-
</button>
|
|
123
|
-
</div>
|
|
124
|
-
</div>
|
|
125
|
-
</div>
|
|
126
|
-
),
|
|
127
|
-
headerColor: 'bg-red-700',
|
|
128
|
-
titleColor: 'text-white',
|
|
129
|
-
lang: 'en',
|
|
130
|
-
})
|
|
131
|
-
}}
|
|
132
|
-
>
|
|
133
|
-
{t('delete')}
|
|
134
|
-
</Button>
|
|
135
|
-
</CardFooter>
|
|
136
|
-
</Card>
|
|
137
|
-
)
|
|
138
|
-
}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { useI18n } from 'nextjs-cms/translations/client'
|
|
2
|
-
import React from 'react'
|
|
3
|
-
import useModal from '@/hooks/useModal'
|
|
4
|
-
import { useToast } from '@/components/ui/use-toast'
|
|
5
|
-
import InfoCard from '@/components/InfoCard'
|
|
6
|
-
import { trpc } from '@/app/_trpc/client'
|
|
7
|
-
|
|
8
|
-
export default function EmailPasswordForm({ email, action }: { email: string; action: any }) {
|
|
9
|
-
const t = useI18n()
|
|
10
|
-
const { setModal, modal, modalResponse, setModalResponse } = useModal()
|
|
11
|
-
|
|
12
|
-
const { toast } = useToast()
|
|
13
|
-
const quotaMutation = trpc.cpanelEmails.passwordChange.useMutation({
|
|
14
|
-
onError: (error) => {
|
|
15
|
-
setModal({
|
|
16
|
-
title: t('error'),
|
|
17
|
-
body: (
|
|
18
|
-
<div className='p-4'>
|
|
19
|
-
<InfoCard result={{ key: 'danger', title: error.message, status: false }} />
|
|
20
|
-
</div>
|
|
21
|
-
),
|
|
22
|
-
headerColor: 'bg-red-700',
|
|
23
|
-
titleColor: 'text-white',
|
|
24
|
-
lang: 'en',
|
|
25
|
-
})
|
|
26
|
-
},
|
|
27
|
-
onSuccess: (data) => {
|
|
28
|
-
action()
|
|
29
|
-
setModal(null)
|
|
30
|
-
setModalResponse(null)
|
|
31
|
-
toast({
|
|
32
|
-
variant: 'success',
|
|
33
|
-
title: t('success'),
|
|
34
|
-
})
|
|
35
|
-
},
|
|
36
|
-
})
|
|
37
|
-
const handleSubmit = async (e: React.FormEvent<HTMLFormElement>) => {
|
|
38
|
-
e.preventDefault()
|
|
39
|
-
quotaMutation.mutate({
|
|
40
|
-
email,
|
|
41
|
-
password: e.currentTarget.password.value,
|
|
42
|
-
passwordConfirm: e.currentTarget.passwordConfirm.value,
|
|
43
|
-
})
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return (
|
|
47
|
-
<form onSubmit={handleSubmit} className='flex flex-col gap-2'>
|
|
48
|
-
<div>
|
|
49
|
-
<label htmlFor='password' className='block text-sm font-medium leading-6 text-foreground'>
|
|
50
|
-
{t('newPassword')}
|
|
51
|
-
</label>
|
|
52
|
-
<div className=''>
|
|
53
|
-
<input
|
|
54
|
-
id='password'
|
|
55
|
-
name='password'
|
|
56
|
-
type='text'
|
|
57
|
-
autoComplete='password'
|
|
58
|
-
required
|
|
59
|
-
className='block w-full rounded-md border-0 bg-input p-2.5 text-foreground shadow-xs outline-0 ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6'
|
|
60
|
-
/>
|
|
61
|
-
</div>
|
|
62
|
-
</div>
|
|
63
|
-
<div>
|
|
64
|
-
<label htmlFor='passwordConfirm' className='block text-sm font-medium leading-6 text-foreground'>
|
|
65
|
-
{t('confirmNewPassword')}
|
|
66
|
-
</label>
|
|
67
|
-
<div className=''>
|
|
68
|
-
<input
|
|
69
|
-
id='passwordConfirm'
|
|
70
|
-
name='passwordConfirm'
|
|
71
|
-
type='text'
|
|
72
|
-
autoComplete='passwordConfirm'
|
|
73
|
-
required
|
|
74
|
-
className='block w-full rounded-md border-0 bg-input p-2.5 text-foreground shadow-xs outline-0 ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6'
|
|
75
|
-
/>
|
|
76
|
-
</div>
|
|
77
|
-
</div>
|
|
78
|
-
<div className='mt-4'>
|
|
79
|
-
<button className='rounded bg-blue-700 px-2 py-1 font-bold text-white'>
|
|
80
|
-
{t('changePassword')}
|
|
81
|
-
</button>
|
|
82
|
-
</div>
|
|
83
|
-
</form>
|
|
84
|
-
)
|
|
85
|
-
}
|