📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!
TypeScript chartsclickhousedockergdprgoogle-analyticsmetricsmonitoringmysqlnestjsprivacyredisself-hostedselfhostedstatisticstailwindcssweb-analyticswebanalyticswebsite
Apply AI review fixes
Blue Mousefd48543a7769
diff --git a/backend/apps/cloud/src/goal/goal.controller.ts b/backend/apps/cloud/src/goal/goal.controller.tsindex fc760c84f..b6683d209 100644--- a/backend/apps/cloud/src/goal/goal.controller.ts+++ b/backend/apps/cloud/src/goal/goal.controller.ts@@ -175,6 +175,7 @@ export class GoalController {async getProjectGoals(@CurrentUserId() userId: string,@Param('projectId') projectId: string,+ @Headers() headers: { 'x-password'?: string },@Query('take', new ParseIntPipe({ optional: true })) take?: number,@Query('skip', new ParseIntPipe({ optional: true })) skip?: number,@Query('search') search?: string,@@ -190,7 +191,7 @@ export class GoalController {throw new NotFoundException('Project not found')}- this.projectService.allowedToView(project, userId)+ this.projectService.allowedToView(project, userId, headers['x-password'])const { take: safeTake, skip: safeSkip } = clampPagination(take, skip)diff --git a/backend/apps/community/src/goal/goal.controller.ts b/backend/apps/community/src/goal/goal.controller.tsindex cab1b10e5..6bb526c67 100644--- a/backend/apps/community/src/goal/goal.controller.ts+++ b/backend/apps/community/src/goal/goal.controller.ts@@ -150,10 +150,11 @@ export class GoalController {}@Get('/project/:projectId')- @Auth()+ @Auth(false, true)async getProjectGoals(@CurrentUserId() userId: string,@Param('projectId') projectId: string,+ @Headers() headers: { 'x-password'?: string },@Query('take', new ParseIntPipe({ optional: true })) take?: number,@Query('skip', new ParseIntPipe({ optional: true })) skip?: number,@Query('search') search?: string,@@ -169,7 +170,7 @@ export class GoalController {throw new NotFoundException('Project not found')}- this.projectService.allowedToView(project, userId)+ this.projectService.allowedToView(project, userId, headers['x-password'])const { take: safeTake, skip: safeSkip } = clampPagination(take, skip)diff --git a/web/app/api/api.server.ts b/web/app/api/api.server.tsindex affe5dc5c..1010e8216 100644--- a/web/app/api/api.server.ts+++ b/web/app/api/api.server.ts@@ -1277,6 +1277,7 @@ export async function getProjectGoalsServer(take = 20,skip = 0,search?: string,+ password?: string,): Promise<ServerFetchResult<GoalsResponse>> {const params = new URLSearchParams({take: String(take),@@ -1290,6 +1291,7 @@ export async function getProjectGoalsServer(return serverFetch<GoalsResponse>(request,`goal/project/${projectId}?${params.toString()}`,+ { headers: password ? { 'x-password': password } : undefined },)}diff --git a/web/app/pages/Project/tabs/Experiments/ExperimentsView.tsx b/web/app/pages/Project/tabs/Experiments/ExperimentsView.tsxindex c22cab1d3..4f22767e1 100644--- a/web/app/pages/Project/tabs/Experiments/ExperimentsView.tsx+++ b/web/app/pages/Project/tabs/Experiments/ExperimentsView.tsx@@ -1060,7 +1060,7 @@ const ExperimentsView = ({useEffect(() => {loadExperiments(DEFAULT_EXPERIMENTS_TAKE, 0, true, filterQuery || undefined)// eslint-disable-next-line react-hooks/exhaustive-deps- }, [])+ }, [projectPassword])useEffect(() => {if (experimentsRefreshTrigger > 0) {diff --git a/web/app/pages/Subscribe/SubscribeFeatures.tsx b/web/app/pages/Subscribe/SubscribeFeatures.tsxindex 14d712560..c47663f2e 100644--- a/web/app/pages/Subscribe/SubscribeFeatures.tsx+++ b/web/app/pages/Subscribe/SubscribeFeatures.tsx@@ -1,6 +1,7 @@-import { useState } from 'react'+import { useEffect, useState } from 'react'import { useTranslation } from 'react-i18next'+import { useInViewOnce } from '~/hooks/useInViewOnce'import { useTheme } from '~/providers/ThemeProvider'import { Text } from '~/ui/Text'@@ -53,9 +54,24 @@ const FeatureVideo = ({label: string}) => {const [failed, setFailed] = useState(false)+ const [prefersReducedMotion, setPrefersReducedMotion] = useState(true)+ const { ref, hasBeenInView } = useInViewOnce()++ useEffect(() => {+ const mediaQuery = window.matchMedia('(prefers-reduced-motion: reduce)')+ const updateReducedMotion = () =>+ setPrefersReducedMotion(mediaQuery.matches)+ updateReducedMotion()+ mediaQuery.addEventListener('change', updateReducedMotion)++ return () => mediaQuery.removeEventListener('change', updateReducedMotion)+ }, [])return (- <div className='relative aspect-video overflow-hidden bg-gray-100 dark:bg-slate-950'>+ <div+ ref={ref}+ className='relative aspect-video overflow-hidden bg-gray-100 dark:bg-slate-950'+ ><imgsrc={poster}alt={failed ? label : ''}@@ -64,7 +80,7 @@ const FeatureVideo = ({loading='lazy'className='absolute inset-0 h-full w-full object-cover object-top'/>- {!failed ? (+ {!failed && hasBeenInView && !prefersReducedMotion ? (<videoautoPlayloopdiff --git a/web/app/routes/projects.$id.tsx b/web/app/routes/projects.$id.tsxindex ba639dec9..c4355af0f 100644--- a/web/app/routes/projects.$id.tsx+++ b/web/app/routes/projects.$id.tsx@@ -535,9 +535,14 @@ export async function loader({ request, params }: LoaderFunctionArgs) {(res) => res.data,)} else if (tab === PROJECT_TABS.goals) {- goalsData = getProjectGoalsServer(request, projectId).then(- (res) => res.data,- )+ goalsData = getProjectGoalsServer(+ request,+ projectId,+ undefined,+ undefined,+ undefined,+ password || undefined,+ ).then((res) => res.data)}const importRange = computeDateRangeForPeriod(period, from, to)@@ -2056,6 +2061,7 @@ export async function action({ request, params }: ActionFunctionArgs) {// Goals (getters)case 'get-project-goals': {+ const password = getPassword()const take = Number(formData.get('take') || '20')const skip = Number(formData.get('skip') || '0')const search = formData.get('search')?.toString() || ''@@ -2071,6 +2077,7 @@ export async function action({ request, params }: ActionFunctionArgs) {`goal/project/${projectId}?${params.toString()}`,{method: 'GET',+ headers: password ? { 'x-password': password } : undefined,},)@@ -2089,9 +2096,11 @@ export async function action({ request, params }: ActionFunctionArgs) {case 'get-goal': {const goalId = formData.get('goalId')?.toString()+ const password = getPassword()const result = await serverFetch(request, `goal/${goalId}`, {method: 'GET',+ headers: password ? { 'x-password': password } : undefined,})if (result.error) {