Skip to content

Commit cea1109

Browse files
mvalancyclaude
andauthored
fix(mobile): make the work-item edit modal a usable full-screen sheet on phones (#85)
Tapping a card in list view opened WorkItemDetailsModal, which on a phone was a cramped centered card with a fixed two-column body — and (because it rendered inside the z-20 main-wrapper while the bottom nav/top bar are z-30) the nav and project selector painted ON TOP of it. It didn't fit and looked broken. - Portal the modal to document.body so it escapes the page stacking context and actually covers everything (matches the other dialogs here). - Phones: full-screen sheet (w/h-full, no rounding) with a sticky header so Save/Close stay reachable while scrolling. Desktop unchanged: centered max-w-3xl card. - The two-column body (content | actions) now stacks on phones (flex-col md:flex-row); the right Actions column is w-full md:w-36. Desktop centered-card layout verified unchanged. Smoke 5/5; mobile specs 10/10; typecheck clean. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 426d3c9 commit cea1109

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

packages/web/src/components/WorkItemDetailsModal.tsx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { useState, useEffect, useRef, useCallback } from 'react';
2+
import { createPortal } from 'react-dom';
23
import {
34
X, User, Flag, Edit3, Save, ChevronDown, Plus, Unlink, Trash2,
45
GitBranch, ArrowRight, ArrowLeft, Ban, Link2, Folder, Split, Copy, Shield, Bookmark, Package,
@@ -513,9 +514,9 @@ export function WorkItemDetailsModal({
513514
return getRelationshipIconElement(type as RelationshipType, "h-4 w-4");
514515
};
515516

516-
return (
517+
return createPortal((
517518
<div
518-
className="fixed inset-0 bg-black/70 backdrop-blur-lg z-50 flex items-center justify-center p-4"
519+
className="fixed inset-0 bg-black/70 backdrop-blur-lg z-50 flex items-stretch sm:items-center justify-center p-0 sm:p-4"
519520
role="dialog"
520521
aria-modal="true"
521522
aria-labelledby="modal-title"
@@ -528,7 +529,7 @@ export function WorkItemDetailsModal({
528529
<div
529530
ref={modalRef}
530531
tabIndex={-1}
531-
className="relative bg-gradient-to-br from-gray-900 via-gray-800 to-gray-900 border border-gray-600/50 shadow-2xl w-full max-w-3xl max-h-[90vh] overflow-y-auto rounded-2xl animate-in fade-in zoom-in-95 duration-300 ring-1 ring-white/20 overflow-hidden focus:outline-none focus:ring-2 focus:ring-blue-500/50"
532+
className="relative bg-gradient-to-br from-gray-900 via-gray-800 to-gray-900 border border-gray-600/50 shadow-2xl w-full sm:max-w-3xl h-full sm:h-auto sm:max-h-[90vh] overflow-y-auto rounded-none sm:rounded-2xl animate-in fade-in zoom-in-95 duration-300 ring-1 ring-white/20 focus:outline-none focus:ring-2 focus:ring-blue-500/50"
532533
onClick={(e) => e.stopPropagation()}
533534
>
534535
{/* Gradient accent line at top */}
@@ -542,8 +543,8 @@ export function WorkItemDetailsModal({
542543
}}></div>
543544
</div>
544545

545-
{/* Title Header */}
546-
<div className="relative px-4 py-3 bg-gradient-to-r from-gray-800/40 via-gray-700/30 to-gray-800/40 border-b border-gray-600/30">
546+
{/* Title Header — sticky so Save/Close stay reachable while scrolling */}
547+
<div className="sticky top-0 z-20 px-4 py-3 bg-gradient-to-r from-gray-900/95 via-gray-800/95 to-gray-900/95 backdrop-blur-md border-b border-gray-600/30">
547548
<div className="flex items-center justify-between">
548549
<div className="flex items-center space-x-3">
549550
<div className="p-3 bg-gradient-to-br from-teal-300/60 via-magenta-400/50 to-magenta-300/40 rounded-2xl border border-magenta-200/50">
@@ -693,7 +694,7 @@ export function WorkItemDetailsModal({
693694
</div>
694695

695696
{/* Enhanced Content */}
696-
<div className="flex px-3 py-2 gap-3 bg-gradient-to-br from-gray-800/20 via-transparent to-gray-900/20">
697+
<div className="flex flex-col md:flex-row px-3 py-2 gap-3 bg-gradient-to-br from-gray-800/20 via-transparent to-gray-900/20">
697698
{/* Enhanced Left Column - Main Content */}
698699
<div className="flex-1">
699700
{/* Enhanced Title - Always Editable */}
@@ -1071,7 +1072,7 @@ export function WorkItemDetailsModal({
10711072
</div>
10721073

10731074
{/* Enhanced Right Column - Action Buttons */}
1074-
<div className="w-36 flex-shrink-0 relative">
1075+
<div className="w-full md:w-36 flex-shrink-0 relative">
10751076
<h3 className="text-base font-medium text-gray-300 mb-1 flex items-center">
10761077
<div className="p-1 bg-gradient-to-br from-indigo-500/20 to-blue-600/20 rounded-lg mr-1 border border-indigo-500/30">
10771078
<Rocket className="h-3 w-3 text-indigo-400" />
@@ -1286,5 +1287,5 @@ export function WorkItemDetailsModal({
12861287
</div>
12871288
</div>
12881289
</div>
1289-
);
1290+
), document.body);
12901291
}

0 commit comments

Comments
 (0)