From 63129a93cd7890aeb580afe1d5374b214816e993 Mon Sep 17 00:00:00 2001 From: KevIsDev Date: Tue, 15 Apr 2025 15:32:40 +0100 Subject: [PATCH] feat: add webcontainer connect route and new preview functionality - Add new route `webcontainer.connect.$id.tsx` for WebContainer connection - Implement `openInNewTab` function in `Preview.tsx` for opening previews in new tabs - Update GitHub template fetching logic to include lock files for improved install times - Add new Expo starter template to constants - Extend prompts with mobile app development instructions -Templates now use Releases from github as a work around for rate limits --- app/components/workbench/Preview.tsx | 19 +- app/lib/common/prompts/prompts.ts | 232 ++++++++++++++++++++++++ app/routes/api.github-template.ts | 93 ++++++++++ app/routes/webcontainer.connect.$id.tsx | 32 ++++ app/utils/constants.ts | 28 ++- app/utils/selectStarterTemplate.ts | 82 ++------- 6 files changed, 405 insertions(+), 81 deletions(-) create mode 100644 app/routes/api.github-template.ts create mode 100644 app/routes/webcontainer.connect.$id.tsx diff --git a/app/components/workbench/Preview.tsx b/app/components/workbench/Preview.tsx index ec2a1cd..63348b9 100644 --- a/app/components/workbench/Preview.tsx +++ b/app/components/workbench/Preview.tsx @@ -565,6 +565,12 @@ export const Preview = memo(() => { } }; + const openInNewTab = () => { + if (activePreview?.baseUrl) { + window.open(activePreview?.baseUrl, '_blank'); + } + }; + // Function to get the correct frame padding based on orientation const getFramePadding = useCallback(() => { if (!selectedWindowSize) { @@ -767,8 +773,17 @@ export const Preview = memo(() => { Device Options
+
- Show Device Frame + Show Device Frame
- Landscape Mode + Landscape Mode