This commit is contained in:
Carl-Gerhard Lindesvärd
2025-03-28 09:31:12 +01:00
parent 56c7283ec6
commit d4fcc82fc3
4 changed files with 409 additions and 2 deletions

View File

@@ -23,6 +23,7 @@ import {
PieChartIcon,
PlusIcon,
Trash,
TrendingUpIcon,
} from 'lucide-react';
import Link from 'next/link';
import { useRouter } from 'next/navigation';
@@ -113,6 +114,7 @@ export function ListDashboards({ dashboards }: ListDashboardsProps) {
funnel: ConeIcon,
area: AreaChartIcon,
retention: ChartScatterIcon,
conversion: TrendingUpIcon,
}[report.chartType];
return (

View File

@@ -218,7 +218,8 @@ const { Tooltip, TooltipProvider } = createChartTooltip<
metric: (typeof TITLES)[number];
interval: IInterval;
}
>(({ context: { metric, interval }, data }) => {
>(({ context: { metric, interval }, data: dataArray }) => {
const data = dataArray[0]!;
const formatDate = useFormatDateInterval(interval);
const number = useNumber();

View File

@@ -1,7 +1,7 @@
'use client';
import { PencilIcon } from 'lucide-react';
import { useState } from 'react';
import { useEffect, useRef, useState } from 'react';
type Props = {
name?: string;
@@ -10,6 +10,7 @@ type Props = {
const EditReportName = ({ name }: Props) => {
const [isEditing, setIsEditing] = useState(false);
const [newName, setNewName] = useState(name);
const inputRef = useRef<HTMLInputElement>(null);
const onSubmit = () => {
if (newName === name) {
@@ -29,11 +30,19 @@ const EditReportName = ({ name }: Props) => {
setIsEditing(false);
};
useEffect(() => {
if (isEditing) {
inputRef.current?.focus();
}
}, [isEditing]);
if (isEditing) {
return (
<div className="flex">
<input
ref={inputRef}
type="text"
className="w-full rounded-md border border-input p-2 text-sm focus:outline-none focus:ring-2 focus:ring-ring"
value={newName}
onKeyDown={(e) => {
if (e.key === 'Enter') {