mirror of
https://github.com/kjanat/livedash-node.git
synced 2026-01-16 17:32:09 +01:00
Broken shit
This commit is contained in:
@ -63,10 +63,11 @@ export default function DateRangePicker({
|
||||
const setLast30Days = () => {
|
||||
const thirtyDaysAgo = new Date();
|
||||
thirtyDaysAgo.setDate(thirtyDaysAgo.getDate() - 30);
|
||||
const thirtyDaysAgoStr = thirtyDaysAgo.toISOString().split('T')[0];
|
||||
const thirtyDaysAgoStr = thirtyDaysAgo.toISOString().split("T")[0];
|
||||
|
||||
// Use the later of 30 days ago or minDate
|
||||
const newStartDate = thirtyDaysAgoStr > minDate ? thirtyDaysAgoStr : minDate;
|
||||
const newStartDate =
|
||||
thirtyDaysAgoStr > minDate ? thirtyDaysAgoStr : minDate;
|
||||
setStartDate(newStartDate);
|
||||
setEndDate(maxDate);
|
||||
};
|
||||
@ -74,7 +75,7 @@ export default function DateRangePicker({
|
||||
const setLast7Days = () => {
|
||||
const sevenDaysAgo = new Date();
|
||||
sevenDaysAgo.setDate(sevenDaysAgo.getDate() - 7);
|
||||
const sevenDaysAgoStr = sevenDaysAgo.toISOString().split('T')[0];
|
||||
const sevenDaysAgoStr = sevenDaysAgo.toISOString().split("T")[0];
|
||||
|
||||
// Use the later of 7 days ago or minDate
|
||||
const newStartDate = sevenDaysAgoStr > minDate ? sevenDaysAgoStr : minDate;
|
||||
@ -146,7 +147,8 @@ export default function DateRangePicker({
|
||||
</div>
|
||||
|
||||
<div className="mt-2 text-xs text-gray-500">
|
||||
Available data: {new Date(minDate).toLocaleDateString()} - {new Date(maxDate).toLocaleDateString()}
|
||||
Available data: {new Date(minDate).toLocaleDateString()} -{" "}
|
||||
{new Date(maxDate).toLocaleDateString()}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@ -48,7 +48,7 @@ const getCountryCoordinates = (): Record<string, [number, number]> => {
|
||||
BG: [42.7339, 25.4858],
|
||||
HR: [45.1, 15.2],
|
||||
SK: [48.669, 19.699],
|
||||
SI: [46.1512, 14.9955]
|
||||
SI: [46.1512, 14.9955],
|
||||
};
|
||||
// This function now primarily returns fallbacks.
|
||||
// The actual fetching using @rapideditor/country-coder will be in the component's useEffect.
|
||||
|
||||
@ -1,14 +1,17 @@
|
||||
'use client';
|
||||
"use client";
|
||||
|
||||
import React from 'react';
|
||||
import { TopQuestion } from '../lib/types';
|
||||
import React from "react";
|
||||
import { TopQuestion } from "../lib/types";
|
||||
|
||||
interface TopQuestionsChartProps {
|
||||
data: TopQuestion[];
|
||||
title?: string;
|
||||
}
|
||||
|
||||
export default function TopQuestionsChart({ data, title = "Top 5 Asked Questions" }: TopQuestionsChartProps) {
|
||||
export default function TopQuestionsChart({
|
||||
data,
|
||||
title = "Top 5 Asked Questions",
|
||||
}: TopQuestionsChartProps) {
|
||||
if (!data || data.length === 0) {
|
||||
return (
|
||||
<div className="bg-white p-6 rounded-lg shadow-sm border border-gray-200">
|
||||
@ -21,7 +24,7 @@ export default function TopQuestionsChart({ data, title = "Top 5 Asked Questions
|
||||
}
|
||||
|
||||
// Find the maximum count to calculate relative bar widths
|
||||
const maxCount = Math.max(...data.map(q => q.count));
|
||||
const maxCount = Math.max(...data.map((q) => q.count));
|
||||
|
||||
return (
|
||||
<div className="bg-white p-6 rounded-lg shadow-sm border border-gray-200">
|
||||
@ -29,7 +32,8 @@ export default function TopQuestionsChart({ data, title = "Top 5 Asked Questions
|
||||
|
||||
<div className="space-y-4">
|
||||
{data.map((question, index) => {
|
||||
const percentage = maxCount > 0 ? (question.count / maxCount) * 100 : 0;
|
||||
const percentage =
|
||||
maxCount > 0 ? (question.count / maxCount) * 100 : 0;
|
||||
|
||||
return (
|
||||
<div key={index} className="relative">
|
||||
|
||||
Reference in New Issue
Block a user