Skip to content

Commit

Permalink
Merge pull request #20 from DiSSCo/ImplementTaxonomicServiceForm
Browse files Browse the repository at this point in the history
Implement taxonomic service form
  • Loading branch information
TomDijkema authored Oct 24, 2024
2 parents 9a91bc9 + 7c03bc0 commit dfbd738
Show file tree
Hide file tree
Showing 22 changed files with 1,703 additions and 31 deletions.
155 changes: 151 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"bootstrap-css": "^4.0.0-alpha.5",
"formik": "^2.4.5",
"json-schema-to-typescript": "^13.1.2",
"jsonpath": "^1.1.1",
"lodash": "^4.17.21",
"markdown-it": "^14.1.0",
"moment": "^2.30.1",
Expand All @@ -40,6 +41,7 @@
"@testing-library/jest-dom": "^6.4.6",
"@testing-library/react": "^16.0.0",
"@testing-library/user-event": "^14.5.2",
"@types/jsonpath": "^0.2.4",
"@types/markdown-it": "^14.1.2",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
Expand Down
4 changes: 4 additions & 0 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,10 @@ p {
border: 1px solid var(--primary);
}

.b-grey {
border: 1px solid var(--grey);
}

.b-none {
border: none;
}
Expand Down
13 changes: 13 additions & 0 deletions src/app/Types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,19 @@ export type Filter = {
}[]
};

/* Type for a form field */
export type FormField = {
jsonPath: string,
title: string,
description: string,
type: string,
options?: string[],
mapping?: {
[option: string]: string
},
required?: boolean
};

/* Type for a Dropdown item */
export type DropdownItem = {
label: string,
Expand Down
4 changes: 2 additions & 2 deletions src/app/types/TaxonomicService.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ export interface TaxonomicService {
* A unique identifier to identify the author; ORCID identifiers are valid
*/
"schema:identifier": string;
"schema:affiliation": {
"schema:Affiliation"?: {
/**
* The type of the affiliation
*/
Expand Down Expand Up @@ -324,7 +324,7 @@ export interface TaxonomicService {
/**
* The organisation the maintainer is affiliated with
*/
"schema:affiliation": {
"schema:Affiliation"?: {
/**
* The type of the affiliation
*/
Expand Down
33 changes: 33 additions & 0 deletions src/components/general/formElements/InputField.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/* Import Dependencies */
import { Field } from "formik";


/* Props Type */
type Props = {
name: string,
title: string
};


/**
* Component that renders an input field for a free text insert
* @param name The name of the form field
* @param title The title that should be displayed along the form field
* @returns JSX Component
*/
const InputField = (props: Props) => {
const { name, title } = props;

return (
<div>
<p>
{title}
</p>
<Field name={name}
className="w-100"
/>
</div>
);
};

export default InputField;
8 changes: 3 additions & 5 deletions src/components/search/components/TopBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import classNames from 'classnames';
import { useState, useRef } from 'react';
import { useSearchParams } from 'react-router-dom';
import { useSearchParams, useNavigate } from 'react-router-dom';
import { Row, Col } from 'react-bootstrap';

/* Import Hooks */
Expand All @@ -25,6 +25,7 @@ import { Button } from 'components/general/CustomComponents';
const TopBar = () => {
/* Hooks */
const [searchParams] = useSearchParams();
const navigate = useNavigate();

/* Base variables */
const [filtersToggle, setFiltersToggle] = useState<boolean>(false);
Expand Down Expand Up @@ -76,10 +77,7 @@ const TopBar = () => {
<Button type="button"
variant={searchParams.get('serviceType') === 'referenceCollection' ? 'secondary' : 'primary'}
className="fs-5 fs-lg-4"
OnClick={() => window.open('https://docs.google.com/forms/d/e/1FAIpQLSf6ug3jMZnZaZrP0WYv7GgFvnn06QIdi2GFekEqynwsoTCfUQ/viewform?usp=sf_link',
'_blank',
'noopener'
)}
OnClick={() => navigate('/ts/suggestNewTaxonomicService')}
>
Suggest a new service
</Button>
Expand Down
4 changes: 3 additions & 1 deletion src/components/taxonomicService/Routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ import { Route } from "react-router-dom";

/* Import Components */
import TaxonomicService from "./TaxonomicService";
import TaxonomicServiceForm from "./TaxonomicServiceForm";


/* Routes associated with the Taxonomic Service page */
const routes = [
<Route key="taxonomicService" path="/ts/:prefix/:suffix" element={<TaxonomicService />} />
<Route key="taxonomicService" path="/ts/:prefix/:suffix" element={<TaxonomicService />} />,
<Route key="taxonomicServiceForm" path="/ts/suggestNewTaxonomicService" element={<TaxonomicServiceForm />} />
];

export default routes;
Loading

0 comments on commit dfbd738

Please sign in to comment.