Skip to content

Commit

Permalink
temp: injecting SelectableSourceDataAGGrid in the research context di…
Browse files Browse the repository at this point in the history
…alog
  • Loading branch information
alebg committed Sep 10, 2024
1 parent 3e0560a commit 15212d2
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 20 deletions.
34 changes: 15 additions & 19 deletions lib/components/dialog/CreateResearchContextSelectFiles.tsx
Original file line number Diff line number Diff line change
@@ -1,33 +1,29 @@
import { RemoteFile } from "../models";
import { SelectableSourceDataAGGrid } from "../table";
import { SelectableSourceDataRow } from "../table/SelectableSourceDataAGGrid";

export interface CreateResearchContextSelectFilesViewProps {
files: RemoteFile[];
selectFile: (file: RemoteFile) => void;
sourceDataList: SelectableSourceDataRow[];
isLoading: boolean;
handleConfirmSelection: (selectedRows: SelectableSourceDataRow[]) => void;
onNext: () => void;
onPrevious: () => void;
errorOverlayProps?: {
errorStatus: boolean;
overlayText: string;
};
}
export const CreateResearchContextSelectFilesView = (
props: CreateResearchContextSelectFilesViewProps,
) => {
return (
<div>
<p>Select files</p>
<div>
{props.files.map((file) => (
<div key={file.id}>
<input
type="checkbox"
id={file.name}
name={file.name}
value={file.name}
onChange={(e) => {
e.preventDefault();
props.selectFile(file);
}}
/>
<label htmlFor={file.name}>{file.name}</label>
</div>
))}
<SelectableSourceDataAGGrid
rowData={props.sourceDataList}
isLoading={props.isLoading}
handleConfirmSelection={props.handleConfirmSelection}

Check failure on line 24 in lib/components/dialog/CreateResearchContextSelectFiles.tsx

View workflow job for this annotation

GitHub Actions / Test Components (18.16.1)

Delete `·`

Check failure on line 24 in lib/components/dialog/CreateResearchContextSelectFiles.tsx

View workflow job for this annotation

GitHub Actions / Test Components (latest)

Delete `·`
errorOverlayProps={props.errorOverlayProps}
/>
</div>
<button onClick={props.onNext}>Next</button>
<button onClick={props.onPrevious}>Prev</button>
Expand Down
15 changes: 14 additions & 1 deletion stories/components/CreateResearchContextDialog.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,20 @@ export const Success: Story = {
`Submitted: ${researchContextName}, ${researchContextDescription}, ${files}`,
);
},
clientFiles: [],
clientFiles: [
{
id: 1,
name: "File 1",
relativePath: "path/to/file1",
createdAt: "2021-01-01",
},
{
id: 2,
name: "File 2",
relativePath: "path/to/file2",
createdAt: "2021-01-02",
},
],
viewModel: {
status: "success",
researchContext: {
Expand Down

0 comments on commit 15212d2

Please sign in to comment.