diff --git a/src/App/components/RoutingManager.js b/src/App/components/RoutingManager.js index 6d4d942..0a73033 100644 --- a/src/App/components/RoutingManager.js +++ b/src/App/components/RoutingManager.js @@ -47,6 +47,10 @@ const RoutingManager = (props) => { path={`${CHALLENGE_PAGE}/:challengeId/submit`} element={} /> + } + /> } /> { const rowRender = (elem) => { let RowStyle = Body; - console.log(elem); if (elem.submitter === props.user) RowStyle = Medium; return props.staticColumnElements.map((elemName, i) => { return ( diff --git a/src/pages/Challenge/Challenge.js b/src/pages/Challenge/Challenge.js index 5f58272..f21152b 100644 --- a/src/pages/Challenge/Challenge.js +++ b/src/pages/Challenge/Challenge.js @@ -17,6 +17,7 @@ import getChallengeInfo from '../../api/getChallengeInfo'; import Loading from '../../components/generic/Loading'; import getUser from '../../api/getUser'; import AllEntries from '../AllEntries/AllEntries'; +import NewTablePageTest from '../NewTable/NewTablePageTest'; const Challenge = (props) => { const challengeName = useParams().challengeId; @@ -64,6 +65,8 @@ const Challenge = (props) => { return ; case CHALLENGE_SECTIONS.SUBMIT: return ; + case 7: + return ; default: return ( + backgroundColor ? backgroundColor : theme.colors.white}; */ +`; + +const Td = styled.td` + padding: 0 0 32px 0; + /* background-color: ${({ theme, backgroundColor }) => + backgroundColor ? backgroundColor : theme.colors.white}; */ +`; + +const TableLine = styled(FlexRow)` + position: absolute; + top: ${({ top }) => (top ? top : 'auto')}; + bottom: ${({ bottom }) => (bottom ? bottom : 'auto')}; + left: 0; + width: 100%; + background-color: ${({ theme }) => theme.colors.dark04}; + height: ${({ height }) => (height ? height : '1px')}; +`; + +const NewTable = ({ items, orderedKeys }) => { + return ( + + + {orderedKeys.map((key) => { + return ; + })} + + + {items.map((item, i) => { + return ( + + {orderedKeys.map((key) => { + return ; + })} + + tagi tagi tagi tagi + edytuj usuń + + + + ); + })} +
{key}
{item[key]}
+ ); +}; + +export default NewTable; diff --git a/src/pages/NewTable/NewTablePageTest.js b/src/pages/NewTable/NewTablePageTest.js new file mode 100644 index 0000000..68a154a --- /dev/null +++ b/src/pages/NewTable/NewTablePageTest.js @@ -0,0 +1,72 @@ +import React from 'react'; +import { FlexColumn } from '../../utils/containers'; +import { H2 } from '../../utils/fonts'; +import Pager from '../../components/generic/Pager'; +import Search from '../../components/generic/Search'; +import getAllEntries from '../../api/getAllEntries'; +import NewTable from './NewTable'; + +const orderedKeys = [ + 'id', + 'submitter', + 'Accuracy-dev-0', + 'Likelihood-dev-0', + 'Accuracy-dev-1', + 'Likelihood-dev-1', + 'Accuracy-test-A', + 'Likelihood-test-A', + 'when', +]; + +const tableItems = [ + { + id: '7962', + submitter: 'wirus wirus', + 'Accuracy-dev-0': '0.68248', + 'Likelihood-dev-0': '0.00000', + 'Accuracy-dev-1': '0.65028', + 'Likelihood-dev-1': '0.00000', + 'Accuracy-test-A': '0.65503', + 'Likelihood-test-A': '0.00000', + when: '2023-01-05 21:47', + }, + { + id: '7371', + submitter: 'Kamil Guttmann', + 'Accuracy-dev-0': '0.68248', + 'Likelihood-dev-0': '0.00000', + 'Accuracy-dev-1': '0.67544', + 'Likelihood-dev-1': '0.00000', + 'Accuracy-test-A': '0.67034', + 'Likelihood-test-A': '0.00000', + when: '2023-01-05 21:47', + }, +]; + +const NewTablePageTest = (props) => { + const [entriesFromApi, setEntriesFromApi] = React.useState([]); + const [entriesAll, setEntriesAll] = React.useState([]); + + React.useEffect(() => { + if (props.challengeName) challengeDataRequest(props.challengeName); + }, [props.challengeName]); + + const challengeDataRequest = (challengeName) => { + getAllEntries(challengeName, setEntriesFromApi, setEntriesAll); + }; + console.log(entriesFromApi); + console.log(entriesAll); + + return ( + +

+ New Table Test +

+ console.log('siema')} /> + + +
+ ); +}; + +export default NewTablePageTest; diff --git a/src/pages/NewTable/index.js b/src/pages/NewTable/index.js new file mode 100644 index 0000000..6e70016 --- /dev/null +++ b/src/pages/NewTable/index.js @@ -0,0 +1 @@ +export { default } from './NewTablePageTest';