Skip to content

Commit

Permalink
Select row when focusing on elements inside (#525)
Browse files Browse the repository at this point in the history
  • Loading branch information
microbit-robert authored Nov 18, 2024
1 parent 96ac700 commit 3bd481a
Showing 1 changed file with 32 additions and 30 deletions.
62 changes: 32 additions & 30 deletions src/components/DataSamplesTableRow.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { GridItem, Text, useDisclosure } from "@chakra-ui/react";
import { Box, GridItem, Text, useDisclosure } from "@chakra-ui/react";
import { FormattedMessage, useIntl } from "react-intl";
import { ActionData } from "../model";
import { useStore } from "../store";
import DataSamplesTableHints from "./DataSamplesTableHints";
import { ConfirmDialog } from "./ConfirmDialog";
import ActionDataSamplesCard from "./ActionDataSamplesCard";
import ActionNameCard from "./ActionNameCard";
import {
ConnectionFlowStep,
useConnectionStage,
} from "../connection-stage-hooks";
import { ActionData } from "../model";
import { useStore } from "../store";
import ActionDataSamplesCard from "./ActionDataSamplesCard";
import ActionNameCard from "./ActionNameCard";
import { ConfirmDialog } from "./ConfirmDialog";
import DataSamplesTableHints from "./DataSamplesTableHints";
import { RecordingOptions } from "./RecordingDialog";

interface DataSamplesTableRowProps {
Expand Down Expand Up @@ -59,31 +59,33 @@ const DataSamplesTableRow = ({
onConfirm={() => deleteAction(action.ID)}
onCancel={deleteConfirmDisclosure.onClose}
/>
<GridItem>
<ActionNameCard
value={action}
onDeleteAction={deleteConfirmDisclosure.onOpen}
onSelectRow={onSelectRow}
selected={selected}
readOnly={false}
/>
</GridItem>
{showHints ? (
<DataSamplesTableHints action={action} onRecord={onRecord} />
) : (
<Box display="contents" onFocusCapture={onSelectRow}>
<GridItem>
{(action.name.length > 0 || action.recordings.length > 0) && (
<ActionDataSamplesCard
newRecordingId={newRecordingId}
value={action}
selected={selected}
onSelectRow={onSelectRow}
onRecord={onRecord}
clearNewRecordingId={clearNewRecordingId}
/>
)}
<ActionNameCard
value={action}
onDeleteAction={deleteConfirmDisclosure.onOpen}
onSelectRow={onSelectRow}
selected={selected}
readOnly={false}
/>
</GridItem>
)}
{showHints ? (
<DataSamplesTableHints action={action} onRecord={onRecord} />
) : (
<GridItem>
{(action.name.length > 0 || action.recordings.length > 0) && (
<ActionDataSamplesCard
newRecordingId={newRecordingId}
value={action}
selected={selected}
onSelectRow={onSelectRow}
onRecord={onRecord}
clearNewRecordingId={clearNewRecordingId}
/>
)}
</GridItem>
)}
</Box>
</>
);
};
Expand Down

0 comments on commit 3bd481a

Please sign in to comment.