mirror of
https://github.com/formbricks/formbricks.git
synced 2026-02-19 00:51:06 -06:00
chore: fixing type, build and lint issues
This commit is contained in:
@@ -242,7 +242,8 @@ export function AdvancedChartBuilder({
|
||||
.finally(() => {
|
||||
setIsLoading(false);
|
||||
});
|
||||
}, [state.chartType, state.selectedMeasures, state.selectedDimensions, state.filters, state.timeDimension, isInitialized, environmentId, onChartGenerated, chartData, query]);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [state.chartType, state.selectedMeasures, state.selectedDimensions, state.filters, state.filterLogic, state.customMeasures, state.timeDimension, isInitialized, environmentId, onChartGenerated, chartData, query]);
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [isSaveDialogOpen, setIsSaveDialogOpen] = useState(false);
|
||||
@@ -371,7 +372,6 @@ export function AdvancedChartBuilder({
|
||||
}
|
||||
|
||||
setIsSaving(true);
|
||||
console.log(query);
|
||||
try {
|
||||
const chartResult = await createChartAction({
|
||||
environmentId,
|
||||
@@ -581,7 +581,7 @@ export function AdvancedChartBuilder({
|
||||
|
||||
{!chartData && !isLoading && !error && (
|
||||
<div className="flex h-64 items-center justify-center rounded-lg border border-gray-200 bg-gray-50 text-gray-500">
|
||||
Configure your chart and click "Run Query" to preview
|
||||
Configure your chart and click "Run Query" to preview
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -16,7 +16,7 @@ import {
|
||||
import { mapChartType, mapDatabaseChartTypeToApi } from "../lib/chart-utils";
|
||||
import { AIQuerySection } from "./AIQuerySection";
|
||||
import { AddToDashboardDialog } from "./AddToDashboardDialog";
|
||||
import { AdvancedChartBuilder } from "./AdvancedChartBuilder";
|
||||
|
||||
import { ChartPreview } from "./ChartPreview";
|
||||
import { ConfigureChartDialog } from "./ConfigureChartDialog";
|
||||
import { ManualChartBuilder } from "./ManualChartBuilder";
|
||||
@@ -38,9 +38,9 @@ export function ChartBuilderClient({ environmentId, chartId }: ChartBuilderClien
|
||||
const [dashboards, setDashboards] = useState<Array<{ id: string; name: string }>>([]);
|
||||
const [selectedDashboardId, setSelectedDashboardId] = useState<string>("");
|
||||
const [isSaving, setIsSaving] = useState(false);
|
||||
const [showData, setShowData] = useState(false);
|
||||
|
||||
const [configuredChartType, setConfiguredChartType] = useState<string | null>(null);
|
||||
const [showAdvancedBuilder, setShowAdvancedBuilder] = useState(false);
|
||||
|
||||
const [isLoadingChart, setIsLoadingChart] = useState(false);
|
||||
const [currentChartId, setCurrentChartId] = useState<string | undefined>(chartId);
|
||||
|
||||
@@ -71,8 +71,8 @@ export function ChartBuilderClient({ environmentId, chartId }: ChartBuilderClien
|
||||
query: chart.query as any,
|
||||
});
|
||||
|
||||
if (queryResult?.error || queryResult?.serverError) {
|
||||
toast.error(queryResult.error || queryResult.serverError || "Failed to load chart data");
|
||||
if (queryResult?.data?.error || queryResult?.serverError) {
|
||||
toast.error(queryResult.data?.error || queryResult.serverError || "Failed to load chart data");
|
||||
setIsLoadingChart(false);
|
||||
return;
|
||||
}
|
||||
@@ -219,14 +219,6 @@ export function ChartBuilderClient({ environmentId, chartId }: ChartBuilderClien
|
||||
}
|
||||
};
|
||||
|
||||
const handleManualCreate = () => {
|
||||
if (!selectedChartType) {
|
||||
toast.error("Please select a chart type first");
|
||||
return;
|
||||
}
|
||||
setShowAdvancedBuilder(true);
|
||||
};
|
||||
|
||||
// If loading an existing chart, show loading state
|
||||
if (chartId && isLoadingChart) {
|
||||
return (
|
||||
@@ -240,13 +232,7 @@ export function ChartBuilderClient({ environmentId, chartId }: ChartBuilderClien
|
||||
if (chartId && chartData) {
|
||||
return (
|
||||
<div className="grid gap-8">
|
||||
<ChartPreview
|
||||
chartData={chartData}
|
||||
configuredChartType={configuredChartType}
|
||||
showData={showData}
|
||||
onToggleData={() => setShowData(!showData)}
|
||||
onConfigure={() => setIsConfigureDialogOpen(true)}
|
||||
/>
|
||||
<ChartPreview chartData={chartData} />
|
||||
|
||||
{/* Dialogs */}
|
||||
<SaveChartDialog
|
||||
@@ -289,13 +275,7 @@ export function ChartBuilderClient({ environmentId, chartId }: ChartBuilderClien
|
||||
|
||||
{/* Chart Preview */}
|
||||
{chartData && (
|
||||
<ChartPreview
|
||||
chartData={chartData}
|
||||
configuredChartType={configuredChartType}
|
||||
showData={showData}
|
||||
onToggleData={() => setShowData(!showData)}
|
||||
onConfigure={() => setIsConfigureDialogOpen(true)}
|
||||
/>
|
||||
<ChartPreview chartData={chartData} />
|
||||
)}
|
||||
|
||||
<div className="relative">
|
||||
@@ -308,15 +288,10 @@ export function ChartBuilderClient({ environmentId, chartId }: ChartBuilderClien
|
||||
</div>
|
||||
|
||||
{/* Option 2: Build Manually */}
|
||||
{showAdvancedBuilder ? (
|
||||
<AdvancedChartBuilder environmentId={environmentId} initialChartType={selectedChartType} />
|
||||
) : (
|
||||
<ManualChartBuilder
|
||||
selectedChartType={selectedChartType}
|
||||
onChartTypeSelect={setSelectedChartType}
|
||||
onCreate={handleManualCreate}
|
||||
/>
|
||||
)}
|
||||
<ManualChartBuilder
|
||||
selectedChartType={selectedChartType}
|
||||
onChartTypeSelect={setSelectedChartType}
|
||||
/>
|
||||
|
||||
{/* Dialogs */}
|
||||
<SaveChartDialog
|
||||
|
||||
@@ -222,7 +222,7 @@ export function ChartRenderer({ chartType, data }: ChartRendererProps) {
|
||||
default:
|
||||
return (
|
||||
<div className="flex h-64 items-center justify-center text-gray-500">
|
||||
Chart type "{chartType}" not yet supported
|
||||
Chart type "{chartType}" not yet supported
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import { Plus, TrashIcon } from "lucide-react";
|
||||
import { Button } from "@/modules/ui/components/button";
|
||||
import { Input } from "@/modules/ui/components/input";
|
||||
import { MultiSelect } from "@/modules/ui/components/multi-select";
|
||||
|
||||
import {
|
||||
Select,
|
||||
SelectContent,
|
||||
@@ -69,7 +69,6 @@ export function FiltersPanel({
|
||||
const getValueInput = (filter: FilterRow, index: number) => {
|
||||
const field = getFieldById(filter.field);
|
||||
const fieldType = field?.type || "string";
|
||||
const operators = getFilterOperatorsForType(fieldType as "string" | "number" | "time");
|
||||
|
||||
// For set/notSet operators, no value input needed
|
||||
if (filter.operator === "set" || filter.operator === "notSet") {
|
||||
|
||||
@@ -16,7 +16,7 @@ const AVAILABLE_CHART_TYPES = CHART_TYPES.filter(
|
||||
export function ManualChartBuilder({
|
||||
selectedChartType,
|
||||
onChartTypeSelect,
|
||||
}: Omit<ManualChartBuilderProps, "onCreate">) {
|
||||
}: ManualChartBuilderProps) {
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
<h2 className="font-medium text-gray-900">Choose chart type</h2>
|
||||
|
||||
@@ -10,12 +10,12 @@ import {
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from "@/modules/ui/components/select";
|
||||
import { Input } from "@/modules/ui/components/input";
|
||||
|
||||
import { Popover, PopoverContent, PopoverTrigger } from "@/modules/ui/components/popover";
|
||||
import Calendar from "react-calendar";
|
||||
import { format } from "date-fns";
|
||||
import { FEEDBACK_FIELDS, TIME_GRANULARITIES, DATE_PRESETS } from "../lib/schema-definition";
|
||||
import { TimeDimensionConfig, getDateRangeFromPreset } from "../lib/query-builder";
|
||||
import { TimeDimensionConfig } from "../lib/query-builder";
|
||||
import "@/modules/ui/components/date-picker/styles.css";
|
||||
|
||||
interface TimeDimensionPanelProps {
|
||||
|
||||
@@ -123,7 +123,7 @@ export function parseQueryToState(query: CubeQuery, chartType?: string): Partial
|
||||
state.timeDimension = {
|
||||
dimension: timeDim.dimension,
|
||||
granularity: (timeDim.granularity || "day") as TimeDimensionConfig["granularity"],
|
||||
dateRange: timeDim.dateRange || "last 30 days",
|
||||
dateRange: (timeDim.dateRange || "last 30 days") as TimeDimensionConfig["dateRange"],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ interface ChartDropdownMenuProps {
|
||||
}
|
||||
|
||||
export const ChartDropdownMenu = ({
|
||||
environmentId,
|
||||
environmentId: _environmentId,
|
||||
chart,
|
||||
disabled,
|
||||
deleteChart,
|
||||
|
||||
@@ -34,7 +34,7 @@ const CHART_TYPE_ICONS: Record<string, React.ComponentType<{ className?: string
|
||||
map: MapIcon,
|
||||
};
|
||||
|
||||
export function ChartsListClient({ charts: initialCharts, dashboards, environmentId }: ChartsListClientProps) {
|
||||
export function ChartsListClient({ charts: initialCharts, dashboards: _dashboards, environmentId }: ChartsListClientProps) {
|
||||
const [charts, setCharts] = useState(initialCharts);
|
||||
const [editingChartId, setEditingChartId] = useState<string | undefined>(undefined);
|
||||
const [isEditDialogOpen, setIsEditDialogOpen] = useState(false);
|
||||
|
||||
@@ -87,8 +87,8 @@ export function CreateChartDialog({
|
||||
query: chart.query as any,
|
||||
});
|
||||
|
||||
if (queryResult?.error || queryResult?.serverError) {
|
||||
toast.error(queryResult.error || queryResult.serverError || "Failed to load chart data");
|
||||
if (queryResult?.data?.error || queryResult?.serverError) {
|
||||
toast.error(queryResult.data?.error || queryResult.serverError || "Failed to load chart data");
|
||||
setIsLoadingChart(false);
|
||||
return;
|
||||
}
|
||||
@@ -370,14 +370,14 @@ export function CreateChartDialog({
|
||||
setSelectedChartType(data.chartType);
|
||||
}
|
||||
}}
|
||||
onSave={(chartId) => {
|
||||
setCurrentChartId(chartId);
|
||||
onSave={(savedChartId) => {
|
||||
setCurrentChartId(savedChartId);
|
||||
setIsSaveDialogOpen(false);
|
||||
onOpenChange(false);
|
||||
onSuccess?.();
|
||||
}}
|
||||
onAddToDashboard={(chartId, dashboardId) => {
|
||||
setCurrentChartId(chartId);
|
||||
onAddToDashboard={(savedChartId, _dashboardId) => {
|
||||
setCurrentChartId(savedChartId);
|
||||
setIsAddToDashboardDialogOpen(false);
|
||||
onOpenChange(false);
|
||||
onSuccess?.();
|
||||
|
||||
@@ -32,11 +32,11 @@ export function DashboardWidget({ widget, environmentId }: DashboardWidgetProps)
|
||||
setError(null);
|
||||
executeQueryAction({
|
||||
environmentId,
|
||||
query: widget.chart.query,
|
||||
query: widget.chart.query as any,
|
||||
})
|
||||
.then((result) => {
|
||||
if (result?.serverError || result?.error) {
|
||||
setError(result.serverError || result.error || "Failed to load chart data");
|
||||
if (result?.serverError || result?.data?.error) {
|
||||
setError(result.serverError || result.data?.error || "Failed to load chart data");
|
||||
setChartData(null);
|
||||
} else if (result?.data?.data) {
|
||||
const data = Array.isArray(result.data.data) ? result.data.data : [];
|
||||
|
||||
@@ -16,7 +16,7 @@ export function DashboardsListClient({
|
||||
dashboards: initialDashboards,
|
||||
environmentId,
|
||||
}: DashboardsListClientProps) {
|
||||
const [searchQuery, setSearchQuery] = useState("");
|
||||
const [searchQuery, _setSearchQuery] = useState("");
|
||||
const [dashboards, setDashboards] = useState(initialDashboards);
|
||||
|
||||
const filteredDashboards = dashboards.filter((dashboard) =>
|
||||
|
||||
@@ -22,6 +22,9 @@ export type AuditLoggingCtx = {
|
||||
quotaId?: string;
|
||||
teamId?: string;
|
||||
integrationId?: string;
|
||||
chartId?: string;
|
||||
dashboardId?: string;
|
||||
dashboardWidgetId?: string;
|
||||
};
|
||||
|
||||
export type ActionClientCtx = {
|
||||
|
||||
@@ -292,6 +292,15 @@ export const withAuditLogging = <TParsedInput = Record<string, unknown>, TResult
|
||||
case "quota":
|
||||
targetId = auditLoggingCtx.quotaId;
|
||||
break;
|
||||
case "chart":
|
||||
targetId = auditLoggingCtx.chartId;
|
||||
break;
|
||||
case "dashboard":
|
||||
targetId = auditLoggingCtx.dashboardId;
|
||||
break;
|
||||
case "dashboardWidget":
|
||||
targetId = auditLoggingCtx.dashboardWidgetId;
|
||||
break;
|
||||
default:
|
||||
targetId = UNKNOWN_DATA;
|
||||
break;
|
||||
|
||||
@@ -25,6 +25,9 @@ export const ZAuditTarget = z.enum([
|
||||
"integration",
|
||||
"file",
|
||||
"quota",
|
||||
"chart",
|
||||
"dashboard",
|
||||
"dashboardWidget",
|
||||
]);
|
||||
export const ZAuditAction = z.enum([
|
||||
"created",
|
||||
|
||||
@@ -65,6 +65,12 @@ const ChartTooltipContent = React.forwardRef<
|
||||
HTMLDivElement,
|
||||
React.ComponentProps<typeof Tooltip> &
|
||||
React.ComponentProps<"div"> & {
|
||||
active?: boolean;
|
||||
payload?: any[];
|
||||
label?: string;
|
||||
labelFormatter?: (value: any, payload: any[]) => React.ReactNode;
|
||||
labelClassName?: string;
|
||||
formatter?: (value: any, name: string, item: any, index: number, payload: any[]) => React.ReactNode;
|
||||
hideLabel?: boolean;
|
||||
hideIndicator?: boolean;
|
||||
indicator?: "line" | "dot" | "dashed";
|
||||
@@ -198,8 +204,9 @@ const ChartLegend = RechartsPrimitive.Legend;
|
||||
|
||||
const ChartLegendContent = React.forwardRef<
|
||||
HTMLDivElement,
|
||||
React.ComponentProps<"div"> &
|
||||
Pick<RechartsPrimitive.LegendProps, "payload" | "verticalAlign"> & {
|
||||
React.ComponentProps<"div"> & {
|
||||
payload?: any[];
|
||||
verticalAlign?: "top" | "bottom" | "middle";
|
||||
hideIcon?: boolean;
|
||||
nameKey?: string;
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ export function MultiSelect<T extends string, K extends TOption<T>["value"][]>(
|
||||
ref={inputRef}
|
||||
value={inputValue}
|
||||
onValueChange={setInputValue}
|
||||
onBlur={(e) => {
|
||||
onBlur={(_e) => {
|
||||
// Don't close if we're selecting an option
|
||||
if (!isSelectingRef.current) {
|
||||
setOpen(false);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { createId } from "@paralleldrive/cuid2";
|
||||
import fs from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import readline from "node:readline";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { createId } from "@paralleldrive/cuid2";
|
||||
import { logger } from "@formbricks/logger";
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { type Prisma, PrismaClient } from "@prisma/client";
|
||||
import { exec } from "node:child_process";
|
||||
import fs from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { promisify } from "node:util";
|
||||
import { type Prisma, PrismaClient } from "@prisma/client";
|
||||
import { logger } from "@formbricks/logger";
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
|
||||
@@ -13,11 +13,11 @@
|
||||
* 1: Validation errors found (missing or unused keys)
|
||||
* 2: Invalid or missing API key
|
||||
*/
|
||||
import { glob } from "glob";
|
||||
import * as fs from "node:fs";
|
||||
import * as path from "node:path";
|
||||
import { dirname } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { glob } from "glob";
|
||||
|
||||
// Get __dirname equivalent in ES modules
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
|
||||
@@ -155,6 +155,7 @@
|
||||
"BASE_PATH",
|
||||
"BREVO_API_KEY",
|
||||
"BREVO_LIST_ID",
|
||||
"CUBEJS_API_URL",
|
||||
"CRON_SECRET",
|
||||
"DATABASE_URL",
|
||||
"DEBUG",
|
||||
@@ -206,6 +207,7 @@
|
||||
"NEXTAUTH_URL",
|
||||
"NODE_ENV",
|
||||
"npm_package_version",
|
||||
"OPENAI_API_KEY",
|
||||
"OIDC_CLIENT_ID",
|
||||
"OIDC_CLIENT_SECRET",
|
||||
"OIDC_DISPLAY_NAME",
|
||||
|
||||
Reference in New Issue
Block a user