transfer stacked bart chart from overview block
This commit is contained in:
@@ -3,6 +3,45 @@ import FilesTable from '@/app/ui/dashboard/files-table';
|
|||||||
import PageTitle from '@/app/ui/page-title';
|
import PageTitle from '@/app/ui/page-title';
|
||||||
import UploadSectionFile from '@/app/components/upload-section-file';
|
import UploadSectionFile from '@/app/components/upload-section-file';
|
||||||
import { getAllowedFilesExtensions } from '@/app/actions/fileUpload';
|
import { getAllowedFilesExtensions } from '@/app/actions/fileUpload';
|
||||||
|
import { StackedBarChart } from '@/app/components/StackedBarChart';
|
||||||
|
|
||||||
|
const data = [
|
||||||
|
{
|
||||||
|
name: 'File A',
|
||||||
|
checks: 4000,
|
||||||
|
violations: 2000
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'File B',
|
||||||
|
checks: 3000,
|
||||||
|
violations: 1400
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'File C',
|
||||||
|
checks: 2000,
|
||||||
|
violations: 1000
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'File D',
|
||||||
|
checks: 2780,
|
||||||
|
violations: 1000
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'File E',
|
||||||
|
checks: 5090,
|
||||||
|
violations: 4800
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'File F',
|
||||||
|
checks: 5390,
|
||||||
|
violations: 3800
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'File H',
|
||||||
|
checks: 4000,
|
||||||
|
violations: 1500
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
export default async function Page() {
|
export default async function Page() {
|
||||||
const FILE_TYPE = "audio";
|
const FILE_TYPE = "audio";
|
||||||
@@ -11,7 +50,12 @@ export default async function Page() {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<PageTitle title="audio-protection" />
|
<PageTitle title="audio-protection" />
|
||||||
|
<div className="flex justify-between flex-wrap gap-8">
|
||||||
<ProtectionSummary />
|
<ProtectionSummary />
|
||||||
|
<div className="protection-overview grow">
|
||||||
|
<StackedBarChart data={data} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<UploadSectionFile fileType={FILE_TYPE} allowedExtensions={file_extension} maxFileSize={max_file_size} />
|
<UploadSectionFile fileType={FILE_TYPE} allowedExtensions={file_extension} maxFileSize={max_file_size} />
|
||||||
<FilesTable />
|
<FilesTable />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -3,6 +3,45 @@ import FilesTable from '@/app/ui/dashboard/files-table';
|
|||||||
import PageTitle from '@/app/ui/page-title';
|
import PageTitle from '@/app/ui/page-title';
|
||||||
import UploadSectionFile from '@/app/components/upload-section-file';
|
import UploadSectionFile from '@/app/components/upload-section-file';
|
||||||
import { getAllowedFilesExtensions } from '@/app/actions/fileUpload';
|
import { getAllowedFilesExtensions } from '@/app/actions/fileUpload';
|
||||||
|
import {StackedBarChart} from '@/app/components/StackedBarChart';
|
||||||
|
|
||||||
|
const data = [
|
||||||
|
{
|
||||||
|
name: 'File A',
|
||||||
|
checks: 4000,
|
||||||
|
violations: 2000
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'File B',
|
||||||
|
checks: 3000,
|
||||||
|
violations: 1400
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'File C',
|
||||||
|
checks: 2000,
|
||||||
|
violations: 1000
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'File D',
|
||||||
|
checks: 2780,
|
||||||
|
violations: 1000
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'File E',
|
||||||
|
checks: 5090,
|
||||||
|
violations: 4800
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'File F',
|
||||||
|
checks: 5390,
|
||||||
|
violations: 3800
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'File H',
|
||||||
|
checks: 4000,
|
||||||
|
violations: 1500
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
export default async function Page() {
|
export default async function Page() {
|
||||||
const FILE_TYPE = "image";
|
const FILE_TYPE = "image";
|
||||||
@@ -11,7 +50,12 @@ export default async function Page() {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<PageTitle title="image-protection" />
|
<PageTitle title="image-protection" />
|
||||||
|
<div className="flex justify-between flex-wrap gap-8">
|
||||||
<ProtectionSummary />
|
<ProtectionSummary />
|
||||||
|
<div className="protection-overview grow">
|
||||||
|
<StackedBarChart data={data} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<UploadSectionFile fileType={FILE_TYPE} allowedExtensions={file_extension} maxFileSize={max_file_size} />
|
<UploadSectionFile fileType={FILE_TYPE} allowedExtensions={file_extension} maxFileSize={max_file_size} />
|
||||||
<FilesTable />
|
<FilesTable />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -3,6 +3,45 @@ import FilesTable from '@/app/ui/dashboard/files-table';
|
|||||||
import PageTitle from '@/app/ui/page-title';
|
import PageTitle from '@/app/ui/page-title';
|
||||||
import UploadSectionFile from '@/app/components/upload-section-file';
|
import UploadSectionFile from '@/app/components/upload-section-file';
|
||||||
import { getAllowedFilesExtensions } from '@/app/actions/fileUpload';
|
import { getAllowedFilesExtensions } from '@/app/actions/fileUpload';
|
||||||
|
import { StackedBarChart } from '@/app/components/StackedBarChart';
|
||||||
|
|
||||||
|
const data = [
|
||||||
|
{
|
||||||
|
name: 'File A',
|
||||||
|
checks: 4000,
|
||||||
|
violations: 2000
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'File B',
|
||||||
|
checks: 3000,
|
||||||
|
violations: 1400
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'File C',
|
||||||
|
checks: 2000,
|
||||||
|
violations: 1000
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'File D',
|
||||||
|
checks: 2780,
|
||||||
|
violations: 1000
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'File E',
|
||||||
|
checks: 5090,
|
||||||
|
violations: 4800
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'File F',
|
||||||
|
checks: 5390,
|
||||||
|
violations: 3800
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'File H',
|
||||||
|
checks: 4000,
|
||||||
|
violations: 1500
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
export default async function Page() {
|
export default async function Page() {
|
||||||
const FILE_TYPE = "video";
|
const FILE_TYPE = "video";
|
||||||
@@ -11,7 +50,12 @@ export default async function Page() {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<PageTitle title="video-protection" />
|
<PageTitle title="video-protection" />
|
||||||
|
<div className="flex justify-between flex-wrap gap-8">
|
||||||
<ProtectionSummary />
|
<ProtectionSummary />
|
||||||
|
<div className="protection-overview grow">
|
||||||
|
<StackedBarChart data={data} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<UploadSectionFile fileType={FILE_TYPE} allowedExtensions={file_extension} maxFileSize={max_file_size} />
|
<UploadSectionFile fileType={FILE_TYPE} allowedExtensions={file_extension} maxFileSize={max_file_size} />
|
||||||
<FilesTable />
|
<FilesTable />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
'use client'
|
||||||
|
|
||||||
import { useTranslations } from 'next-intl';
|
import { useTranslations } from 'next-intl';
|
||||||
import { BarChart, Bar, Cell, XAxis, Tooltip } from 'recharts';
|
import { BarChart, Bar, Cell, XAxis, Tooltip } from 'recharts';
|
||||||
|
|
||||||
@@ -139,6 +141,9 @@ export const StackedBarChart = ({ data }: Files) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<>
|
||||||
|
<div className="protection-stat relative">
|
||||||
|
<div className="stacked-bar-chart">
|
||||||
<BarChart
|
<BarChart
|
||||||
style={{ width: '100%', maxWidth: '600px', maxHeight: '210px', aspectRatio: 1.618 }}
|
style={{ width: '100%', maxWidth: '600px', maxHeight: '210px', aspectRatio: 1.618 }}
|
||||||
responsive
|
responsive
|
||||||
@@ -181,5 +186,20 @@ export const StackedBarChart = ({ data }: Files) => {
|
|||||||
))}
|
))}
|
||||||
</Bar>
|
</Bar>
|
||||||
</BarChart>
|
</BarChart>
|
||||||
|
</div>
|
||||||
|
<div className="protection-stat-total-info">
|
||||||
|
<div
|
||||||
|
className="font-bold"
|
||||||
|
>
|
||||||
|
{t('check')}: 777
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
className="font-bold text-[#f08c00]"
|
||||||
|
>
|
||||||
|
{t('violations')}: 777
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -78,10 +78,27 @@
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
|
&.total-checks,
|
||||||
|
&.total-files {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 1.5fr;
|
||||||
|
gap: 0 10px;
|
||||||
|
|
||||||
|
.protection-stat-value {
|
||||||
|
justify-self: end;
|
||||||
|
padding-right: 10px;
|
||||||
|
padding-left: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.protection-stat-label {
|
||||||
|
text-align: start;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&-row {
|
&-row {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: start;
|
justify-content: center;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
@@ -99,6 +116,7 @@
|
|||||||
&-label {
|
&-label {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
opacity: 0.9;
|
opacity: 0.9;
|
||||||
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
&-total-info {
|
&-total-info {
|
||||||
@@ -150,6 +168,11 @@
|
|||||||
transition: all 0.3s ease;
|
transition: all 0.3s ease;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&:has(.stacked-bar-chart) {
|
||||||
|
height: 100%;
|
||||||
|
padding-left: 100px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&-switch {
|
&-switch {
|
||||||
@@ -157,6 +180,10 @@
|
|||||||
right: 10px;
|
right: 10px;
|
||||||
top: 10px;
|
top: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&:has(.stacked-bar-chart) {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.stats-wrapper {
|
.stats-wrapper {
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ export default function ProtectionOverview() {
|
|||||||
<div className="protection-stat-label">{t('total-files')}</div>
|
<div className="protection-stat-label">{t('total-files')}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="protection-stat total-checks">
|
{/* <div className="protection-stat total-checks">
|
||||||
<div className="protection-stat-row">
|
<div className="protection-stat-row">
|
||||||
<div className="protection-stat-value">0</div>
|
<div className="protection-stat-value">0</div>
|
||||||
<div className="protection-stat-label">{t('check')}</div>
|
<div className="protection-stat-label">{t('check')}</div>
|
||||||
@@ -48,6 +48,13 @@ export default function ProtectionOverview() {
|
|||||||
<div className="protection-stat-value">0</div>
|
<div className="protection-stat-value">0</div>
|
||||||
<div className="protection-stat-label">{t('violations')}</div>
|
<div className="protection-stat-label">{t('violations')}</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div> */}
|
||||||
|
<div className="protection-stat total-checks">
|
||||||
|
<div className="protection-stat-value">0</div>
|
||||||
|
<div className="protection-stat-label">{t('check')}</div>
|
||||||
|
<div className="protection-stat-value">0</div>
|
||||||
|
<div className="protection-stat-label">{t('violations')}</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
|
|||||||
@@ -1,128 +1,32 @@
|
|||||||
'use client'
|
'use client'
|
||||||
|
|
||||||
import { useState } from 'react';
|
|
||||||
import { StackedBarChart } from '@/app/components/StackedBarChart';
|
|
||||||
import { useTranslations } from 'next-intl';
|
import { useTranslations } from 'next-intl';
|
||||||
|
|
||||||
const data = [
|
|
||||||
{
|
|
||||||
name: 'File A',
|
|
||||||
checks: 4000,
|
|
||||||
violations: 2000
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'File B',
|
|
||||||
checks: 3000,
|
|
||||||
violations: 1400
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'File C',
|
|
||||||
checks: 2000,
|
|
||||||
violations: 1000
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'File D',
|
|
||||||
checks: 2780,
|
|
||||||
violations: 1000
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'File E',
|
|
||||||
checks: 5090,
|
|
||||||
violations: 4800
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'File F',
|
|
||||||
checks: 5390,
|
|
||||||
violations: 3800
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'File H',
|
|
||||||
checks: 4000,
|
|
||||||
violations: 1500
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
export default function ProtectionSummary() {
|
export default function ProtectionSummary() {
|
||||||
const [isOpen, setIsOpen] = useState(false);
|
|
||||||
const t = useTranslations('Global');
|
const t = useTranslations('Global');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="protection-overview">
|
<div className="protection-overview grow">
|
||||||
<h3>{t('protecting-your-content')}</h3>
|
<h3>{t('protecting-your-content')}</h3>
|
||||||
<p>{t('current-status-of')}</p>
|
<p>{t('current-status-of')}</p>
|
||||||
<div className={`protection-stats ${isOpen ? "opened" : ""}`}>
|
<div className="protection-stats">
|
||||||
<div className="protection-stat total-files">
|
<div className="protection-stat total-files">
|
||||||
<div className="protection-stat-value">0</div>
|
<div className="protection-stat-value">0</div>
|
||||||
<div className="protection-stat-label">{t('total-files')}</div>
|
<div className="protection-stat-label">{t('total-files')}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="protection-stat total-checks">
|
<div className="protection-stat total-checks">
|
||||||
{isOpen ? (
|
|
||||||
<>
|
|
||||||
<div className="protection-stat-value">0</div>
|
|
||||||
<div className="protection-stat-label">
|
|
||||||
{t('size')}
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
) :
|
|
||||||
<>
|
|
||||||
<div className="protection-stat-row">
|
|
||||||
<div className="protection-stat-value">0</div>
|
<div className="protection-stat-value">0</div>
|
||||||
<div className="protection-stat-label">{t('check')}</div>
|
<div className="protection-stat-label">{t('check')}</div>
|
||||||
</div>
|
|
||||||
<div className="protection-stat-row">
|
|
||||||
<div className="protection-stat-value">0</div>
|
<div className="protection-stat-value">0</div>
|
||||||
<div className="protection-stat-label">{t('violations')}</div>
|
<div className="protection-stat-label">{t('violations')}</div>
|
||||||
</div>
|
</div>
|
||||||
</>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
{isOpen ? (
|
|
||||||
<div className="protection-stat total-usage relative">
|
|
||||||
<div className="stacked-bar-chart">
|
|
||||||
<StackedBarChart data={data} />
|
|
||||||
</div>
|
|
||||||
<div className="protection-stat-total-info">
|
|
||||||
<div
|
|
||||||
className="font-bold"
|
|
||||||
>
|
|
||||||
{t('check')}: 777
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
className="font-bold text-[#f08c00]"
|
|
||||||
>
|
|
||||||
{t('violations')}: 777
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
) : (
|
|
||||||
<div className="protection-stat total-usage">
|
<div className="protection-stat total-usage">
|
||||||
<div className="protection-stat-value">0</div>
|
<div className="protection-stat-value">0 / 0</div>
|
||||||
<div className="protection-stat-label">
|
<div className="protection-stat-label">
|
||||||
{t('size')}
|
{t('disk-space-used')}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
<button
|
|
||||||
className="protection-overview-switch cursor-pointer"
|
|
||||||
onClick={() => {
|
|
||||||
setIsOpen(!isOpen);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<svg
|
|
||||||
className={`w-5 h-5 ml-2 transition-transform ${isOpen ? 'rotate-180' : ''}`}
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
viewBox="0 0 20 20"
|
|
||||||
fill="currentColor"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
fillRule="evenodd"
|
|
||||||
d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z"
|
|
||||||
clipRule="evenodd"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user