- Updated .env.example to include configuration for OnlyOffice Document Server. - Modified the workspace configuration to remove the drive-suite path. - Adjusted TypeScript environment imports for consistency. - Enhanced Next.js configuration to disable canvas in Webpack. - Updated package.json to include new dependencies for OnlyOffice and PDF.js. - Added global styles for OnlyOffice theme integration in the CSS. - Created new layout and page components for the Drive feature, including public sharing and editing functionalities. - Updated metadata handling across various layouts to reflect the new app structure.
28 lines
944 B
TypeScript
28 lines
944 B
TypeScript
"use client"
|
|
|
|
import { useDriveQuota } from "@/lib/api/hooks/use-drive-queries"
|
|
|
|
function formatBytes(n: number) {
|
|
if (n < 1024) return `${n} o`
|
|
if (n < 1024 ** 2) return `${(n / 1024).toFixed(1)} Ko`
|
|
if (n < 1024 ** 3) return `${(n / 1024 ** 2).toFixed(1)} Mo`
|
|
return `${(n / 1024 ** 3).toFixed(1)} Go`
|
|
}
|
|
|
|
export function DriveQuotaBar() {
|
|
const { data } = useDriveQuota()
|
|
if (!data || data.total <= 0) return null
|
|
const usedPct = Math.min(100, Math.round((data.used / data.total) * 100))
|
|
return (
|
|
<div className="space-y-1 text-xs text-muted-foreground">
|
|
<div className="flex justify-between">
|
|
<span>Stockage</span>
|
|
<span>{formatBytes(data.used)} / {formatBytes(data.total)}</span>
|
|
</div>
|
|
<div className="h-1.5 overflow-hidden rounded-full bg-muted">
|
|
<div className="h-full rounded-full bg-primary transition-all" style={{ width: `${usedPct}%` }} />
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|