Loading files
import { useState } from 'react';
import { useDesignStore } from '../../../store/useDesignStore';
import { useIsMobile } from '../../../hooks/useMediaQuery';
import { QRTab } from './QRTab';
import { TextTab } from './TextTab';
import { ImageTab } from './ImageTab';
type TabType = 'qr' | 'text' | 'image';
export function LeftPanel() {
const [activeTab, setActiveTab] = useState<TabType>('qr');
const isMobile = useIsMobile();
const selectedPlateId = useDesignStore((state) => state.selectedPlateId);
const plates = useDesignStore((state) => state.plates);
const selectedPlate = plates.find((p) => p.id === selectedPlateId);
const hasPlate = !!selectedPlate;
const tabButtonStyle = (isActive: boolean) => ({
flex: 1,
padding: isMobile ? '10px 8px' : '12px',
backgroundColor: isActive ? '#fff' : '#f0ede9',
border: 'none',
borderRight: '1px solid #e5e0db',
cursor: 'pointer',
fontSize: isMobile ? '15px' : '18px',
fontWeight: isActive ? 600 : 400,
transition: 'all 0.2s',
outline: 'none',
});
return (
<div
style={{
width: isMobile ? '100%' : '40%',
height: isMobile ? 'auto' : 'calc(100vh - 60px)',
backgroundColor: isMobile ? 'transparent' : '#f8f6f3',
borderRight: isMobile ? 'none' : '1px solid #e5e0db',
display: 'flex',
flexDirection: 'column',
overflow: isMobile ? 'visible' : 'hidden',
}}
>
{/* Tab header */}
<div
style={{
display: 'flex',
borderBottom: '1px solid #ddd',
gap: isMobile ? '8px' : '0',
padding: isMobile ? '8px' : '0',
}}
>
<button
style={{
...tabButtonStyle(activeTab === 'qr'),
borderRadius: isMobile ? '8px' : '0',
}}
onClick={() => setActiveTab('qr')}
>
QR
</button>
<button
style={{
...tabButtonStyle(activeTab === 'text'),
borderRadius: isMobile ? '8px' : '0',
}}
onClick={() => setActiveTab('text')}
>
Text
</button>
<button
style={{
...tabButtonStyle(activeTab === 'image'),
borderRight: 'none',
borderRadius: isMobile ? '8px' : '0',
}}
onClick={() => setActiveTab('image')}
>
Image
</button>
</div>
{/* Tab content */}
<div
style={{
flex: 1,
overflowY: 'auto',
overflowX: 'hidden',
padding: isMobile ? '0 12px 0 12px' : '20px',
backgroundColor: isMobile ? 'transparent' : '#fff',
position: 'relative',
}}
>
{/* Overlay when no plate selected */}
{!hasPlate && (
<div
style={{
position: 'absolute',
top: 0,
left: 0,
right: 0,
bottom: 0,
backgroundColor: 'rgba(255, 255, 255, 0.9)',
zIndex: 10,
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
flexDirection: 'column',
gap: '10px',
}}
>
<div style={{ fontSize: '20px', color: '#999', fontWeight: 600 }}>
Select a QR Plate
</div>
<div style={{ fontSize: '16px', color: '#bbb', fontWeight: 400 }}>
Click + button on the right to add a new QR plate
</div>
</div>
)}
{activeTab === 'qr' && selectedPlate && <QRTab plate={selectedPlate} />}
{activeTab === 'text' && selectedPlate && <TextTab plate={selectedPlate} />}
{activeTab === 'image' && selectedPlate && <ImageTab plate={selectedPlate} />}
</div>
</div>
);
}
3b9ddfd73This file is pinned to the selected release. Download the original to open it in your design tool.