Skip to content

Commit 3ec6b05

Browse files
committed
cleanup
1 parent 11d7ffa commit 3ec6b05

File tree

13 files changed

+38
-29
lines changed

13 files changed

+38
-29
lines changed

apps/api/src/query/builders/custom-events.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ export const CustomEventsBuilders: Record<string, SimpleQueryConfig> = {
261261
filterConditions?: string[],
262262
filterParams?: Record<string, Filter["value"]>
263263
) => {
264+
const limit = _limit ?? 1000;
264265
const combinedWhereClause = filterConditions?.length
265266
? `AND ${filterConditions.join(" AND ")}`
266267
: "";
@@ -281,11 +282,13 @@ export const CustomEventsBuilders: Record<string, SimpleQueryConfig> = {
281282
${combinedWhereClause}
282283
GROUP BY toDate(timestamp)
283284
ORDER BY date ASC
285+
LIMIT {limit:UInt32}
284286
`,
285287
params: {
286288
websiteId,
287289
startDate,
288290
endDate,
291+
limit,
289292
...filterParams,
290293
},
291294
};

apps/api/src/query/builders/performance.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -214,16 +214,16 @@ export const PerformanceBuilders: Record<string, SimpleQueryConfig> = {
214214
avgIf(wv.metric_value, wv.metric_name = 'TTFB' AND wv.metric_value > 0) as avg_ttfb,
215215
COUNT(*) as measurements
216216
FROM ${Analytics.web_vitals_spans} wv
217-
LEFT JOIN ${Analytics.events} e ON (
217+
INNER JOIN ${Analytics.events} e ON (
218218
wv.session_id = e.session_id
219219
AND wv.client_id = e.client_id
220220
AND abs(dateDiff('second', wv.timestamp, e.time)) < 60
221+
AND e.browser_name != ''
221222
)
222223
WHERE
223224
wv.client_id = {websiteId:String}
224225
AND wv.timestamp >= toDateTime({startDate:String})
225226
AND wv.timestamp <= toDateTime(concat({endDate:String}, ' 23:59:59'))
226-
AND e.browser_name != ''
227227
GROUP BY e.browser_name
228228
ORDER BY p50_lcp DESC
229229
LIMIT {limit:UInt32}
@@ -341,7 +341,7 @@ export const PerformanceBuilders: Record<string, SimpleQueryConfig> = {
341341
return {
342342
sql: `
343343
SELECT
344-
CONCAT(any(e.region), ', ', any(e.country)) as name,
344+
CONCAT(e.region, ', ', e.country) as name,
345345
COUNT(DISTINCT wv.anonymous_id) as visitors,
346346
avgIf(wv.metric_value, wv.metric_name = 'FCP' AND wv.metric_value > 0) as avg_fcp,
347347
quantileIf(0.50)(wv.metric_value, wv.metric_name = 'FCP' AND wv.metric_value > 0) as p50_fcp,
@@ -353,16 +353,16 @@ export const PerformanceBuilders: Record<string, SimpleQueryConfig> = {
353353
avgIf(wv.metric_value, wv.metric_name = 'TTFB' AND wv.metric_value > 0) as avg_ttfb,
354354
COUNT(*) as measurements
355355
FROM ${Analytics.web_vitals_spans} wv
356-
LEFT JOIN ${Analytics.events} e ON (
356+
INNER JOIN ${Analytics.events} e ON (
357357
wv.session_id = e.session_id
358358
AND wv.client_id = e.client_id
359359
AND abs(dateDiff('second', wv.timestamp, e.time)) < 60
360+
AND e.region != ''
360361
)
361362
WHERE
362363
wv.client_id = {websiteId:String}
363364
AND wv.timestamp >= toDateTime({startDate:String})
364365
AND wv.timestamp <= toDateTime(concat({endDate:String}, ' 23:59:59'))
365-
AND e.region != ''
366366
GROUP BY e.region, e.country
367367
ORDER BY p50_lcp DESC
368368
LIMIT {limit:UInt32}

apps/api/src/query/simple-builder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ const DANGEROUS_SQL_KEYWORDS = [
5959
const SQL_EXPRESSIONS = {
6060
normalizedPath: Expressions.path.normalized as string,
6161
normalizedReferrer: Expressions.referrer.normalized as string,
62-
queryString: "queryString(path)" as string,
62+
queryString: "queryString(url)" as string,
6363
} as const;
6464

6565
const REFERRER_MAPPINGS: Record<string, string> = {

apps/api/src/query/types.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ import type {
1010
// Filter Operators
1111
// ============================================================================
1212

13+
// Note: Both `contains` and `starts_with` use the LIKE operator.
14+
// The distinction is handled by value formatting: `contains` wraps values with %...%,
15+
// while `starts_with` appends % to the value (e.g., "value%").
1316
export const FilterOperators = {
1417
eq: "=",
1518
ne: "!=",

apps/api/src/types/tables.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import type {
33
BlockedTraffic,
44
CustomEventSpan,
55
CustomEventsHourlyAggregate,
6+
CustomOutgoingLink,
67
ErrorHourlyAggregate,
78
ErrorSpanRow,
89
WebVitalsHourlyAggregate,
@@ -32,4 +33,5 @@ export type TableFieldsMap = {
3233
"analytics.custom_event_spans": keyof CustomEventSpan;
3334
"analytics.custom_events_hourly": keyof CustomEventsHourlyAggregate;
3435
"analytics.blocked_traffic": keyof BlockedTraffic;
36+
"analytics.outgoing_links": keyof CustomOutgoingLink;
3537
};

apps/dashboard/app/(auth)/layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export default async function AuthLayout({
3232
</div>
3333
<Link className="relative z-10" href="https://www.databuddy.cc">
3434
<Button
35-
className="px-0! text-white/50 hover:bg-transparent hover:text-white/80"
35+
className="group px-0! text-white/50 hover:bg-transparent hover:text-white/80"
3636
variant="ghost"
3737
>
3838
<CaretLeftIcon className="size-4 transition-transform duration-200 group-hover:translate-x-[-4px]" />

apps/dashboard/app/(auth)/login/page.tsx

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -154,20 +154,19 @@ function LoginPage() {
154154
</Badge>
155155
)}
156156
</Button>
157-
<Link
158-
className="relative lg:col-span-2"
159-
href="/login/magic"
160-
passHref
161-
>
157+
<div className="relative lg:col-span-2">
162158
<Button
159+
asChild
163160
className="w-full"
164161
disabled={isLoading}
165162
size="lg"
166163
type="button"
167164
variant="secondary"
168165
>
169-
<SparkleIcon className="size-4" />
170-
Sign in with Magic Link
166+
<Link href="/login/magic">
167+
<SparkleIcon className="size-4" />
168+
Sign in with Magic Link
169+
</Link>
171170
</Button>
172171
{lastUsed === "magic" && (
173172
<Badge
@@ -177,7 +176,7 @@ function LoginPage() {
177176
Last used
178177
</Badge>
179178
)}
180-
</Link>
179+
</div>
181180
</div>
182181
<div className="relative flex w-full items-center justify-center gap-3">
183182
<Separator className="flex-1 opacity-70" />
@@ -263,7 +262,7 @@ function LoginPage() {
263262
</div>
264263
</div>
265264
<div className="mt-5 flex flex-col flex-wrap items-center justify-center gap-4 px-5 text-center lg:flex-row">
266-
<p className="flex-1 text-nowrap text-[13px] text-muted-foreground">
265+
<p className="flex-1 text-[13px] text-muted-foreground lg:text-nowrap">
267266
Don&apos;t have an account?{" "}
268267
<Link
269268
className="font-medium text-accent-foreground transition-colors duration-200 hover:text-accent-foreground/80"

apps/dashboard/app/(main)/billing/components/usage-row.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export const UsageRow = memo(function UsageRowComponent({
7979
<span className="font-medium">{feature.name}</span>
8080
{feature.hasExtraCredits && (
8181
<Badge variant="secondary">
82-
<GiftIcon size={10} weight="fill" />
82+
<GiftIcon className="mr-1" size={10} weight="fill" />
8383
Bonus
8484
</Badge>
8585
)}

apps/dashboard/app/(main)/billing/cost-breakdown/components/usage-breakdown-table.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ export function UsageBreakdownTable({
130130

131131
return (
132132
<div
133-
className="group flex items-center gap-4 border-border border-b px-4 py-3 transition-colors hover:bg-accent/50 sm:px-6 sm:py-4"
133+
className="group flex items-center gap-4 px-4 py-3 transition-colors hover:bg-accent/50 sm:px-6 sm:py-4"
134134
key={item.event_category}
135135
>
136136
<div className="flex size-10 shrink-0 items-center justify-center rounded border border-accent-foreground/10 bg-secondary">

apps/dashboard/app/(main)/organizations/settings/danger/transfer-assets.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ export function TransferAssets({ organizationId }: TransferAssetsProps) {
224224
({organizationWebsites.length})
225225
</span>
226226
</div>
227-
<div className="flex-1 space-y-1 overflow-y-auto">
227+
<div className="flex-1 space-y-2 overflow-y-auto">
228228
{organizationWebsites.length > 0 ? (
229229
organizationWebsites.map((website) => (
230230
<WebsiteItem

0 commit comments

Comments
 (0)