Layout Fixes

This commit is contained in:
2026-03-13 16:49:17 -05:00
parent 989baa9be7
commit dfc4cccb56
5 changed files with 461 additions and 370 deletions
+59 -9
View File
@@ -56,7 +56,7 @@ const ItemRow: Component<ItemRowProps> = (props) => {
return (
<div
class={`group flex items-start gap-4 p-3 border transition-all animate-in fade-in slide-in-from-left-2
class={`group flex flex-col md:flex-row items-stretch md:items-start gap-3 md:gap-4 p-3 border transition-all animate-in fade-in slide-in-from-left-2 w-full
${props.isSelected
? 'bg-primary/5 border-primary shadow-premium z-10'
: 'bg-card border-border hover:shadow-premium-hover hover:border-border/80'
@@ -64,6 +64,7 @@ const ItemRow: Component<ItemRowProps> = (props) => {
${isEditing() ? 'ring-1 ring-primary/20 shadow-premium border-primary/30' : 'rounded-2xl'}
`}
>
<div class="flex items-start gap-3">
<div
draggable={!isEditing() || props.anySelected}
onDragStart={(e) => props.onDragStart(e, props.item.id)}
@@ -78,7 +79,6 @@ const ItemRow: Component<ItemRowProps> = (props) => {
</div>
<div class="flex-1 relative min-w-[200px]">
<textarea
ref={descriptionRef}
value={localDescription()}
@@ -108,7 +108,42 @@ const ItemRow: Component<ItemRowProps> = (props) => {
/>
</div>
<div class="w-20 shrink-0 mt-1">
{/* Mobile Actions Container */}
<div class="flex md:hidden items-center gap-1.5 mt-1.5 px-1">
<button
onClick={(e) => {
e.stopPropagation();
props.onDuplicateItem(props.item.id);
}}
class="text-muted-foreground/40 hover:text-primary transition-colors"
title="Duplicate Item"
>
<div class="p-1 px-1.5 bg-muted rounded-lg border border-border/40 hover:bg-primary/10">
<Copy class="w-3 h-3" />
</div>
</button>
<button
onClick={(e) => {
e.stopPropagation();
props.onDelete(props.item.id);
}}
class="text-muted-foreground/40 hover:text-destructive transition-colors"
title="Delete Item"
>
<div class="p-1 px-1.5 bg-muted rounded-lg border border-border/40 hover:bg-destructive/10">
<Trash2 class="w-3 h-3" />
</div>
</button>
</div>
</div>
{/* Numeric Fields Group */}
<div class="flex flex-wrap md:flex-nowrap items-center gap-3 md:gap-4 pl-7 md:pl-0">
{/* Qty & Price Group */}
<div class="flex items-center gap-2">
<div class="w-20 shrink-0">
<div class="md:hidden text-[9px] font-bold text-muted-foreground/60 uppercase mb-1 ml-1">Qty</div>
<NumericInput
dataFieldName="qty"
value={props.item.quantity}
@@ -134,7 +169,8 @@ const ItemRow: Component<ItemRowProps> = (props) => {
/>
</div>
<div class="w-24 shrink-0 mt-1">
<div class="w-24 shrink-0">
<div class="md:hidden text-[9px] font-bold text-muted-foreground/60 uppercase mb-1 ml-1">Price</div>
<div class="relative">
<span class="absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground/50 text-[10px]">$</span>
<NumericInput
@@ -163,6 +199,7 @@ const ItemRow: Component<ItemRowProps> = (props) => {
/>
</div>
</div>
</div>
<div
draggable="true"
@@ -180,13 +217,17 @@ const ItemRow: Component<ItemRowProps> = (props) => {
e.dataTransfer!.effectAllowed = 'copy';
e.stopPropagation();
}}
class={`w-24 shrink-0 text-right text-muted-foreground/60 text-[11px] mt-2 font-bold uppercase tracking-tighter cursor-grab hover:text-primary transition-colors`}
class={`hidden md:block w-24 shrink-0 text-right text-muted-foreground/60 text-[11px] mt-2 font-bold uppercase tracking-tighter cursor-grab hover:text-primary transition-colors`}
>
${formatNumber(baseTotal())}
</div>
{/* Markup & Contingency Group */}
<Show when={props.isSidebarCollapsed() || !props.hideColumns}>
<div class="w-32 shrink-0 flex items-center gap-1.5 mt-1">
<div class="flex items-center gap-2">
<div class="w-32 shrink-0">
<div class="md:hidden text-[9px] font-bold text-muted-foreground/60 uppercase mb-1 ml-1">Markup</div>
<div class="flex items-center gap-1.5">
<NumericInput
dataFieldName="markup"
value={props.item.markup}
@@ -206,8 +247,11 @@ const ItemRow: Component<ItemRowProps> = (props) => {
{props.item.markupType === 'percent' ? '%' : '$'}
</button>
</div>
</div>
<div class="w-32 shrink-0 flex items-center gap-1.5 mt-1">
<div class="w-32 shrink-0">
<div class="md:hidden text-[9px] font-bold text-muted-foreground/60 uppercase mb-1 ml-1">Contingency</div>
<div class="flex items-center gap-1.5">
<NumericInput
dataFieldName="contingency"
value={props.item.contingency}
@@ -227,8 +271,11 @@ const ItemRow: Component<ItemRowProps> = (props) => {
{props.item.contingencyType === 'percent' ? '%' : '$'}
</button>
</div>
</div>
</div>
</Show>
<div class="flex items-center gap-3">
<div
draggable="true"
onDragStart={(e) => {
@@ -245,12 +292,13 @@ const ItemRow: Component<ItemRowProps> = (props) => {
e.dataTransfer!.effectAllowed = 'copy';
e.stopPropagation();
}}
class={`w-28 shrink-0 text-right font-black text-sm mt-2 cursor-grab hover:text-primary transition-colors ${props.isSelected ? 'text-primary' : 'text-foreground'}`}
class={`w-28 shrink-0 text-right font-black text-sm md:mt-2 cursor-grab hover:text-primary transition-colors ${props.isSelected ? 'text-primary' : 'text-foreground'}`}
>
<div class="md:hidden text-[9px] font-bold text-muted-foreground/60 uppercase mb-1 ml-1">Total</div>
${formatNumber(total())}
</div>
<div class="w-16 shrink-0 flex items-center justify-end gap-1.5 mt-1.5 opacity-0 group-hover:opacity-100 transition-opacity">
<div class="hidden md:flex w-16 shrink-0 items-center justify-end gap-1.5 mt-1.5 opacity-0 group-hover:opacity-100 transition-opacity">
<button
onClick={(e) => {
e.stopPropagation();
@@ -278,6 +326,8 @@ const ItemRow: Component<ItemRowProps> = (props) => {
</button>
</div>
</div>
</div>
</div>
);
};
+7 -3
View File
@@ -202,12 +202,13 @@ const ScopeCard: Component<ScopeCardProps> = (props) => {
<div
onClick={(e) => { if (e.target === e.currentTarget) props.onClearSelection(); }}
class="p-6 space-y-4 relative"
class="relative overflow-x-auto min-w-0"
>
<div class="p-6 space-y-4 min-w-full md:min-w-max flex flex-col items-stretch">
<Show when={scopeItems().length > 0}>
<div class="relative pb-4">
<div class="relative">
{/* Column Headers - Sticky, Square Top */}
<div class="sticky top-header z-20 bg-background/95 backdrop-blur-sm border-b border-border py-2 mb-2 hidden md:flex items-center gap-4 text-[10px] font-bold text-muted-foreground uppercase tracking-wider px-3 rounded-none">
<div class="sticky top-0 z-20 bg-background/95 backdrop-blur-sm border-b border-border py-2 mb-2 hidden md:flex items-center gap-4 text-[10px] font-bold text-muted-foreground uppercase tracking-wider px-3 rounded-none">
<div class="w-4 shrink-0"></div> {/* Grip space */}
<div class="flex-1 min-w-[200px]">Description</div>
<div class="w-20 shrink-0 text-right">Qty</div>
@@ -250,7 +251,10 @@ const ScopeCard: Component<ScopeCardProps> = (props) => {
Empty scope. Drag items here or add sub-scopes.
</div>
</Show>
</div>
</div>
<div class="p-6 pt-0 space-y-4 relative">
{/* Sub-scopes */}
<div class="space-y-6 pt-4">
<For each={props.subScopes}>
+4 -2
View File
@@ -166,11 +166,12 @@ const SubScopeCard: Component<SubScopeCardProps> = (props) => {
<Show when={!isCollapsed()}>
<div
onClick={(e) => { if (e.target === e.currentTarget) props.onClearSelection(); }}
class="p-2 space-y-1.5 relative"
class="relative overflow-x-auto min-w-0"
>
<div class="p-2 space-y-1.5 min-w-full md:min-w-max flex flex-col items-stretch">
{/* SubScope Column Headers */}
<Show when={props.items.length > 0}>
<div class="sticky top-header z-20 bg-background/95 backdrop-blur-sm hidden md:flex items-center gap-4 text-[9px] font-bold text-muted-foreground/60 uppercase tracking-wider px-3 pb-2 pt-1 mb-2 border-b border-border/40">
<div class="sticky top-0 z-20 bg-background/95 backdrop-blur-sm hidden md:flex items-center gap-4 text-[9px] font-bold text-muted-foreground/60 uppercase tracking-wider px-3 pb-2 pt-1 mb-2 border-b border-border/40">
<div class="w-4 shrink-0"></div>
<div class="flex-1 min-w-[200px]">Description</div>
<div class="w-20 shrink-0 text-right">Qty</div>
@@ -209,6 +210,7 @@ const SubScopeCard: Component<SubScopeCardProps> = (props) => {
</div>
</Show>
</div>
</div>
</Show>
</div>
);
@@ -43,9 +43,13 @@ export const UnassignedItemsSection: Component<UnassignedItemsSectionProps> = (p
{props.unassignedItems.length} Items Pending
</span>
</div>
<div class="relative pb-4">
<div
onClick={(e) => { if (e.target === e.currentTarget) props.clearSelection(e); }}
class="relative overflow-x-auto min-w-0 px-6"
>
<div class="min-w-full md:min-w-max flex flex-col items-stretch pb-4">
{/* Sticky Column Headers for Unassigned */}
<div class="sticky top-header z-10 bg-background/95 backdrop-blur-sm border-b border-border py-3 mb-4 hidden md:flex items-center gap-4 text-[10px] font-black text-muted-foreground/60 uppercase tracking-[0.2em] px-3">
<div class="sticky top-0 z-10 bg-background/95 backdrop-blur-sm border-b border-border py-3 mb-4 hidden md:flex items-center gap-4 text-[10px] font-black text-muted-foreground/60 uppercase tracking-[0.2em] px-3">
<div class="w-4 shrink-0"></div>
<div class="flex-1 min-w-[200px]">Description</div>
<div class="w-20 shrink-0 text-right">Qty</div>
@@ -81,6 +85,7 @@ export const UnassignedItemsSection: Component<UnassignedItemsSectionProps> = (p
</div>
</div>
</div>
</div>
</Show>
);
};
+38 -8
View File
@@ -30,13 +30,14 @@ const TemplateItemRow: Component<TemplateItemRowProps> = (props) => {
};
return (
<div class={`group flex items-start gap-4 p-3 border transition-all animate-in fade-in slide-in-from-left-2 rounded-2xl bg-card border-border hover:shadow-premium-hover hover:border-border/80 ${isEditing() ? 'ring-1 ring-primary/20 shadow-premium border-primary/30' : ''}`}>
<div class={`group flex flex-col md:flex-row items-stretch md:items-start gap-3 md:gap-4 p-3 border transition-all animate-in fade-in slide-in-from-left-2 rounded-2xl bg-card border-border hover:shadow-premium-hover hover:border-border/80 ${isEditing() ? 'ring-1 ring-primary/20 shadow-premium border-primary/30' : ''}`}>
<div class="cursor-grab transition-colors shrink-0 w-4 mt-2 p-1 -m-1 rounded hover:bg-muted text-muted-foreground/30 hover:text-muted-foreground/60" title="Drag to reorder (Coming soon)">
<div class="flex items-start gap-3">
<div class="cursor-grab transition-colors shrink-0 w-4 mt-2 p-1 rounded hover:bg-muted text-muted-foreground/30 hover:text-muted-foreground/60" title="Drag to reorder (Coming soon)">
<GripVertical class="w-4 h-4" />
</div>
<div class="flex-1 relative">
<div class="flex-1 relative min-w-[200px]">
<textarea
ref={descriptionRef}
value={localDescription()}
@@ -56,7 +57,25 @@ const TemplateItemRow: Component<TemplateItemRowProps> = (props) => {
/>
</div>
<div class="w-24 shrink-0 mt-1">
{/* Mobile Actions Container */}
<div class="flex md:hidden items-center gap-1.5 mt-1.5 px-1">
<button
onClick={() => props.onDelete(props.item.id)}
class="text-muted-foreground/40 hover:text-destructive transition-colors"
title="Delete Item"
>
<div class="p-1 px-1.5 bg-muted rounded-lg border border-border/40 hover:bg-destructive/10">
<Trash2 class="w-3 h-3" />
</div>
</button>
</div>
</div>
{/* Numeric Fields Group */}
<div class="flex flex-wrap md:flex-nowrap items-center gap-3 md:gap-4 pl-7 md:pl-0">
<div class="flex items-center gap-2">
<div class="w-24 shrink-0">
<div class="md:hidden text-[9px] font-bold text-muted-foreground/60 uppercase mb-1 ml-1">Qty</div>
<NumericInput
value={props.item.quantity}
onUpdate={(val) => props.onUpdate(props.item.id, { quantity: val })}
@@ -65,7 +84,8 @@ const TemplateItemRow: Component<TemplateItemRowProps> = (props) => {
/>
</div>
<div class="w-32 shrink-0 mt-1">
<div class="w-32 shrink-0">
<div class="md:hidden text-[9px] font-bold text-muted-foreground/60 uppercase mb-1 ml-1">Price</div>
<div class="relative">
<span class="absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground/50 text-[10px]">$</span>
<NumericInput
@@ -77,8 +97,12 @@ const TemplateItemRow: Component<TemplateItemRowProps> = (props) => {
/>
</div>
</div>
</div>
<div class="w-28 shrink-0 flex items-center gap-1.5 mt-1">
<div class="flex items-center gap-2">
<div class="w-28 shrink-0">
<div class="md:hidden text-[9px] font-bold text-muted-foreground/60 uppercase mb-1 ml-1">Markup</div>
<div class="flex items-center gap-1.5">
<NumericInput
value={props.item.markup}
onUpdate={(val) => props.onUpdate(props.item.id, { markup: val })}
@@ -92,8 +116,11 @@ const TemplateItemRow: Component<TemplateItemRowProps> = (props) => {
{props.item.markupType === 'percent' ? '%' : '$'}
</button>
</div>
</div>
<div class="w-28 shrink-0 flex items-center gap-1.5 mt-1">
<div class="w-28 shrink-0">
<div class="md:hidden text-[9px] font-bold text-muted-foreground/60 uppercase mb-1 ml-1">Cont</div>
<div class="flex items-center gap-1.5">
<NumericInput
value={props.item.contingency}
onUpdate={(val) => props.onUpdate(props.item.id, { contingency: val })}
@@ -107,8 +134,10 @@ const TemplateItemRow: Component<TemplateItemRowProps> = (props) => {
{props.item.contingencyType === 'percent' ? '%' : '$'}
</button>
</div>
</div>
</div>
<div class="w-10 shrink-0 flex items-center justify-end gap-1.5 mt-1.5 opacity-0 group-hover:opacity-100 transition-opacity">
<div class="hidden md:flex w-10 shrink-0 items-center justify-end gap-1.5 mt-1.5 opacity-0 group-hover:opacity-100 transition-opacity">
<button
onClick={() => props.onDelete(props.item.id)}
class="text-muted-foreground/40 hover:text-destructive transition-colors"
@@ -120,6 +149,7 @@ const TemplateItemRow: Component<TemplateItemRowProps> = (props) => {
</button>
</div>
</div>
</div>
);
};