- Foldable left panel (user profile) and right panel (task details) - Clicking a task in the list or graph node selects it and shows details - Both views (task list + graph) always mounted via absolute inset-0 for correct canvas dimensions; tabs toggle visibility with opacity - Graph node selection animation: other nodes repel outward (charge -600), then selected node smoothly slides to center (500ms cubic ease-out), then charge restores to -120 and graph stabilizes - Graph re-fits on tab switch and panel resize via ResizeObserver - Fix UUID string IDs throughout (backend returns UUIDs, not integers) - Add TaskDetailPanel, UserPanel components - Add CLAUDE.md project documentation Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
55 lines
1.8 KiB
JavaScript
55 lines
1.8 KiB
JavaScript
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.getUserCodeFrame = getUserCodeFrame;
|
|
// We try to load node dependencies
|
|
let picocolors = null;
|
|
let readFileSync = null;
|
|
let codeFrameColumns = null;
|
|
try {
|
|
const nodeRequire = module && module.require;
|
|
readFileSync = nodeRequire.call(module, 'fs').readFileSync;
|
|
codeFrameColumns = nodeRequire.call(module, '@babel/code-frame').codeFrameColumns;
|
|
picocolors = nodeRequire.call(module, 'picocolors');
|
|
} catch {
|
|
// We're in a browser environment
|
|
}
|
|
|
|
// frame has the form "at myMethod (location/to/my/file.js:10:2)"
|
|
function getCodeFrame(frame) {
|
|
const locationStart = frame.indexOf('(') + 1;
|
|
const locationEnd = frame.indexOf(')');
|
|
const frameLocation = frame.slice(locationStart, locationEnd);
|
|
const frameLocationElements = frameLocation.split(':');
|
|
const [filename, line, column] = [frameLocationElements[0], parseInt(frameLocationElements[1], 10), parseInt(frameLocationElements[2], 10)];
|
|
let rawFileContents = '';
|
|
try {
|
|
rawFileContents = readFileSync(filename, 'utf-8');
|
|
} catch {
|
|
return '';
|
|
}
|
|
const codeFrame = codeFrameColumns(rawFileContents, {
|
|
start: {
|
|
line,
|
|
column
|
|
}
|
|
}, {
|
|
highlightCode: true,
|
|
linesBelow: 0
|
|
});
|
|
return `${picocolors.dim(frameLocation)}\n${codeFrame}\n`;
|
|
}
|
|
function getUserCodeFrame() {
|
|
// If we couldn't load dependencies, we can't generate the user trace
|
|
/* istanbul ignore next */
|
|
if (!readFileSync || !codeFrameColumns) {
|
|
return '';
|
|
}
|
|
const err = new Error();
|
|
const firstClientCodeFrame = err.stack.split('\n').slice(1) // Remove first line which has the form "Error: TypeError"
|
|
.find(frame => !frame.includes('node_modules/')); // Ignore frames from 3rd party libraries
|
|
|
|
return getCodeFrame(firstClientCodeFrame);
|
|
} |