This Pull Request updates the whole application to make use of Type Script in order to make the Javascript code strongly typed and help with type indications in code. Basically it becomes to indicate types of variables when programming and should help future contributors understand the code.
For the implementation of Type Script a general file containing all common types has been created. Types like: User, Specimen, DigitalMedia and Annotation are imported frequently and form the basis for a lot of the content. Other, less significant types, like element props, have been integrated into the code itself.
Apart from Type Script, has every file of the application been revised in order to make some quality of life changes with newer, more efficient learnt techniques. For example: a Redux Store has been integrated into the application which can hold primary scoped states which relieves a lot of components from setting loads of props to children and have the advantage to be callable and mutable from every location. Example: when landing on the Specimen Page, it will look if there is an active specimen in the specimen slice of the store, if not it will grab the specimen from the database and store it, able to persist it through navigating to other pages. Only a refresh causes the Redux store to be reconfigured.
All API functions have been transformed to asynchronous functions which return a promise. The promise can be fetched by the component that called on the API function to extract the returned data. This method gets rid of all the callbacks in the code which makes it more fluent and readable from top to bottom. Additionally, all functions have been transformed to arrow functions (example: function functionName() {} now is: const functionName = () => {}.
Introduced more comments in the code to explain what is happening. Also to split up the import statements by their respective source.
Changed the templates' folder name to: components. Changed the order of components recurring in folders: instead of using a 'body' in between the parent and child components, primary child components are now imported into the parent component which also includes most overarching functionality. Otherwise, specific functionality for components has been tried to keep to the child components them self.
The Annotate Modal has been refined even more to the point it can almost be imported at any point of the code, as long as there is a valid object (specimen, digitalMedia) to be annotated.
This update still needs some patches to resolve minor issues.
The Type Script Update:
This Pull Request updates the whole application to make use of Type Script in order to make the Javascript code strongly typed and help with type indications in code. Basically it becomes to indicate types of variables when programming and should help future contributors understand the code.
For the implementation of Type Script a general file containing all common types has been created. Types like: User, Specimen, DigitalMedia and Annotation are imported frequently and form the basis for a lot of the content. Other, less significant types, like element props, have been integrated into the code itself.
Apart from Type Script, has every file of the application been revised in order to make some quality of life changes with newer, more efficient learnt techniques. For example: a Redux Store has been integrated into the application which can hold primary scoped states which relieves a lot of components from setting loads of props to children and have the advantage to be callable and mutable from every location. Example: when landing on the Specimen Page, it will look if there is an active specimen in the specimen slice of the store, if not it will grab the specimen from the database and store it, able to persist it through navigating to other pages. Only a refresh causes the Redux store to be reconfigured.
All API functions have been transformed to asynchronous functions which return a promise. The promise can be fetched by the component that called on the API function to extract the returned data. This method gets rid of all the callbacks in the code which makes it more fluent and readable from top to bottom. Additionally, all functions have been transformed to arrow functions (example: function functionName() {} now is: const functionName = () => {}.
Introduced more comments in the code to explain what is happening. Also to split up the import statements by their respective source.
Changed the templates' folder name to: components. Changed the order of components recurring in folders: instead of using a 'body' in between the parent and child components, primary child components are now imported into the parent component which also includes most overarching functionality. Otherwise, specific functionality for components has been tried to keep to the child components them self.
The Annotate Modal has been refined even more to the point it can almost be imported at any point of the code, as long as there is a valid object (specimen, digitalMedia) to be annotated.
This update still needs some patches to resolve minor issues.