diff --git a/frontend/src/app/api/screenshot/route.ts b/frontend/src/app/api/screenshot/route.ts index af243891..ee5569fd 100644 --- a/frontend/src/app/api/screenshot/route.ts +++ b/frontend/src/app/api/screenshot/route.ts @@ -39,8 +39,8 @@ export async function GET(req: Request) { // Set viewport to a reasonable size await page.setViewport({ - width: 1280, - height: 720, + width: 1600, + height: 900, }); // Navigate to URL with increased timeout and more reliable wait condition @@ -49,10 +49,12 @@ export async function GET(req: Request) { timeout: 60000, // Increased timeout to 60 seconds }); + await new Promise((resolve) => setTimeout(resolve, 2000)); // Waits for 2 seconds + // Take screenshot const screenshot = await page.screenshot({ type: 'png', - fullPage: false, + fullPage: true, }); // Always close the page when done diff --git a/frontend/src/components/chat/code-engine/project-context.tsx b/frontend/src/components/chat/code-engine/project-context.tsx index f1bcbf2f..213755e2 100644 --- a/frontend/src/components/chat/code-engine/project-context.tsx +++ b/frontend/src/components/chat/code-engine/project-context.tsx @@ -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 { diff --git a/frontend/src/components/root/expand-card.tsx b/frontend/src/components/root/expand-card.tsx index 3e739a32..0ca16999 100644 --- a/frontend/src/components/root/expand-card.tsx +++ b/frontend/src/components/root/expand-card.tsx @@ -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" /> diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9e678c42..792dac1b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12031,7 +12031,7 @@ packages: resolution: {integrity: sha512-xq+q3SRMOxGivLhBNaUdC64hDTQwejJ+H0T/NB1XMtTVEwNTrfFF3gAxiyW0Bu/xWEGhjVKgUcMhCrUy2+uCWg==} dependencies: base64-js: 1.5.1 - ieee754: 1.1.13 + ieee754: 1.2.1 isarray: 1.0.0 dev: false @@ -15997,8 +15997,8 @@ packages: whatwg-encoding: 2.0.0 dev: true - /html-entities@2.5.2: - resolution: {integrity: sha512-K//PSRMQk4FZ78Kyau+mZurHn3FH0Vwr+H36eE0rPbeYkRRi9YxceYPhuN60UwWorxyKHhqoAJl2OFKa4BVtaA==} + /html-entities@2.5.3: + resolution: {integrity: sha512-D3AfvN7SjhTgBSA8L1BN4FpPzuEd06uy4lHwSoRWr0lndi9BKaNzPLKGOWZ2ocSGguozr08TTb2jhCLHaemruw==} dev: false /html-escaper@2.0.2: @@ -16483,6 +16483,7 @@ packages: /ip-address@9.0.5: resolution: {integrity: sha512-zHtQzGojZXTwZTHQqra+ETKd4Sn3vgi7uBmlPoXVWZqYvuKmtI0l/VZTjqGmJY9x88GGOaZ9+G9ES8hC4T4X8g==} engines: {node: '>= 12'} + requiresBuild: true dependencies: jsbn: 1.1.0 sprintf-js: 1.1.3 @@ -17852,6 +17853,7 @@ packages: /jsbn@1.1.0: resolution: {integrity: sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A==} + requiresBuild: true dev: false /jsdom@20.0.3: @@ -24014,6 +24016,7 @@ packages: /smart-buffer@4.2.0: resolution: {integrity: sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==} engines: {node: '>= 6.0.0', npm: '>= 3.0.0'} + requiresBuild: true dev: false /snake-case@3.0.4: @@ -24157,6 +24160,7 @@ packages: /sprintf-js@1.1.3: resolution: {integrity: sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==} + requiresBuild: true dev: false /sql-highlight@6.0.0: @@ -26106,7 +26110,7 @@ packages: default-gateway: 6.0.3 express: 4.21.2 graceful-fs: 4.2.11 - html-entities: 2.5.2 + html-entities: 2.5.3 http-proxy-middleware: 2.0.7(@types/express@4.17.21) ipaddr.js: 2.2.0 launch-editor: 2.10.0 @@ -26513,7 +26517,7 @@ packages: resolution: {integrity: sha512-T4rieHaC1EXcES0Kxxj4JWgaUQHDk+qwHcYOCFHfiwKz7tOVPLq7Hjq9dM1WCMhylqMEfP7hMcOIChvotiZegA==} engines: {node: '>=4.0.0'} dependencies: - sax: 1.2.1 + sax: 1.4.1 xmlbuilder: 11.0.1 dev: false