-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: create automatic assignment panel UI
experimental feature
- Loading branch information
1 parent
8cd0bd2
commit 2307c82
Showing
3 changed files
with
101 additions
and
0 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
src/component/panels/AutomaticAssignment/AutomaticAssignment.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/** @jsxImportSource @emotion/react */ | ||
import { SvgNmrAssignment2 } from 'cheminfo-font'; | ||
import { useCallback } from 'react'; | ||
|
||
import Button from '../../elements/ButtonToolTip'; | ||
import { tablePanelStyle } from '../extra/BasicPanelStyle'; | ||
import DefaultPanelHeader from '../header/DefaultPanelHeader'; | ||
|
||
function AutomaticAssignment() { | ||
// eslint-disable-next-line @typescript-eslint/no-empty-function | ||
const automaticAssignmentHandler = useCallback(() => {}, []); | ||
|
||
return ( | ||
<div css={tablePanelStyle}> | ||
{ | ||
<DefaultPanelHeader showSettingButton={false} canDelete={false}> | ||
<Button | ||
popupTitle="automatic assignment" | ||
onClick={automaticAssignmentHandler} | ||
> | ||
<SvgNmrAssignment2 style={{ fontSize: '18px' }} /> | ||
</Button> | ||
</DefaultPanelHeader> | ||
} | ||
|
||
<div className="inner-container" /> | ||
</div> | ||
); | ||
} | ||
|
||
export default AutomaticAssignment; |
62 changes: 62 additions & 0 deletions
62
src/component/panels/AutomaticAssignment/AutomaticAssignmentTable.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { SvgNmrAssignment } from 'cheminfo-font'; | ||
import { useCallback, useMemo, memo } from 'react'; | ||
|
||
import ReactTable from '../../elements/ReactTable/ReactTable'; | ||
import { CustomColumn } from '../../elements/ReactTable/utility/addCustomColumn'; | ||
import NoTableData from '../extra/placeholder/NoTableData'; | ||
|
||
interface AutomaticAssignmentTableProps { | ||
data: any; | ||
} | ||
|
||
function PeaksTable({ data }: AutomaticAssignmentTableProps) { | ||
const assignHandler = useCallback((e, row) => { | ||
e.preventDefault(); | ||
e.stopPropagation(); | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
const params = row.original; | ||
}, []); | ||
|
||
const COLUMNS: CustomColumn[] = useMemo( | ||
() => [ | ||
{ | ||
index: 1, | ||
Header: '#', | ||
Cell: ({ row }) => row.index + 1, | ||
style: { width: '1%', maxWidth: '40px', minWidth: '40px' }, | ||
}, | ||
{ | ||
index: 2, | ||
Header: 'Score', | ||
}, | ||
{ | ||
index: 3, | ||
Header: '', | ||
style: { | ||
width: '1%', | ||
maxWidth: '24px', | ||
minWidth: '24px', | ||
}, | ||
id: 'assign-button', | ||
Cell: ({ row }) => ( | ||
<button | ||
type="button" | ||
className="assign-button" | ||
onClick={(e) => assignHandler(e, row)} | ||
> | ||
<SvgNmrAssignment /> | ||
</button> | ||
), | ||
}, | ||
], | ||
[assignHandler], | ||
); | ||
|
||
return data && data.length > 0 ? ( | ||
<ReactTable data={data} columns={COLUMNS} /> | ||
) : ( | ||
<NoTableData /> | ||
); | ||
} | ||
|
||
export default memo(PeaksTable); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters