Task attempt 5b1ff1ea-5eac-4b84-9ce5-c94932e6d99a - Final changes

This commit is contained in:
Louis Knight-Webb
2025-06-22 21:31:18 +01:00
parent 4c87c4ffe6
commit 053d5513d6
2 changed files with 13 additions and 14 deletions

View File

@@ -1,4 +1,5 @@
import { useState, useEffect, useMemo } from "react";
import { Link } from "react-router-dom";
import {
X,
History,
@@ -608,18 +609,15 @@ export function TaskDetailsPanel({
<Code className="h-4 w-4 mr-1" />
Editor
</Button>
<Button
variant="outline"
size="sm"
onClick={() =>
window.open(
`/projects/${projectId}/tasks/${task.id}/attempts/${selectedAttempt.id}/compare`,
"_blank"
)
}
>
<FileText className="h-4 w-4 mr-1" />
Changes
<Button variant="outline" size="sm" asChild>
<Link
to={`/projects/${projectId}/tasks/${task.id}/attempts/${selectedAttempt.id}/compare`}
target="_blank"
rel="noopener noreferrer"
>
<FileText className="h-4 w-4 mr-1" />
Changes
</Link>
</Button>
</div>
)}

View File

@@ -1,5 +1,5 @@
import { useEffect, useCallback } from 'react';
import { useNavigate } from 'react-router-dom';
import { useNavigate, useLocation } from 'react-router-dom';
// Define available keyboard shortcuts
export interface KeyboardShortcut {
@@ -16,6 +16,7 @@ export interface KeyboardShortcutContext {
openCreateTask?: () => void;
currentPath?: string;
hasOpenDialog?: boolean;
location?: ReturnType<typeof useLocation>;
}
// Centralized shortcut definitions
@@ -32,7 +33,7 @@ export const createKeyboardShortcuts = (context: KeyboardShortcutContext): Recor
// Otherwise, navigate back
if (context.navigate) {
const currentPath = context.currentPath || window.location.pathname;
const currentPath = context.currentPath || context.location?.pathname || '/';
// Navigate back based on current path
if (currentPath.includes('/attempts/') && currentPath.includes('/compare')) {