🔧 Shot Selection & Toggle Button Fix - Complete

✅ Issue Fixed Successfully

Problem: The detail panel toggle button was always disabled because there was no way to select shots in table view.

Solution: Added row click functionality to select shots without opening the detail panel.

🔧 Implementation Details

1. Added Row Click Handler to ShotsDataTable.vue

// Added click event to table rows: <TableRow v-for="row in table.getRowModel().rows" :key="row.id" :data-state="row.getIsSelected() ? 'selected' : undefined" class="cursor-pointer hover:bg-muted/50" :class="{ 'bg-muted/30': row.getIsSelected() }" @click="handleRowClick(row.original, $event)" > // Added emit for row-click: const emit = defineEmits<{ 'update:sorting': [sorting: SortingState] 'update:columnVisibility': [visibility: VisibilityState] 'row-click': [shot: Shot, event: MouseEvent] // ← NEW 'selection-cleared': [] }>() // Added comprehensive click handler with event filtering: const handleRowClick = (shot: Shot, event: MouseEvent) => { // Prevents clicks on interactive elements (buttons, dropdowns, etc.) // Only emits row-click for actual row clicks // ... (comprehensive event filtering logic) emit('row-click', shot, event) }

2. Connected Row Click to Shot Selection in ShotBrowser.vue

// Added row-click handler to ShotsDataTable usage: <ShotsDataTable v-else-if="viewMode === 'table'" :columns="shotColumns" :data="filteredShots" :sorting="sorting" :column-visibility="columnVisibility" :all-task-types="allTaskTypes" @update:sorting="sorting = $event" @update:column-visibility="handleColumnVisibilityChange" @row-click="handleRowClick" // ← NEW /> // Added handleRowClick function: const handleRowClick = (shot: Shot, event: MouseEvent) => { // Don't handle row clicks if any dialog is open if (showDeleteDialog.value || showCreateDialog.value || showBulkCreateDialog.value || showEditDialog.value) { return } // Single click selects the shot but doesn't open detail panel // This enables the toggle button so users can control panel visibility selectedShot.value = shot }

🎯 New User Flow

Shot Selection & Detail Panel Control Flow:

  1. Click on table row → Selects shot (enables toggle button)
  2. Click toggle button → Shows/hides detail panel
  3. Click "View Tasks" in dropdown → Selects shot + shows panel immediately

Button States:

Ways to Select a Shot:

🛡️ Event Filtering & Safety

Smart Click Detection:

The row click handler includes comprehensive filtering to prevent conflicts:

Preserved Functionality:

✅ Testing Checklist

📋 Complete User Experience

Scenario 1: Basic Usage

  1. User clicks on a shot row → Shot gets selected
  2. Toggle button becomes enabled
  3. User clicks toggle button → Detail panel shows
  4. User clicks toggle button again → Detail panel hides

Scenario 2: Quick Access

  1. User clicks Actions → "View Tasks" → Shot selected + panel shows immediately
  2. User can still use toggle button to hide/show panel

Scenario 3: Multi-Shot Workflow

  1. User clicks Shot A → Shot A selected, toggle enabled
  2. User clicks toggle → Panel shows Shot A details
  3. User clicks Shot B → Shot B selected, panel shows Shot B details
  4. User clicks toggle → Panel hides

🎉 Issue Resolved

The toggle button now works perfectly:

❌ Before (Broken)

  • No way to select shots in table
  • Toggle button always disabled
  • Couldn't show detail panel via button

✅ After (Fixed)

  • Click rows to select shots
  • Toggle button enables when shot selected
  • Button properly shows/hides detail panel

The shot table now provides: