Commit 77cde973 authored by José Pereira's avatar José Pereira
Browse files

KEGGMaps Acordeon, BUT doenst actualize the state

parent 416b990b
......@@ -16,7 +16,8 @@
.main {
margin-top: 32px;
width: 100%;
max-width: 600px;
max-width: 1000px;
margin-right: 1rem;
}
.form {
......
......@@ -4,7 +4,7 @@ import { keggMaps } from '../utils/keggMaps'
import React from "react";
const KeggMapsAccordion = ({ keggMapList, onChange }) => {
console.log(keggMapList)
const handleCheck = value => {
const newList = [...keggMapList]
......
......@@ -7,9 +7,60 @@ import Accordion from "../components/Accordion";
import { file } from 'jszip';
import { Autorenew } from '@material-ui/icons';
import ImageZoom from 'react-medium-image-zoom'
import LabelledCheckbox from '../components/LabelledCheckbox';
import KeggMaps from './keggmaps';
const Main = ({outputsFiles}) =>{
const keggNames = outputsFiles.map((name)=>{
return(name.name)
})
let show = false;
const [selected, setSelected] = useState([]); //state n funciona, necessa´rio para renderizar de novo a página
const accordionKeggMaps = () =>{
const isTrue = (array) =>{
if(array.length > 6){
alert('Choose less KEGGMaps to displat for a better performance')
}else{
show = true
}
}
const handleCheck = value => {
const newList = selected
const index = newList.indexOf(value)
if (index > -1) {
alert()
newList.splice(index, 1)
} else {
newList.push(value)
}
console.log(newList)
setSelected(newList)
console.log(selected)
}
export const KEGGMapsResults = ({ outputsFiles }) => {
return(
<div>
<Accordion title = 'KeggMaps Results'>
{keggNames.map((index) =>(
<LabelledCheckbox
key = {index[0]}
label = {index[1]}
checked = {selected.indexOf(index[1]) > -1}
setChecked={() => handleCheck(index[1])}/>
))}
</Accordion>
<Button
variant='contained'
color='primary'
component="label"
onClick = {isTrue(selected)}>
Click to view the KEGGMaps
</Button>
</div>
)
}
const getJsxFromFiles = (files) => {
let blobNumber = 0;
......@@ -26,12 +77,32 @@ export const KEGGMapsResults = ({ outputsFiles }) => {
</div>
})
}
const badjoras = ()=>{
if(show == false){
return(accordionKeggMaps)
}else{
//Ver quais é que estão selecionados e mostra-los
}
}
const KEGGChange = badjoras()
return(
<>
<div>
<KEGGChange/>
</div>
</>
)
}
export const KEGGMapsResults = ({ outputsFiles }) => {
return (
<DashboardLayout>
<h1>Teste</h1>
{getJsxFromFiles(outputsFiles)}
<Main
outputsFiles = {outputsFiles}
/>
</DashboardLayout>
)
}
\ No newline at end of file
......@@ -50,7 +50,9 @@ async function ObtainBlobArray(event){
}
if(entries[i].filename.includes('KEGGMaps')){
const blobKEGGMaps = await entries[i].getData(new zip.BlobWriter(['image/png']))
KEGGMapsResults.push(blobKEGGMaps)
let keggMaps = treatName(entries[i].filename)
let number = KEGGMapsResults.length
KEGGMapsResults.push({name:[number,keggMaps],blob:blobKEGGMaps})
}
if(entries[i].filename.includes('Assembly')){
......@@ -68,6 +70,7 @@ async function ObtainBlobArray(event){
const fileUrl = URL.createObjectURL(config)
$.getJSON(fileUrl, function(json){
configFile = json
console.log(configFile)
})
}
if(entries[i].filename.includes('experiments')){
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment