Skip to content
Open

syn #30

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/webpack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: NodeJS with Webpack

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x, 20.x, 22.x]

steps:
- uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Build
run: |
npm install
npx webpack
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

High

This workflow will fail because the project is a Next.js application, not a webpack project. There's no webpack.config.js in the repository. The build command should be 'npm run build' which executes 'npx next build' as defined in package.json, not 'npx webpack'.

Fix in Cursor • Fix in Claude

Prompt for Agent
Task: Address review feedback left on GitHub.
Repository: freestyle-sh/Adorable#30
File: .github/workflows/webpack.yml#L28
Action: Open this file location in your editor, inspect the highlighted code, and resolve the issue described below.

Feedback:
This workflow will fail because the project is a Next.js application, not a webpack project. There's no webpack.config.js in the repository. The build command should be 'npm run build' which executes 'npx next build' as defined in package.json, not 'npx webpack'.

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,5 @@ next-env.d.ts
# git repositories
/git/

dump.rdb
dump.rdb
.env
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev --turbopack",
"build": "next build",
"start": "next start",
"dev": "npx next dev --turbopack",
"build": "npx next build",
"start": "npx next start",
"lint": "next lint"
},
"dependencies": {
Expand Down
12 changes: 12 additions & 0 deletions src/app/api/user-apps/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { NextResponse } from "next/server";
import { getUserApps } from "@/actions/user-apps";

export async function GET() {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

High

This API route has no authentication check. Any unauthenticated user can access all user apps. Consider adding authentication verification using getUser() from '@/auth/stack-auth' similar to how it's used in other parts of the codebase.

Fix in Cursor • Fix in Claude

Prompt for Agent
Task: Address review feedback left on GitHub.
Repository: freestyle-sh/Adorable#30
File: src/app/api/user-apps/route.ts#L4
Action: Open this file location in your editor, inspect the highlighted code, and resolve the issue described below.

Feedback:
This API route has no authentication check. Any unauthenticated user can access all user apps. Consider adding authentication verification using getUser() from '@/auth/stack-auth' similar to how it's used in other parts of the codebase.

try {
const userApps = await getUserApps();
return NextResponse.json(userApps);
} catch (error) {
console.error("Error fetching user apps:", error);
return NextResponse.json({ error: "Failed to fetch user apps" }, { status: 500 });
}
}
2 changes: 2 additions & 0 deletions src/app/app/new/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { createApp } from "@/actions/create-app";
import { redirect } from "next/navigation";
import { getUser } from "@/auth/stack-auth";

export const dynamic = 'force-dynamic';

// This page is never rendered. It is used to:
// - Force user login without losing the user's initial message and template selection.
// - Force a loading page to be rendered (loading.tsx) while the app is being created.
Expand Down
6 changes: 5 additions & 1 deletion src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@ import { useState } from "react";
import { Button } from "@/components/ui/button";
import { ExampleButton } from "@/components/ExampleButton";
import { UserButton } from "@stackframe/stack";
import { UserApps } from "@/components/user-apps";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { PromptInputTextareaWithTypingAnimation } from "@/components/prompt-input";
import dynamic from "next/dynamic";

const UserApps = dynamic(() => import("@/components/user-apps").then(mod => ({ default: mod.UserApps })), {
ssr: false
});

const queryClient = new QueryClient();

Expand Down
14 changes: 12 additions & 2 deletions src/components/user-apps.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
import { useQuery, useQueryClient } from "@tanstack/react-query";
import { getUserApps } from "@/actions/user-apps";
import { AppCard } from "./app-card";

export function UserApps() {
const queryClient = useQueryClient();
const { data } = useQuery({
queryKey: ["userApps"],
queryFn: getUserApps,
queryFn: async () => {
const response = await fetch("/api/user-apps");
if (!response.ok) {
throw new Error("Failed to fetch user apps");
}
const apps = await response.json();
// Convert createdAt string to Date object
return apps.map((app: any) => ({
...app,
createdAt: new Date(app.createdAt),
}));
},
initialData: [],
});

Expand Down