184 lines
6.5 KiB
HTML
184 lines
6.5 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Live Shot Selection Debug</title>
|
|
<style>
|
|
body {
|
|
font-family: Arial, sans-serif;
|
|
margin: 20px;
|
|
background-color: #f5f5f5;
|
|
}
|
|
.test-container {
|
|
background: white;
|
|
padding: 20px;
|
|
border-radius: 8px;
|
|
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
|
margin-bottom: 20px;
|
|
}
|
|
.instructions {
|
|
background-color: #d1ecf1;
|
|
color: #0c5460;
|
|
padding: 15px;
|
|
border-radius: 4px;
|
|
margin: 15px 0;
|
|
}
|
|
.steps {
|
|
background-color: #fff3cd;
|
|
color: #856404;
|
|
padding: 15px;
|
|
border-radius: 4px;
|
|
margin: 15px 0;
|
|
}
|
|
.console-output {
|
|
background-color: #f8f9fa;
|
|
border: 1px solid #dee2e6;
|
|
border-radius: 4px;
|
|
padding: 10px;
|
|
font-family: monospace;
|
|
font-size: 12px;
|
|
max-height: 300px;
|
|
overflow-y: auto;
|
|
margin: 15px 0;
|
|
}
|
|
.log-entry {
|
|
margin: 2px 0;
|
|
padding: 2px 0;
|
|
border-bottom: 1px solid #eee;
|
|
}
|
|
.log-before { color: #6c757d; }
|
|
.log-action { color: #007bff; font-weight: bold; }
|
|
.log-after { color: #28a745; }
|
|
button {
|
|
padding: 8px 16px;
|
|
margin: 5px;
|
|
border: none;
|
|
border-radius: 4px;
|
|
cursor: pointer;
|
|
background-color: #007bff;
|
|
color: white;
|
|
}
|
|
button:hover {
|
|
background-color: #0056b3;
|
|
}
|
|
.clear-btn {
|
|
background-color: #6c757d;
|
|
}
|
|
.clear-btn:hover {
|
|
background-color: #545b62;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="test-container">
|
|
<h1>Live Shot Selection Debug Tool</h1>
|
|
|
|
<div class="instructions">
|
|
<strong>Instructions:</strong>
|
|
<ol>
|
|
<li>Open the browser developer console (F12)</li>
|
|
<li>Navigate to the shot table in your application</li>
|
|
<li>Try the problematic selection behavior</li>
|
|
<li>Watch the console logs to see what's happening</li>
|
|
</ol>
|
|
</div>
|
|
|
|
<div class="steps">
|
|
<strong>Test Steps:</strong>
|
|
<ol>
|
|
<li><strong>Multi-select:</strong> Ctrl+click on multiple rows to select them</li>
|
|
<li><strong>Normal click on selected:</strong> Click on one of the already selected rows WITHOUT holding any modifier keys</li>
|
|
<li><strong>Expected:</strong> Only the clicked row should remain selected (single selection)</li>
|
|
<li><strong>Actual (broken):</strong> All previously selected rows remain selected</li>
|
|
</ol>
|
|
</div>
|
|
|
|
<div>
|
|
<h3>Console Log Monitor</h3>
|
|
<p>This will capture the console logs from the shot selection debugging:</p>
|
|
<button onclick="startMonitoring()">Start Monitoring</button>
|
|
<button onclick="stopMonitoring()">Stop Monitoring</button>
|
|
<button onclick="clearLogs()" class="clear-btn">Clear Logs</button>
|
|
</div>
|
|
|
|
<div class="console-output" id="console-output">
|
|
<div class="log-entry">Console logs will appear here...</div>
|
|
</div>
|
|
|
|
<div class="instructions">
|
|
<strong>What to look for in the logs:</strong>
|
|
<ul>
|
|
<li><code>Shot selection - before:</code> - Shows the selection state before the click</li>
|
|
<li><code>Shot selection - clicking row:</code> - Shows which row was clicked and what modifiers were pressed</li>
|
|
<li><code>Shot selection - normal click, setting single selection</code> - Should appear for normal clicks</li>
|
|
<li><code>Shot selection - after:</code> - Shows the selection state after the click</li>
|
|
</ul>
|
|
<p><strong>Issue:</strong> If you see the "normal click" message but the "after" state still has multiple selections, then there's a conflict with TanStack Table's built-in selection.</p>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
let isMonitoring = false;
|
|
let originalConsoleLog = console.log;
|
|
|
|
function startMonitoring() {
|
|
if (isMonitoring) return;
|
|
|
|
isMonitoring = true;
|
|
|
|
// Override console.log to capture shot selection logs
|
|
console.log = function(...args) {
|
|
// Call original console.log
|
|
originalConsoleLog.apply(console, args);
|
|
|
|
// Check if this is a shot selection log
|
|
const message = args.join(' ');
|
|
if (message.includes('Shot selection')) {
|
|
addLogEntry(message);
|
|
}
|
|
};
|
|
|
|
addLogEntry('🟢 Monitoring started - perform shot selection actions now');
|
|
}
|
|
|
|
function stopMonitoring() {
|
|
if (!isMonitoring) return;
|
|
|
|
isMonitoring = false;
|
|
console.log = originalConsoleLog;
|
|
addLogEntry('🔴 Monitoring stopped');
|
|
}
|
|
|
|
function addLogEntry(message) {
|
|
const output = document.getElementById('console-output');
|
|
const entry = document.createElement('div');
|
|
entry.className = 'log-entry';
|
|
|
|
// Style different types of log messages
|
|
if (message.includes('before:')) {
|
|
entry.className += ' log-before';
|
|
} else if (message.includes('clicking row:') || message.includes('normal click')) {
|
|
entry.className += ' log-action';
|
|
} else if (message.includes('after:')) {
|
|
entry.className += ' log-after';
|
|
}
|
|
|
|
entry.textContent = `[${new Date().toLocaleTimeString()}] ${message}`;
|
|
output.appendChild(entry);
|
|
|
|
// Auto-scroll to bottom
|
|
output.scrollTop = output.scrollHeight;
|
|
}
|
|
|
|
function clearLogs() {
|
|
document.getElementById('console-output').innerHTML = '<div class="log-entry">Console logs cleared...</div>';
|
|
}
|
|
|
|
// Auto-start monitoring when page loads
|
|
window.addEventListener('load', () => {
|
|
setTimeout(startMonitoring, 1000);
|
|
});
|
|
</script>
|
|
</body>
|
|
</html> |