Spaces:
Sleeping
Sleeping
responsive version OMG + DEEPSITE NAMING
Browse filesFiles changed (8)
3 unmodified lines4567789101011121314153 unmodified lines <meta charset="utf-8" /> <link rel="icon" type="image/svg+xml" href="/vite.svg" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Space Generator</title> <title>DeepSite | Build with AI ✨</title> <meta name="description" content="Code and Deploy your Hugging Face Static App in 1-Click 🚀" content="DeepSite is a web development tool that helps you build websites with AI, no code required. Let's deploy your website with DeepSite and enjoy the magic of AI." /> <link rel="preconnect" href="https://fonts.googleapis.com" /> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />2 unmodified lines345667894 unmodified lines141516171819202122232425262745 unmodified lines7374757677697071727378798081828384858614 unmodified lines10110210394104105106971071081091106 unmodified lines11711811911011111212012112212312412512612712821 unmodified lines1501511521401531541551562 unmodified lines1591601611491501511521531541621631642 unmodified linesimport Editor from "@monaco-editor/react";import classNames from "classnames";import { editor } from "monaco-editor";import { useMount, useUnmount, useEvent } from "react-use";import { useMount, useUnmount, useEvent, createBreakpoint } from "react-use";import { toast } from "react-toastify";
import Header from "./header/header";4 unmodified linesimport { Auth } from "../utils/types";import Preview from "./preview/preview";
const useBreakpoint = createBreakpoint({ md: 768, lg: 1024,});
function App() { const breakpoint = useBreakpoint();
const preview = useRef<HTMLDivElement>(null); const editor = useRef<HTMLDivElement>(null); const resizer = useRef<HTMLDivElement>(null);45 unmodified lines useMount(() => { fetchMe(); if (!editor.current || !preview.current) return;
if (breakpoint === "lg") { // Set initial sizes const initialEditorWidth = window.innerWidth / 2; const initialPreviewWidth = window.innerWidth - initialEditorWidth - 4; editor.current.style.width = `${initialEditorWidth}px`; preview.current.style.width = `${initialPreviewWidth}px`; // Set initial sizes const initialEditorWidth = window.innerWidth / 2; const initialPreviewWidth = window.innerWidth - initialEditorWidth - 4; editor.current.style.width = `${initialEditorWidth}px`; preview.current.style.width = `${initialPreviewWidth}px`; }
if (!resizer.current) return; resizer.current.addEventListener("mousedown", handleMouseDown);14 unmodified lines <Header> <DeployButton html={html} error={error} auth={auth} /> </Header> <main className="lg:flex w-full hidden"> <main className="max-lg:flex-col flex w-full"> <div ref={editor} className="w-full h-full relative" className="w-full h-[30dvh] lg:h-full relative" onClick={(e) => { if (isAiWorking) { e.preventDefault();6 unmodified lines <Editor language="html" theme="vs-dark" className={classNames("h-[calc(100dvh-96px)]", { "pointer-events-none": isAiWorking, })} className={classNames( "h-[calc(30dvh-41px)] lg:h-[calc(100dvh-96px)]", { "pointer-events-none": isAiWorking, } )} value={html} onValidate={(markers) => { if (markers?.length > 0) {21 unmodified lines </div> <div ref={resizer} className="bg-gray-700 hover:bg-blue-500 w-2 cursor-col-resize h-[calc(100dvh-54px)]" className="bg-gray-700 hover:bg-blue-500 w-2 cursor-col-resize h-[calc(100dvh-54px)] max-lg:hidden" /> <Preview html={html}2 unmodified lines ref={preview} /> </main> <main className="lg:hidden p-5"> <p className="p-5 bg-red-500/10 text-red-500 rounded-md text-base text-pretty"> This app is not yet optimized for mobile. Please use a desktop browser for the best experience. </p> </main> </div> );}41 unmodified lines42434445454647484950515238 unmodified lines919293929495969798979910010110210110310410510641 unmodified lines if (request && request.body) { if (!request.ok) { const res = await request.json(); toast.error(res.message); if (res.openLogin) { setOpen(true); } else { // don't show toast if it's a login error toast.error(res.message); } setisAiWorking(false); return;38 unmodified lines
return ( <div className={`bg-gray-950 rounded-xl py-2.5 pl-4 pr-2.5 sticky bottom-4 left-4 w-[calc(100%-2rem)] z-10 group ${ className={`bg-gray-950 rounded-xl py-2 lg:py-2.5 pl-3.5 lg:pl-4 pr-2 lg:pr-2.5 absolute lg:sticky bottom-3 left-3 lg:bottom-4 lg:left-4 w-[calc(100%-1.5rem)] lg:w-[calc(100%-2rem)] z-10 group ${ isAiWorking ? "animate-pulse" : "" }`} > <div className="w-full relative flex items-center justify-between"> <RiSparkling2Fill className="text-xl text-gray-500 group-focus-within:text-pink-500" /> <RiSparkling2Fill className="text-lg lg:text-xl text-gray-500 group-focus-within:text-pink-500" /> <input type="text" disabled={isAiWorking} className="w-full bg-transparent outline-none pl-3 text-white placeholder:text-gray-500 font-code" className="w-full bg-transparent max-lg:text-sm outline-none pl-3 text-white placeholder:text-gray-500 font-code" placeholder={ hasAsked ? "What do you want to ask AI next?" : "Ask AI anything..." }57 unmodified lines58596061616263648 unmodified lines737475767677787957 unmodified lines };
return ( <div className="relative max-lg:hidden flex items-center justify-end"> <div className="relative flex items-center justify-end"> {auth && ( <p className="mr-3 text-sm text-gray-300"> Connected as{" "}8 unmodified lines )} <button className={classNames( "relative cursor-pointer flex-none flex items-center justify-center rounded-md text-sm font-semibold leading-6 py-1.5 px-5 hover:bg-pink-400 text-white shadow-sm dark:shadow-highlight/20", "relative cursor-pointer flex-none flex items-center justify-center rounded-md text-xs lg:text-sm font-semibold leading-5 lg:leading-6 py-1.5 px-5 hover:bg-pink-400 text-white shadow-sm dark:shadow-highlight/20", { "bg-pink-400": open, "bg-pink-500": !open,2 unmodified lines34566789108910111213141516172 unmodified lines
function Header({ children }: { children?: ReactNode }) { return ( <header className="border-b border-gray-900 px-6 py-2 flex justify-center md:justify-between items-center"> <header className="border-b border-gray-900 px-3 lg:px-6 py-2 flex justify-between items-center"> <div className="flex items-center justify-start gap-3"> <h1 className="text-white text-xl font-bold flex items-center justify-start"> <img src={SpaceIcon} alt="Space Icon" className="size-8 mr-2" /> Space Generator <h1 className="text-white text-lg lg:text-xl font-bold flex items-center justify-start"> <img src={SpaceIcon} alt="Space Icon" className="size-6 lg:size-8 mr-2" /> DeepSite </h1> <p className="text-gray-700 max-md:hidden">|</p> <p className="text-gray-500 text-sm max-md:hidden">28 unmodified lines29303132323334354 unmodified lines404142434344454628 unmodified lines return ( <div ref={ref} className="w-full border-l border-gray-900 bg-white h-[calc(100dvh-54px)] relative" className="w-full border-l border-gray-900 bg-white h-[calc(70dvh-53px)] lg:h-[calc(100dvh-54px)] relative" > <iframe ref={iframeRef}4 unmodified lines srcDoc={html} /> <button className="bg-gray-900 shadow-md text-white text-sm font-medium absolute bottom-5 right-5 py-2 px-4 rounded-lg flex items-center gap-2 border border-gray-800 hover:brightness-150 transition-all duration-100 cursor-pointer" className="bg-gray-950 shadow-md text-white text-xs lg:text-sm font-medium absolute bottom-3 lg:bottom-5 right-3 lg:right-5 py-2 px-3 lg:px-4 rounded-lg flex items-center gap-2 border border-gray-900 hover:brightness-150 transition-all duration-100 cursor-pointer" onClick={handleRefreshIframe} > <TbReload />1 unmodified line234556781 unmodified line
function Tabs({ children }: { children?: React.ReactNode }) { return ( <div className="border-b border-gray-800 pl-7 pr-3 flex items-center justify-between"> <div className="border-b border-gray-800 pl-4 lg:pl-7 pr-3 flex items-center justify-between"> <div className=" space-x-6"10 unmodified lines1112131415161710 unmodified lines align-items: center; height: 100dvh; font-family: "Arial", sans-serif; text-align: center; } </style> </head>index.html+4-2
src/components/App.tsx+25-18
src/components/ask-ai/ask-ai.tsx+6-4
src/components/deploy-button/deploy-button.tsx+2-2
src/components/header/header.tsx+8-4
src/components/preview/preview.tsx+2-2
src/components/tabs/tabs.tsx+1-1
src/utils/consts.ts+1