mirror of
https://github.com/stackblitz/bolt.new
synced 2025-06-26 18:17:50 +00:00
remove: comments/unused code
This commit is contained in:
parent
2a0ab70833
commit
958392945e
@ -10,12 +10,9 @@ import React, { useState, useRef, useEffect } from 'react';
|
|||||||
interface HeaderActionButtonsProps {}
|
interface HeaderActionButtonsProps {}
|
||||||
|
|
||||||
export function HeaderActionButtons({}: HeaderActionButtonsProps) {
|
export function HeaderActionButtons({}: HeaderActionButtonsProps) {
|
||||||
const showWorkbench = useStore(workbenchStore.showWorkbench);
|
|
||||||
const { showChat } = useStore(chatStore);
|
|
||||||
const [isDropdownOpen, setIsDropdownOpen] = useState(false);
|
const [isDropdownOpen, setIsDropdownOpen] = useState(false);
|
||||||
const dropdownRef = useRef<HTMLDivElement>(null);
|
const dropdownRef = useRef<HTMLDivElement>(null);
|
||||||
|
|
||||||
// Close dropdown when clicking outside
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
function handleClickOutside(event: MouseEvent) {
|
function handleClickOutside(event: MouseEvent) {
|
||||||
if (dropdownRef.current && !dropdownRef.current.contains(event.target as Node)) {
|
if (dropdownRef.current && !dropdownRef.current.contains(event.target as Node)) {
|
||||||
@ -29,7 +26,6 @@ export function HeaderActionButtons({}: HeaderActionButtonsProps) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex gap-1 sm:gap-2">
|
<div className="flex gap-1 sm:gap-2">
|
||||||
{/* Desktop: Show full buttons */}
|
|
||||||
<div className="hidden sm:block">
|
<div className="hidden sm:block">
|
||||||
<Download />
|
<Download />
|
||||||
</div>
|
</div>
|
||||||
@ -40,7 +36,6 @@ export function HeaderActionButtons({}: HeaderActionButtonsProps) {
|
|||||||
<Deploy />
|
<Deploy />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Mobile Dropdown Menu */}
|
|
||||||
<div className="relative block sm:hidden" ref={dropdownRef}>
|
<div className="relative block sm:hidden" ref={dropdownRef}>
|
||||||
<button
|
<button
|
||||||
onClick={() => setIsDropdownOpen(!isDropdownOpen)}
|
onClick={() => setIsDropdownOpen(!isDropdownOpen)}
|
||||||
@ -50,7 +45,6 @@ export function HeaderActionButtons({}: HeaderActionButtonsProps) {
|
|||||||
<div className="i-ph:caret-down text-bolt-elements-textTertiary" />
|
<div className="i-ph:caret-down text-bolt-elements-textTertiary" />
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
{/* Dropdown Menu */}
|
|
||||||
{isDropdownOpen && (
|
{isDropdownOpen && (
|
||||||
<div className="absolute right-0 top-full mt-1 w-48 py-2
|
<div className="absolute right-0 top-full mt-1 w-48 py-2
|
||||||
bg-bolt-elements-background-depth-2
|
bg-bolt-elements-background-depth-2
|
||||||
|
|||||||
@ -179,7 +179,7 @@ export function Deploy() {
|
|||||||
{deployUrl ? (
|
{deployUrl ? (
|
||||||
<button
|
<button
|
||||||
onClick={() => window.open(deployUrl, '_blank')}
|
onClick={() => window.open(deployUrl, '_blank')}
|
||||||
className="flex items-center gap-1 px-3 py-1.5 bg-green-600 hover:bg-green-700 text-bolt-elements-button-secondary-text text-xs border border-bolt-elements-borderColor rounded-md"
|
className="w-full flex items-center justify-center gap-1 px-3 py-1.5 bg-green-600 hover:bg-green-700 text-bolt-elements-button-secondary-text text-xs border border-bolt-elements-borderColor rounded-md"
|
||||||
>
|
>
|
||||||
<Rocket className="w-4 h-4" />
|
<Rocket className="w-4 h-4" />
|
||||||
View Deployment
|
View Deployment
|
||||||
@ -188,7 +188,7 @@ export function Deploy() {
|
|||||||
<button
|
<button
|
||||||
onClick={handleDeploy}
|
onClick={handleDeploy}
|
||||||
disabled={isDeploying || buildStatus === 'building'}
|
disabled={isDeploying || buildStatus === 'building'}
|
||||||
className={`flex items-center gap-1 px-3 py-1.5 ${
|
className={`w-full flex items-center justify-center gap-1 px-3 py-1.5 ${
|
||||||
isDeploying || buildStatus === 'building'
|
isDeploying || buildStatus === 'building'
|
||||||
? 'bg-[#0E6EE8]/70 cursor-not-allowed'
|
? 'bg-[#0E6EE8]/70 cursor-not-allowed'
|
||||||
: 'bg-[#0E6EE8] hover:bg-[#1477f9]'
|
: 'bg-[#0E6EE8] hover:bg-[#1477f9]'
|
||||||
|
|||||||
@ -59,7 +59,7 @@ export default function Download() {
|
|||||||
<button
|
<button
|
||||||
onClick={handleDownload}
|
onClick={handleDownload}
|
||||||
disabled={isLoading}
|
disabled={isLoading}
|
||||||
className="flex items-center gap-1 px-3 py-1.5 bg-bolt-elements-code-background hover:bg-gray-700 text-bolt-elements-button-secondary-text text-sm rounded-md"
|
className="w-full flex items-center justify-center gap-1 px-3 py-1.5 bg-bolt-elements-code-background hover:bg-gray-700 text-bolt-elements-button-secondary-text text-sm rounded-md"
|
||||||
>
|
>
|
||||||
{isLoading ? (
|
{isLoading ? (
|
||||||
<div className="i-ph:spinner animate-spin" />
|
<div className="i-ph:spinner animate-spin" />
|
||||||
|
|||||||
@ -48,7 +48,7 @@ export function Stackblitz() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<button
|
<button
|
||||||
className="flex items-center gap-1 px-3 py-1.5 bg-bolt-elements-code-background hover:bg-gray-700 text-bolt-elements-button-secondary-text text-xs rounded-md"
|
className="w-full flex items-center justify-center gap-1 px-3 py-1.5 bg-bolt-elements-code-background hover:bg-gray-700 text-bolt-elements-button-secondary-text text-xs rounded-md"
|
||||||
onClick={OpenInStackblitz}
|
onClick={OpenInStackblitz}
|
||||||
>
|
>
|
||||||
<LightningBoltIcon className="w-4 h-4" /> Open in Stackblitz
|
<LightningBoltIcon className="w-4 h-4" /> Open in Stackblitz
|
||||||
|
|||||||
@ -56,7 +56,6 @@ const workbenchVariants = {
|
|||||||
},
|
},
|
||||||
} satisfies Variants;
|
} satisfies Variants;
|
||||||
|
|
||||||
// Add a hook for responsive detection
|
|
||||||
function useIsMobile() {
|
function useIsMobile() {
|
||||||
const [isMobile, setIsMobile] = useState(false);
|
const [isMobile, setIsMobile] = useState(false);
|
||||||
|
|
||||||
@ -65,10 +64,8 @@ function useIsMobile() {
|
|||||||
setIsMobile(window.innerWidth < 1024);
|
setIsMobile(window.innerWidth < 1024);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Check initial
|
|
||||||
checkMobile();
|
checkMobile();
|
||||||
|
|
||||||
// Add resize listener
|
|
||||||
window.addEventListener('resize', checkMobile);
|
window.addEventListener('resize', checkMobile);
|
||||||
return () => window.removeEventListener('resize', checkMobile);
|
return () => window.removeEventListener('resize', checkMobile);
|
||||||
}, []);
|
}, []);
|
||||||
@ -142,7 +139,7 @@ export const Workbench = memo(({ chatStarted, isStreaming }: WorkspaceProps) =>
|
|||||||
'left-[100%]': !showWorkbench,
|
'left-[100%]': !showWorkbench,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
: 'w-full h-full' // Mobile styles here
|
: 'w-full h-full'
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<div className={classNames(
|
<div className={classNames(
|
||||||
@ -248,7 +245,6 @@ export const Workbench = memo(({ chatStarted, isStreaming }: WorkspaceProps) =>
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Desktop view uses the same instance
|
|
||||||
return workbenchInstance;
|
return workbenchInstance;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user