Skip to content

Commit 197de36

Browse files
authored
Chad/0.0.4 (#8)
* fix main branch syncing problem * reduce size of desktop studio sidebar * add metrics page and metrics page sql fns * added filters and infinite loading to logs page * put this back * logs page cleanup * consolidate vercel_env checks into is-env util * small adjustments
1 parent baa9e22 commit 197de36

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+4418
-329
lines changed

package-lock.json

Lines changed: 431 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
"fumadocs-mdx": "^11.6.10",
5757
"fumadocs-ui": "^15.6.1",
5858
"js-tiktoken": "^1.0.20",
59+
"lodash.isequal": "^4.5.0",
5960
"lodash.merge": "^4.6.2",
6061
"lucide-react": "^0.468.0",
6162
"next": "^15.1.6",
@@ -67,11 +68,13 @@
6768
"prettier": "^3.3.3",
6869
"prismjs": "^1.29.0",
6970
"react": "19.0.0",
71+
"react-day-picker": "^9.8.0",
7072
"react-diff-viewer-continued-react19": "^1.0.0",
7173
"react-dom": "19.0.0",
7274
"react-hook-form": "^7.54.2",
7375
"react-markdown": "^10.1.0",
7476
"react-simple-code-editor": "^0.14.1",
77+
"recharts": "^3.0.2",
7578
"sonner": "^2.0.1",
7679
"ts-morph": "^25.0.1",
7780
"tsd": "^0.32.0",
@@ -81,6 +84,7 @@
8184
"devDependencies": {
8285
"@tailwindcss/postcss": "^4.0.9",
8386
"@types/jest": "^29.5.14",
87+
"@types/lodash.isequal": "^4.5.8",
8488
"@types/lodash.merge": "^4.6.9",
8589
"@types/node": "22.10.2",
8690
"@types/prismjs": "^1.26.5",

src/app/__generated__/supabase.types.ts

Lines changed: 65 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app/actions/auth.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
// 'use server';
1+
'use server';
22

3-
// import { encodedRedirect } from '@/utils/utils';
4-
// import { createClient } from '@/lib/supabase/server';
5-
// import { headers } from 'next/headers';
6-
// import { redirect } from 'next/navigation';
7-
// import { routes } from '@/utils/routes';
3+
import { encodedRedirect } from '@/utils/utils';
4+
import { createClient } from '@/lib/supabase/server';
5+
import { headers } from 'next/headers';
6+
import { redirect } from 'next/navigation';
7+
import { routes } from '@/utils/routes';
88

99
// export const signUpAction = async (formData: FormData) => {
1010
// const email = formData.get('email')?.toString();
@@ -36,22 +36,22 @@
3636
// }
3737
// };
3838

39-
// export const signInAction = async (formData: FormData) => {
40-
// const email = formData.get('email') as string;
41-
// const password = formData.get('password') as string;
42-
// const supabase = await createClient();
39+
export const signInAction = async (formData: FormData) => {
40+
const email = formData.get('email') as string;
41+
const password = formData.get('password') as string;
42+
const supabase = await createClient();
4343

44-
// const { error } = await supabase.auth.signInWithPassword({
45-
// email,
46-
// password,
47-
// });
44+
const { error } = await supabase.auth.signInWithPassword({
45+
email,
46+
password,
47+
});
4848

49-
// if (error) {
50-
// return encodedRedirect('error', routes.auth.signIn, error.message);
51-
// }
49+
if (error) {
50+
return encodedRedirect('error', routes.auth.signIn, error.message);
51+
}
5252

53-
// return redirect(routes.studio.home);
54-
// };
53+
return redirect(routes.studio.home);
54+
};
5555

5656
// export const forgotPasswordAction = async (formData: FormData) => {
5757
// const email = formData.get('email')?.toString();

src/app/layout.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ import { ThemeProvider } from 'next-themes';
44
import { GoogleAnalytics } from '@next/third-parties/google';
55
import { Toaster } from '@/components/ui/sonner';
66
import { PostHogProvider } from '@/providers/posthog';
7+
import { isDev, isProd } from '@/utils/is-env';
78

89
const defaultUrl =
9-
process.env.VERCEL_ENV === 'production' && process.env.NEXT_PUBLIC_SITE_URL
10+
isProd && process.env.NEXT_PUBLIC_SITE_URL
1011
? process.env.NEXT_PUBLIC_SITE_URL
1112
: process.env.VERCEL_URL
1213
? `https://${process.env.VERCEL_URL}`
@@ -33,11 +34,11 @@ export default function RootLayout(props: RootLayoutProps) {
3334

3435
return (
3536
<html lang="en" className={ibmPlexMono.className} suppressHydrationWarning>
36-
{/* {!process.env.VERCEL_ENV && (
37+
{isDev && (
3738
<head>
3839
<script src="https://unpkg.com/react-scan/dist/auto.global.js" />
3940
</head>
40-
)} */}
41+
)}
4142
<PostHogProvider>
4243
<GoogleAnalytics gaId="G-PZG86YG9ZZ" />
4344
<body className="bg-background text-foreground">

src/app/robots.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import type { MetadataRoute } from 'next';
2+
import { isProd } from '@/utils/is-env';
23

34
export default function robots(): MetadataRoute.Robots {
4-
if (process.env.VERCEL_ENV === 'production') {
5+
if (isProd) {
56
return {
67
rules: {
78
userAgent: '*',

src/app/studio/(project)/project/[projectUuid]/logs/(logs-page)/loading.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { LogsPageSkeleton } from '@/page-components/LogsPage';
1+
import { LogsPageSkeleton } from '@/page-components/LogsPage/LogsPage';
22

33
export default function Loading() {
44
return <LogsPageSkeleton />;
Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { AgentsmithServices } from '@/lib/AgentsmithServices';
22
import { createClient } from '@/lib/supabase/server';
3-
import { LogsPage } from '@/page-components/LogsPage';
3+
import { LogsPage } from '@/page-components/LogsPage/LogsPage';
4+
import { routes } from '@/utils/routes';
5+
import { redirect } from 'next/navigation';
46

57
type LogsProps = {
68
params: Promise<{ projectUuid: string }>;
@@ -13,11 +15,23 @@ export default async function Logs(props: LogsProps) {
1315

1416
const agentsmith = new AgentsmithServices({ supabase });
1517

16-
// Get the first project
18+
// Get the project data
1719
const project = await agentsmith.services.projects.getProjectDataByUuid(projectUuid);
1820

19-
// If no project exists, pass empty logs array
20-
const logs = project ? await agentsmith.services.llmLogs.getLogsByProjectId(project.id) : [];
21+
if (!project) {
22+
redirect(routes.error('Project not found, cannot load logs.'));
23+
}
2124

22-
return <LogsPage project={project} logs={logs} />;
25+
// Get available filters for the last 30 days
26+
const endDate = new Date();
27+
const startDate = new Date();
28+
startDate.setDate(endDate.getDate() - 30);
29+
30+
const availableFilters = await agentsmith.services.metrics.getAvailableFilters(
31+
project.id,
32+
startDate,
33+
endDate,
34+
);
35+
36+
return <LogsPage project={project} availableFilters={availableFilters} />;
2337
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { MetricsPageSkeleton } from '@/page-components/MetricsPage/MetricsPage';
2+
3+
export default function Loading() {
4+
return <MetricsPageSkeleton />;
5+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { AgentsmithServices } from '@/lib/AgentsmithServices';
2+
import { createClient } from '@/lib/supabase/server';
3+
import { MetricsPage } from '@/page-components/MetricsPage/MetricsPage';
4+
import { routes } from '@/utils/routes';
5+
import { redirect } from 'next/navigation';
6+
7+
type MetricsProps = {
8+
params: Promise<{ projectUuid: string }>;
9+
};
10+
11+
export default async function Metrics(props: MetricsProps) {
12+
const { projectUuid } = await props.params;
13+
14+
const supabase = await createClient();
15+
16+
const agentsmith = new AgentsmithServices({ supabase });
17+
18+
// Get the project data
19+
const project = await agentsmith.services.projects.getProjectDataByUuid(projectUuid);
20+
21+
if (!project) {
22+
redirect(routes.error('Project not found, cannot load metrics.'));
23+
}
24+
25+
return <MetricsPage project={project} />;
26+
}

0 commit comments

Comments
 (0)