fix(tasks): tapping anywhere on a task card opens it
MindSift CI & Docker Release / Build, Test in Container & Push (push) Successful in 1m29s
MindSift CI & Docker Release / Build, Test in Container & Push (push) Successful in 1m29s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
597b6816a7
commit
2303ccce68
2 files changed
+18
-12
No files matched your search
@@ -37,6 +37,17 @@ import { CountBadge } from '../../components/CountBadge';
|
||||
import { FormSheet } from '../../components/FormSheet';
|
||||
import { useMobileActions } from '../../context/MobileActionContext';
|
||||
|
||||
// Drag & drop needs a mouse or pen; on touch-only devices a draggable row can swallow a slightly
|
||||
// longer tap, so the row would not open
|
||||
const canDragTasks =
|
||||
typeof window !== 'undefined' && !!window.matchMedia?.('(any-pointer: fine)').matches;
|
||||
|
||||
// Rows inside a task card keep taps on their own controls; taps on empty space or plain labels
|
||||
// (due date, webhook) reach the card and open the task
|
||||
const stopOnControl = (e: React.MouseEvent) => {
|
||||
if ((e.target as HTMLElement).closest('button, select, a, input')) e.stopPropagation();
|
||||
};
|
||||
|
||||
interface TasksViewProps {
|
||||
currentUser?: User | null;
|
||||
onRefreshStats: () => void;
|
||||
@@ -1093,7 +1104,7 @@ export const TasksView: React.FC<TasksViewProps> = ({
|
||||
return (
|
||||
<div
|
||||
key={task.id}
|
||||
draggable={!readOnly}
|
||||
draggable={canDragTasks && !readOnly}
|
||||
onDragStart={(e) => handleTaskDragStart(e, task)}
|
||||
onDragEnd={() => {
|
||||
setDraggingTaskId(null);
|
||||
@@ -1143,13 +1154,7 @@ export const TasksView: React.FC<TasksViewProps> = ({
|
||||
</button>
|
||||
|
||||
{/* Clickable Title & Metadata */}
|
||||
<div
|
||||
onClick={() => {
|
||||
setDetailTaskId(task.id);
|
||||
setShowDetailModal(true);
|
||||
}}
|
||||
className="min-w-0 flex-1 cursor-pointer space-y-1"
|
||||
>
|
||||
<div className="min-w-0 flex-1 cursor-pointer space-y-1">
|
||||
<div className="flex items-center gap-2 flex-wrap">
|
||||
<p
|
||||
className={`text-sm break-words leading-tight ${
|
||||
@@ -1166,7 +1171,7 @@ export const TasksView: React.FC<TasksViewProps> = ({
|
||||
{/* Interactive Badges Bar */}
|
||||
<div
|
||||
className="flex flex-wrap items-center gap-1.5 pt-0.5 empty:hidden"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
onClick={stopOnControl}
|
||||
>
|
||||
{(task.convertedType === 'document_block' || task.docId) && (
|
||||
<button
|
||||
@@ -2163,7 +2168,7 @@ export const TasksView: React.FC<TasksViewProps> = ({
|
||||
return (
|
||||
<div
|
||||
key={task.id}
|
||||
draggable={!readOnly}
|
||||
draggable={canDragTasks && !readOnly}
|
||||
onDragStart={(e) => handleTaskDragStart(e, task)}
|
||||
onDragEnd={() => {
|
||||
setDraggingTaskId(null);
|
||||
@@ -2230,7 +2235,7 @@ export const TasksView: React.FC<TasksViewProps> = ({
|
||||
)}
|
||||
|
||||
{/* Badges: In Notiz, Priority, Status, Tags */}
|
||||
<div className="flex flex-wrap items-center gap-1 pt-0.5" onClick={(e) => e.stopPropagation()}>
|
||||
<div className="flex flex-wrap items-center gap-1 pt-0.5" onClick={stopOnControl}>
|
||||
{(task.convertedType === 'document_block' || task.docId) && (
|
||||
<button
|
||||
type="button"
|
||||
@@ -2315,7 +2320,7 @@ export const TasksView: React.FC<TasksViewProps> = ({
|
||||
{!readOnly && (
|
||||
<div
|
||||
className="flex items-center justify-between pt-1 border-t border-border text-[10px]"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
onClick={stopOnControl}
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
|
||||
Reference in new issue
Block a user