feat: share dashboard & reports, sankey report, new widgets

* fix: prompt card shadows on light mode

* fix: handle past_due and unpaid from polar

* wip

* wip

* wip 1

* fix: improve types for chart/reports

* wip share
This commit is contained in:
Carl-Gerhard Lindesvärd
2026-01-14 09:21:18 +01:00
committed by GitHub
parent 39251c8598
commit ed1c57dbb8
105 changed files with 6633 additions and 1273 deletions

View File

@@ -1,7 +1,7 @@
import { z } from 'zod';
import { db, getReportById, getReportsByDashboardId } from '@openpanel/db';
import { zReportInput } from '@openpanel/validation';
import { zReport } from '@openpanel/validation';
import { getProjectAccess } from '../access';
import { TRPCAccessError } from '../errors';
@@ -21,7 +21,7 @@ export const reportRouter = createTRPCRouter({
create: protectedProcedure
.input(
z.object({
report: zReportInput.omit({ projectId: true }),
report: zReport.omit({ projectId: true }),
dashboardId: z.string(),
}),
)
@@ -55,10 +55,8 @@ export const reportRouter = createTRPCRouter({
formula: report.formula,
previous: report.previous ?? false,
unit: report.unit,
criteria: report.criteria,
metric: report.metric === 'count' ? 'sum' : report.metric,
funnelGroup: report.funnelGroup,
funnelWindow: report.funnelWindow,
options: report.options,
},
});
}),
@@ -66,7 +64,7 @@ export const reportRouter = createTRPCRouter({
.input(
z.object({
reportId: z.string(),
report: zReportInput.omit({ projectId: true }),
report: zReport.omit({ projectId: true }),
}),
)
.mutation(async ({ input: { report, reportId }, ctx }) => {
@@ -100,10 +98,8 @@ export const reportRouter = createTRPCRouter({
formula: report.formula,
previous: report.previous ?? false,
unit: report.unit,
criteria: report.criteria,
metric: report.metric === 'count' ? 'sum' : report.metric,
funnelGroup: report.funnelGroup,
funnelWindow: report.funnelWindow,
options: report.options,
},
});
}),
@@ -171,10 +167,8 @@ export const reportRouter = createTRPCRouter({
formula: report.formula,
previous: report.previous,
unit: report.unit,
criteria: report.criteria,
metric: report.metric,
funnelGroup: report.funnelGroup,
funnelWindow: report.funnelWindow,
options: report.options,
},
});
}),