-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from michaelwenk/dev-frontend
Added annotation data in frontend & fixed wrong localhost and port in vite preview
- Loading branch information
Showing
17 changed files
with
181 additions
and
81 deletions.
There are no files selected for viewing
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
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
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
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
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
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,20 @@ | ||
.AnnotationTable { | ||
overflow: scroll; | ||
|
||
table { | ||
width: 100%; | ||
height: 100%; | ||
text-align: center; | ||
|
||
thead th { | ||
position: sticky; | ||
position: -webkit-sticky; | ||
top: 0; | ||
background: lightgrey; | ||
} | ||
|
||
.auto-height { | ||
height: 100%; | ||
} | ||
} | ||
} |
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,58 @@ | ||
import './AnnotationTable.scss'; | ||
|
||
import { useMemo } from 'react'; | ||
import PeakAnnotation from '../../types/peak/PeakAnnotation'; | ||
|
||
type InputProps = { | ||
annotation: PeakAnnotation; | ||
width?: number | string; | ||
height?: number | string; | ||
}; | ||
|
||
function AnnotationTable({ | ||
annotation, | ||
width = '100%', | ||
height = 400, | ||
}: InputProps) { | ||
const annotationTable = useMemo(() => { | ||
const numHeaders = annotation.header.length; | ||
const numPeaks = annotation.values[0].length; | ||
|
||
const headerContent = ( | ||
<tr key={'anno-header'}> | ||
{annotation.header.map((h) => ( | ||
<th key={'anno-header-' + h}>{h.split('_').join(' ')}</th> | ||
))} | ||
</tr> | ||
); | ||
|
||
const bodyContent: JSX.Element[] = []; | ||
for (let i = 0; i < numPeaks; i++) { | ||
const rows: JSX.Element[] = []; | ||
for (let h = 0; h < numHeaders; h++) { | ||
rows.push( | ||
<td key={'anno-row-' + i + '-' + h}>{annotation.values[h][i]}</td>, | ||
); | ||
} | ||
bodyContent.push(<tr key={'anno-row-' + i}>{rows}</tr>); | ||
} | ||
|
||
return ( | ||
<table> | ||
<thead>{headerContent}</thead> | ||
<tbody> | ||
{bodyContent} | ||
<tr className="auto-height" /> | ||
</tbody> | ||
</table> | ||
); | ||
}, [annotation]); | ||
|
||
return ( | ||
<div className="AnnotationTable" style={{ width, height }}> | ||
{annotationTable} | ||
</div> | ||
); | ||
} | ||
|
||
export default AnnotationTable; |
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
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
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
Oops, something went wrong.