import React, { useState } from 'react'; import InputField from "./InputField" import Section from "./Section" import Instructions from './Instructions' import ReactMarkdown from "react-markdown"; import {save} from 'save-file' function App() { const [fieldFocussed, setFieldFocussed] = useState() const [card, setCard] = useState({}) const [tagsSection, setTagsSection] = useState(false) const [urlsSection, setUrlsSection] = useState(false) const [datasetDescriptionSection, setDatasetDescriptionSection] = useState(false) const [datasetStructureSection, setDatasetStructureSection] = useState(false) const [datasetCreationSection, setDatasetCreationSection] = useState(false) const [considerationsSection, setConsiderationsSection] = useState(false) const [additionalInformationSection, setAdditionalInformationSection] = useState(false) async function handleClick(e){ setFieldFocussed(e.target.id) } async function handleChange(e){ setCard({...card, [e.target.id]:e.currentTarget.value}) } async function handleTagsSection(){ setAdditionalInformationSection(false) setConsiderationsSection(false) setDatasetCreationSection(false) setDatasetStructureSection(false) setDatasetDescriptionSection(false) setUrlsSection(false) setTagsSection(!tagsSection) } async function handleUrlsSection(){ setAdditionalInformationSection(false) setConsiderationsSection(false) setDatasetCreationSection(false) setDatasetStructureSection(false) setDatasetDescriptionSection(false) setTagsSection(false) setUrlsSection(!urlsSection) } async function handleDatasetDescriptionSection(){ setAdditionalInformationSection(false) setConsiderationsSection(false) setDatasetCreationSection(false) setDatasetStructureSection(false) setTagsSection(false) setUrlsSection(false) setDatasetDescriptionSection(!datasetDescriptionSection) } async function handleDatasetStructureSection(){ setAdditionalInformationSection(false) setConsiderationsSection(false) setDatasetCreationSection(false) setDatasetDescriptionSection(false) setTagsSection(false) setUrlsSection(false) setDatasetStructureSection(!datasetStructureSection) } async function handleDatasetCreationSection(){ setAdditionalInformationSection(false) setConsiderationsSection(false) setDatasetDescriptionSection(false) setTagsSection(false) setUrlsSection(false) setDatasetStructureSection(false) setDatasetCreationSection(!datasetCreationSection) } async function handleConsiderationsSection(){ setAdditionalInformationSection(false) setDatasetDescriptionSection(false) setTagsSection(false) setUrlsSection(false) setDatasetStructureSection(false) setDatasetCreationSection(false) setConsiderationsSection(!considerationsSection) } async function handleAdditionalInformationSection(){ setDatasetDescriptionSection(false) setTagsSection(false) setUrlsSection(false) setDatasetStructureSection(false) setDatasetCreationSection(false) setConsiderationsSection(false) setAdditionalInformationSection(!additionalInformationSection) } async function exportFile(card){ var textTest = ` ${card.yamlTags} # Dataset Card for ${card.datasetName} ## Table of Contents - [Dataset Description](#dataset-description) - [Dataset Summary](#dataset-summary) - [Supported Tasks](#supported-tasks-and-leaderboards) - [Languages](#languages) - [Dataset Structure](#dataset-structure) - [Data Instances](#data-instances) - [Data Fields](#data-instances) - [Data Splits](#data-instances) - [Dataset Creation](#dataset-creation) - [Curation Rationale](#curation-rationale) - [Source Data](#source-data) - [Annotations](#annotations) - [Personal and Sensitive Information](#personal-and-sensitive-information) - [Considerations for Using the Data](#considerations-for-using-the-data) - [Social Impact of Dataset](#social-impact-of-dataset) - [Discussion of Biases](#discussion-of-biases) - [Other Known Limitations](#other-known-limitations) - [Additional Information](#additional-information) - [Dataset Curators](#dataset-curators) - [Licensing Information](#licensing-information) - [Citation Information](#citation-information) ## Dataset Description - **Homepage:** ${card.homepage} - **Repository:** ${card.repository} - **Paper:** ${card.paper} - **Leaderboard:** ${card.leaderboard} - **Point of Contact:** ${card.contact} ### Dataset Summary ${card.datasetSummary} ### Supported Tasks and Leaderboards ${card.supportedTasks} ### Languages ${card.languages} ## Dataset Structure ### Data Instances ${card.dataInstances} ### Data Fields ${card.dataFields} ### Data Splits ${card.dataSplits} ## Dataset Creation ### Curation Rationale ${card.curationRationale} ### Source Data #### Initial Data Collection and Normalization ${card.dataCollection} #### Who are the source language producers? ${card.sourceLanguage} ### Annotations #### Annotation process ${card.annotationProcess} #### Who are the annotators? ${card.annotators} ### Personal and Sensitive Information ${card.personalInformation} ## Considerations for Using the Data ### Social Impact of Dataset ${card.socialImpact} ### Discussion of Biases ${card.biasesDiscussion} ### Other Known Limitations ${card.limitations} ## Additional Information ### Dataset Curators ${card.datasetCurators} ### Licensing Information ${card.licensingInformation} ### Citation Information ${card.citationInformation} ` await save(textTest, "README.md") } return (

New Dataset Card for handleChange(e)} id="datasetName" placeholder="dataset name" maxLength="200" className="ml-4 py-4 text-4xl text-gray-600 w-80 border border-solid border-gray-200 border-none h-10 rounded-md shadow" />

Fill in the form below

{tagsSection && }
{urlsSection && <> }
{datasetDescriptionSection && <> }
{datasetStructureSection && <> }
{datasetCreationSection && <> }
{considerationsSection && <> }
{additionalInformationSection && <> }

Information

{!fieldFocussed &&

Click on a field to see instructions/example

}

Instructions

{Instructions.instructions[fieldFocussed] && Instructions.instructions[fieldFocussed].paragraph.map((para) => ( ))}

Example

{Instructions.instructions[fieldFocussed] && Instructions.instructions[fieldFocussed].example.map((ex) => ( ))}
); } export default App;