Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 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
8 changes: 5 additions & 3 deletions frontend/src/app/api/screenshot/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ export async function GET(req: Request) {

// Set viewport to a reasonable size
await page.setViewport({
width: 1280,
Copy link
Collaborator

Choose a reason for hiding this comment

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

is this necessary for correctly taking screenshot?

height: 720,
width: 1920,
height: 1080,
});

// Navigate to URL with increased timeout and more reliable wait condition
Expand All @@ -49,10 +49,12 @@ export async function GET(req: Request) {
timeout: 60000, // Increased timeout to 60 seconds
});

await new Promise((resolve) => setTimeout(resolve, 1000)); // Waits for 1 seconds

// Take screenshot
const screenshot = await page.screenshot({
type: 'png',
fullPage: false,
fullPage: true,
Copy link
Collaborator

Choose a reason for hiding this comment

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

we should not take full page screen shot, it will be tooo long for some SPA

});

// Always close the page when done
Expand Down
16 changes: 7 additions & 9 deletions frontend/src/components/chat/code-engine/project-context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -544,16 +544,14 @@ export function ProjectProvider({ children }: { children: ReactNode }) {
const blob = new Blob([arrayBuffer], { type: 'image/png' });
const file = new File([blob], 'screenshot.png', { type: 'image/png' });

if (isMounted.current) {
await updateProjectPhotoMutation({
variables: {
input: {
projectId,
file,
},
await updateProjectPhotoMutation({
variables: {
input: {
projectId,
file,
},
});
}
},
});
} catch (error) {
logger.error('Error taking screenshot:', error);
} finally {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/root/expand-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export function ExpandableCard({ projects }) {
alt={project.name}
width={600}
height={200}
className="w-full h-48 object-cover transition duration-300 group-hover:scale-105"
className="w-full h-48 object-cover object-top transition duration-300 group-hover:scale-105"
/>
</motion.div>

Expand Down
26 changes: 15 additions & 11 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading