diff --git a/src/assets/check_ico.svg b/src/assets/check_ico.svg new file mode 100644 index 0000000..e29170b --- /dev/null +++ b/src/assets/check_ico.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/components/generic/CodeShell.js b/src/components/generic/CodeShell.js index 9172ac0..65b96cc 100644 --- a/src/components/generic/CodeShell.js +++ b/src/components/generic/CodeShell.js @@ -3,7 +3,8 @@ import {FlexColumn, Svg} from '../../utils/containers'; import styled from 'styled-components'; import theme from '../../utils/theme'; import copyIco from '../../assets/copy_ico.svg'; -import {Code} from '../../utils/fonts'; +import checkIco from '../../assets/check_ico.svg'; +import {Body, Code} from '../../utils/fonts'; const CodeShellStyle = styled(FlexColumn)` position: relative; @@ -14,6 +15,7 @@ const CodeShellStyle = styled(FlexColumn)` border-radius: 4px; width: 100%; align-items: flex-start; + max-width: ${({maxWidth}) => maxWidth ? maxWidth : 'none'}; @media (min-width: ${({theme}) => theme.overMobile}) { gap: 12px; @@ -21,21 +23,48 @@ const CodeShellStyle = styled(FlexColumn)` } `; +const CopiedMessageStyle = styled(Body)` + font-size: 16px; + position: absolute; + top: -24px; + right: -10px; + background-color: ${({theme}) => theme.colors.green}; + color: ${({theme}) => theme.colors.white}; + border-radius: 4px; + padding: 6px; +`; + const CodeShell = (props) => { + const [ico, setIco] = React.useState(copyIco); + + const clickCopyButton = () => { + let commands = ''; + if (props.commands.length > 1) { + for (let command of props.commands) + commands += command + '\n'; + } + navigator.clipboard.writeText(commands).then(r => console.log(r)); + setIco(checkIco); + setTimeout(() => { + setIco(copyIco); + }, 3000); + }; + const formatCommand = (command) => { if (command[0] === '\t') { return <>    {formatCommand(command.slice(1))}; /* eslint-disable */ } else if (command[0] === '\s') { return <> {formatCommand(command.slice(1))}; - } return command; + } + return command; }; const renderCommands = () => { return ( props.commands.map((command, index) => { return ( - {formatCommand(command)} @@ -45,9 +74,10 @@ const CodeShell = (props) => { }; return ( - + + backgroundColor={theme.colors.white} src={ico} onClick={clickCopyButton}/> + {ico === checkIco ? copied! : ''} {renderCommands()} ); diff --git a/src/components/specific_challenge/HowTo.js b/src/components/specific_challenge/HowTo.js index e81f75a..fc74ab8 100644 --- a/src/components/specific_challenge/HowTo.js +++ b/src/components/specific_challenge/HowTo.js @@ -6,12 +6,14 @@ import CodeShell from '../generic/CodeShell'; import cubeIcon from '../../assets/cube_ico.svg'; import theme from '../../utils/theme'; import {IS_MOBILE} from '../../utils/globals'; +import Media from 'react-media'; const HowTo = () => { return ( - + gap={IS_MOBILE() ? '24px' : '48px'} alignmentX={IS_MOBILE() ? 'flex-start' : 'center'} + maxWidth={IS_MOBILE() ? '668px' : 'none'}> +

Get challenge repo

@@ -19,7 +21,7 @@ const HowTo = () => { You need to create empty repo with name: - + yourID/challengeName @@ -38,17 +40,18 @@ const HowTo = () => { Make sure Gonito.net has access to your repo (e.g. by making it public).
- +

Work on your solution

- You need to generate your solution for the test set as test-A/out.tsv. It is also + You need to generate your solution for the test set as test-A/out.tsv. It + is also recommended to - generate the output for the dev set (dev-0/out.tsv). + generate the output for the dev set (dev-0/out.tsv). - You can evaluate results for the dev set locally by geval. + You can evaluate results for the dev set locally by geval.

@@ -58,7 +61,7 @@ const HowTo = () => { commands={['wget https://gonito.net/get/bin/geval', 'chmod u+x geval', './geval --help']}/> - +

Push your solution

@@ -79,153 +82,293 @@ const HowTo = () => { `git commit -m 'my brilliant solution'`, 'git push origin my-brilliant-branch']}/>
- -

- Submit solution to Gonito -

- -

- Manual submission -

- - In case other methods fail, you can submit your solution manually — go to the submit - form. - + + +

+ Submit solution to Gonito +

+ +

+ Manual submission +

+ + In case other methods fail, you can submit your solution manually — go to the submit + form. + +
+ +

+ Integration with external repos +

+ + If you use an external repo (e.g. at your own of Gitolite or at GitLab/GitHub), you can + configure a webhook. + +
- -

- Integration with external repos -

- - If you use an external repo (e.g. at your own of Gitolite or at GitLab/GitHub), you can - configure a webhook. - -
- -

- Submission metadata -

- - Gonito can take the metadata (description, tags, parameters) of a submission from a number of - sources (in order of precedence): - - - - - The YAML files specified in the param-files field of the gonito.yaml file + + +

+ Submission metadata +

+ + Gonito can take the metadata (description, tags, parameters) of a submission from a + number + of + sources (in order of precedence): -
- - - - only applicable for parameters - - - - - - gonito.yaml will be always skipped even if matches a mask given in the - param-files field, - - - - - - parameters blacklisted in the unwanted-params field of the gonito.yaml file will be - discarded, - - - - - - Gonito.yaml file committed to the repository, - - - - - - description given in the description field, - - - - - - tags given in tags field, - - - - - - parameters given in params field, - - - - - - Names of output files (only for parameters) - - - - - - e.g. if the output file - is out-epochs=10, learning-rate=0.01, then parameters - epochs=10 and learning-rare=0.01 will be extracted; - - - - - - Submission form (when submitting manually) - - - - - - Git commit message - - - - - - description taken from the first paragraph - - - - - - tags taken from a line starting with tags: - - - - Here is an example of gonito.yaml, in which all metadata could be given (note - that you can also - add links to external resources using the `links` section): - - - - It might seem a little bit complicated, but you could simply use the method which is the most - convenient for you. - -
+ + + + The YAML files specified in the param-files field of the gonito.yaml file + + + + + + only applicable for parameters + + + + + + gonito.yaml will be always skipped even if matches a mask + given in the + param-files field, + + + + + + parameters blacklisted in the unwanted-params field of the gonito.yaml file will be + discarded, + + + + + + Gonito.yaml file committed to the repository, + + + + + + description given in the description field, + + + + + + tags given in tags field, + + + + + + parameters given in params field, + + + + + + Names of output files (only for parameters) + + + + + + e.g. if the output file + is out-epochs=10, learning-rate=0.01, then parameters + epochs=10 and learning-rare=0.01 will be extracted; + + + + + + Submission form (when submitting manually) + + + + + + Git commit message + + + + + + description taken from the first paragraph + + + + + + tags taken from a line starting with tags: + + + +
+ + + + +

+ Submission metadata +

+ + Gonito can take the metadata (description, tags, parameters) of a submission from a + number + of + sources (in order of precedence): + +
+ + + + + + The YAML files specified in the param-files field of the gonito.yaml file + + + + + + only applicable for parameters + + + + + + gonito.yaml will be always skipped even if matches a + mask given + in + the + param-files field, + + + + + + parameters blacklisted in the unwanted-params field of the gonito.yaml file will + be + discarded, + + + + + + Gonito.yaml file committed to the repository, + + + + + + description given in the description field, + + + + + + tags given in tags field, + + + + + + parameters given in params field, + + + + + + Names of output files (only for parameters) + + + + + + e.g. if the output file + is out-epochs=10, learning-rate=0.01, then + parameters + epochs=10 and learning-rare=0.01 will be + extracted; + + + + + + Submission form (when submitting manually) + + + + + + Git commit message + + + + + + description taken from the first paragraph + + + + + + tags taken from a line starting with tags: + + + + + +
+
); diff --git a/src/components/specific_challenge/Table.js b/src/components/specific_challenge/Table.js index 761c3c3..66f837f 100644 --- a/src/components/specific_challenge/Table.js +++ b/src/components/specific_challenge/Table.js @@ -67,9 +67,9 @@ const Table = (props) => { return ( - + {props.headerElements.map((elem, i) => { return ( { ); })} - + {elementsToMap.map((elem, index) => { return ( diff --git a/src/pages/Challenge.js b/src/pages/Challenge.js index 13f8f5d..114f182 100644 --- a/src/pages/Challenge.js +++ b/src/pages/Challenge.js @@ -62,7 +62,7 @@ const Challenge = (props) => { return ( <> - +