website-builder-backend / frontend /scripts /07_device_preview_workspace.sh
David Prince
fix: add all missing local module stubs (remote_mcp_registry, mcp_auth, mcp_transport, etc)
cce8120
Raw
History Blame Contribute Delete
1.76 kB
#!/usr/bin/env bash
set -euo pipefail
mkdir -p components/device
cat > components/device/DevicePreview.jsx <<'EOC'
"use client";
import { useState } from "react";
const DEVICES = {
phone: { width: 390, height: 844 },
tablet: { width: 820, height: 1180 },
desktop: { width: 1440, height: 900 }
};
export default function DevicePreview({ url = "http://localhost:3000" }) {
const [device, setDevice] = useState("phone");
const size = DEVICES[device];
return (
<div className="flex h-full flex-col bg-slate-950">
<div className="flex items-center gap-2 border-b border-slate-800 p-3">
<button
onClick={() => setDevice("phone")}
className="rounded bg-sky-600 px-3 py-1 text-white">
Phone
</button>
<button
onClick={() => setDevice("tablet")}
className="rounded bg-slate-700 px-3 py-1 text-white">
Tablet
</button>
<button
onClick={() => setDevice("desktop")}
className="rounded bg-slate-700 px-3 py-1 text-white">
Desktop
</button>
</div>
<div className="flex flex-1 items-center justify-center overflow-auto bg-slate-900">
<iframe
title="Device Preview"
src={url}
style={{
width: size.width,
height: size.height,
border: "1px solid #334155",
borderRadius: "14px",
background: "#ffffff"
}}
/>
</div>
</div>
);
}
EOC
cat > components/device/index.js <<'EOC'
export { default } from "./DevicePreview";
EOC
echo "[1/4] Verify..."
test -f components/device/DevicePreview.jsx
test -f components/device/index.js
echo "[2/4] Device Preview installed."