{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "database-metrics-card",
  "type": "registry:item",
  "title": "Database Metrics Card",
  "description": "A database-metrics-card block.",
  "dependencies": [
    "@mui/material",
    "@mui/x-charts",
    "@emotion/react",
    "@emotion/styled"
  ],
  "registryDependencies": [],
  "files": [
    {
      "path": "blocks/database-metrics-card/database-metrics-card.tsx",
      "target": "src/mui-treasury/blocks/database-metrics-card/database-metrics-card.tsx",
      "content": "'use client';\n\nimport * as React from 'react';\n\nimport Box from '@mui/material/Box';\nimport Card from '@mui/material/Card';\nimport Chip from '@mui/material/Chip';\nimport Stack from '@mui/material/Stack';\nimport Typography from '@mui/material/Typography';\nimport { LineChart } from '@mui/x-charts/LineChart';\n\n// Generate mock data for the charts\nconst generateChartData = () => {\n  const dates = [];\n  const readCurrent = [];\n  const readPrevious = [];\n  const writeCurrent = [];\n  const writePrevious = [];\n\n  // Generate dates from Apr 16 to May 16\n  const startDate = new Date(2024, 3, 16); // April 16\n  const endDate = new Date(2024, 4, 16); // May 16\n\n  for (let d = new Date(startDate); d <= endDate; d.setDate(d.getDate() + 1)) {\n    const dayIndex = dates.length;\n    dates.push(d.getTime());\n\n    // Generate read data with upward trend\n    const baseRead = 615752;\n    const trendRead = dayIndex * 900;\n    const noiseRead =\n      Math.sin(dayIndex * 0.5) * 15000 +\n      (Math.sin(dayIndex * 2.3) * 0.5 + 0.5) * 5000;\n    readCurrent.push(baseRead + trendRead + noiseRead);\n    readPrevious.push(\n      baseRead - 10000 + (Math.sin(dayIndex * 1.7) * 0.5 + 0.5) * 8000,\n    );\n\n    // Generate write data with slight downward trend\n    const baseWrite = 86580;\n    const trendWrite = -dayIndex * 100;\n    const noiseWrite =\n      Math.sin(dayIndex * 0.4) * 3000 +\n      (Math.sin(dayIndex * 3.1) * 0.5 + 0.5) * 2000;\n    writeCurrent.push(baseWrite + trendWrite + noiseWrite);\n    writePrevious.push(\n      baseWrite + 5000 + (Math.sin(dayIndex * 2.5) * 0.5 + 0.5) * 3000,\n    );\n  }\n\n  return {\n    dates,\n    readCurrent,\n    readPrevious,\n    writeCurrent,\n    writePrevious,\n  };\n};\n\nconst { dates, readCurrent, readPrevious, writeCurrent, writePrevious } =\n  generateChartData();\n\ninterface MetricCardProps {\n  title: string;\n  value: string;\n  comparison: string;\n  percentageChange: number;\n  chartData: number[];\n  previousData: number[];\n}\n\nfunction MetricCard({\n  title,\n  value,\n  comparison,\n  percentageChange,\n  chartData,\n  previousData,\n}: MetricCardProps) {\n  const isPositive = percentageChange > 0;\n\n  return (\n    <Stack spacing={2} sx={{ flex: 1 }}>\n      <Box>\n        <Stack\n          direction=\"row\"\n          spacing={1}\n          sx={{\n            alignItems: 'center',\n            mb: 1,\n          }}\n        >\n          <Typography\n            variant=\"body2\"\n            sx={{\n              color: 'text.secondary',\n              fontWeight: 500,\n            }}\n          >\n            {title}\n          </Typography>\n          <Chip\n            label={`${isPositive ? '+' : ''}${percentageChange}%`}\n            size=\"small\"\n            variant=\"filled\"\n            color={isPositive ? 'success' : 'error'}\n            sx={{\n              height: 20,\n              fontSize: 12,\n              fontWeight: 600,\n              '& .MuiChip-label': {\n                px: 0.75,\n              },\n            }}\n            aria-label={`${percentageChange}% ${\n              isPositive ? 'increase' : 'decrease'\n            }`}\n          />\n        </Stack>\n        <Box\n          sx={{\n            display: 'flex',\n            alignItems: 'baseline',\n            justifyContent: 'space-between',\n          }}\n        >\n          <Typography\n            variant=\"h4\"\n            sx={{\n              fontWeight: 700,\n              color: 'text.primary',\n              mb: 0.5,\n            }}\n          >\n            {value}\n          </Typography>\n          <Typography\n            variant=\"caption\"\n            sx={{\n              color: 'text.secondary',\n            }}\n          >\n            {comparison}\n          </Typography>\n        </Box>\n      </Box>\n      <Box\n        sx={{ width: '100%', minWidth: 280, height: 140 }}\n        role=\"img\"\n        aria-label={`${title} trend chart showing ${\n          isPositive ? 'growth' : 'decline'\n        } over time`}\n      >\n        <LineChart\n          series={[\n            {\n              data: previousData,\n              color: '#9CA3AF',\n              curve: 'linear',\n              showMark: false,\n              area: true,\n              stack: 'A',\n            },\n            {\n              data: chartData,\n              color: '#3B82F6',\n              curve: 'linear',\n              showMark: false,\n              area: true,\n              stack: 'B',\n            },\n          ]}\n          xAxis={[\n            {\n              data: dates,\n              scaleType: 'time',\n              tickLabelStyle: {\n                fontSize: 11,\n                fill: 'var(--mui-palette-text-secondary)',\n              },\n              // tickNumber: 2,\n              valueFormatter: (value) => {\n                const date = new Date(value);\n                return `${String(date.getDate()).padStart(2, '0')}/${String(\n                  date.getMonth() + 1,\n                ).padStart(2, '0')}/${date.getFullYear()}`;\n              },\n            },\n          ]}\n          yAxis={[\n            {\n              position: 'none',\n              width: 0,\n            },\n          ]}\n          margin={{\n            left: -24,\n            right: -32,\n            top: 0,\n            bottom: 0,\n          }}\n          height={140}\n          sx={(theme) => ({\n            '& .MuiLineElement-root': {\n              strokeWidth: 2,\n            },\n            '& .MuiAreaElement-root': {\n              fillOpacity: 0.15,\n            },\n            '& .MuiChartsAxis-line': {\n              display: 'none',\n            },\n            '& .MuiChartsAxis-tick': {\n              display: 'none',\n            },\n            ...theme.applyStyles('dark', {\n              '& .MuiAreaElement-root': {\n                fillOpacity: 0.1,\n              },\n            }),\n          })}\n        />\n      </Box>\n    </Stack>\n  );\n}\n\nexport function DatabaseMetricsCard() {\n  return (\n    <Card\n      sx={(theme) => ({\n        p: 3,\n        borderRadius: 2,\n        border: '1px solid',\n        borderColor: 'divider',\n        bgcolor: 'background.paper',\n        boxShadow: 'none',\n        ...theme.applyStyles('dark', {\n          borderColor: 'divider',\n        }),\n      })}\n    >\n      <Stack direction=\"row\" spacing={4}>\n        <MetricCard\n          title=\"Rows read\"\n          value=\"643,015\"\n          comparison=\"from 615,752\"\n          percentageChange={4.4}\n          chartData={readCurrent}\n          previousData={readPrevious}\n        />\n        <MetricCard\n          title=\"Rows written\"\n          value=\"83,197\"\n          comparison=\"from 86,580\"\n          percentageChange={-3.9}\n          chartData={writeCurrent}\n          previousData={writePrevious}\n        />\n      </Stack>\n    </Card>\n  );\n}\n",
      "type": "registry:item"
    },
    {
      "path": "blocks/database-metrics-card/index.ts",
      "target": "src/mui-treasury/blocks/database-metrics-card/index.ts",
      "content": "export * from './database-metrics-card';\n",
      "type": "registry:item"
    }
  ],
  "meta": {
    "screenshot": "/og/database-metrics-card.png",
    "category": "block",
    "exportName": "DatabaseMetricsCard",
    "subcategory": "dashboard"
  }
}