fix(www): interactive chart

This commit is contained in:
shadcn
2024-11-07 21:36:19 +04:00
parent eff1918d41
commit c7cd16a637
2 changed files with 5 additions and 4 deletions

View File

@@ -18,7 +18,7 @@ export function getRegistryComponent(
name: string,
style: Style["name"] = DEFAULT_REGISTRY_STYLE
) {
return memoizedIndex[style][name].component
return memoizedIndex[style][name]?.component
}
export async function getRegistryItem(

View File

@@ -141,15 +141,16 @@ export default function Component() {
const filteredData = chartData.filter((item) => {
const date = new Date(item.date)
const now = new Date()
const referenceDate = new Date("2024-06-30")
let daysToSubtract = 90
if (timeRange === "30d") {
daysToSubtract = 30
} else if (timeRange === "7d") {
daysToSubtract = 7
}
now.setDate(now.getDate() - daysToSubtract)
return date >= now
const startDate = new Date(referenceDate)
startDate.setDate(startDate.getDate() - daysToSubtract)
return date >= startDate
})
return (