Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: converted code to typescript #25

Merged
merged 4 commits into from
Jun 27, 2024
Merged

Conversation

DiogoRDuarte
Copy link
Contributor

Because

  • The current implementation does not make usage of Typescript, something that can hurt the development experience.
  • These changes were previously suggested in another PR (now closed). Given its magnitude, it was decided to break it into smaller, more manageable, ones. Kudos to @JoaoTMDias ✌️

This Commit

Refactor

  • Converts the codebase to typescript (except the JSX components which were left as plain JSX without any type inferrence).

Copy link
Collaborator

@JoaoTMDias JoaoTMDias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks ok, what I feel it is needed is better jsdoc docs for all functions in the project. For open-source projects this is essential to read and understand code.

There's a vscode extension called "Document This" that helps with most of the properties necessary with jsdoc. But functions need short and concise descriptions.

@DiogoRDuarte
Copy link
Contributor Author

@JoaoTMDias Documentation added!

Copy link
Collaborator

@JoaoTMDias JoaoTMDias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done 👏

};

/**
* AutoVizuA11y component, that adds screen-reader accessibility to wrapped charts.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the comma.

* @param {AutoVizuA11yProps} {
* type, - type of chart;
* descriptor, - descriptor of each data element;
* selectorType, - HTML type or classname of the data elements in the DOM;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra space between "or" and "classname"

@@ -8,7 +8,12 @@
import React, { useRef, useEffect } from "react";
import "./style/ShortcutGuideStyle.css";

const ShortcutGuide = () => {
/**
* Component that renders the list (also visual) of all AutoVizuA11y shortcuts.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the "also visual" matter?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree it can be cut


//When pressed reads the smaller description
/**
* Handles the longer and shorter description change when Alt+B or Alt+S are pressed, respectively.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The alt+B and alt+S command is not for MacOS. Can you add the "option" detail here and everywhere you mention shortcuts in the documentation?

import { addDataNavigation } from "./AddNavigation";

/**
* Changes navigation based on key press.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do we mean by "changes navigation" here?

}

/**
* Enables navigation on another data series.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's more something like "Enables navigation between data series", no?

export function overallComparer(event, alertDiv, insights, arrayConverted, focusedData) {
const { nativeEvent } = event;
/**
* Produces a message based on corner cases and calls comparer otherwise.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What exactly do you mean about the "message based on corner cases"? Is that the focus of the function or is this secondary?

*/

/**
* Enables one to jump to the end/beginning of a chart.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for the phrasing to be more aligned with the others, I suggest writing something like "Enables the navigation to the end/beginning of a chart"

//calculates the median value
export function median(arr) {
/**
* Calculates the median value of a number array.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a number array -> an array of numbers

//returns the ordinal number based on a number
export function getOrdinalNumber(number) {
/**
* Determines the ordinal version of a number.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe something like "Transforms number to ordinal". Wdyt?

@DiogoRDuarte DiogoRDuarte merged commit 4a6be28 into develop Jun 27, 2024
@DiogoRDuarte DiogoRDuarte deleted the feat-conversion-typescript branch June 27, 2024 14:41
DiogoRDuarte added a commit that referenced this pull request Jun 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants