-
Notifications
You must be signed in to change notification settings - Fork 0
Better code documentation #1
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,10 +4,25 @@ import ProgressBar from 'react-bootstrap/ProgressBar'; | |
|
|
||
| /** | ||
| * LOIndicatorBars provide progress bars. | ||
| * It takes a property, `data`, and | ||
| * outputs each item as a label/progress bar pair. | ||
| * If the id of the item is not in the property `shown`, | ||
| * it will not appear. | ||
| * | ||
| * A React component that renders a set of indicator bars, each showing a label, a value, and a help text. | ||
| * The component expects the following props: | ||
| * - id (string): the HTML id of the top-level element. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Which format should we use for documentation? This or the |
||
| * - setProps (function): a function to update the component props. | ||
| * - data (object): a dictionary of indicators, where each key is an indicator ID and each value is an object | ||
| * with the following keys: | ||
| * - id (string): the indicator ID. | ||
| * - label (string): the label to show before the indicator bar. | ||
| * - value (number): the value of the indicator bar (between 0 and 100). | ||
| * - help (string): a help text to show when hovering over the indicator bar. | ||
| * - shown (array): an array of indicator IDs that should be shown (all other indicators will be hidden). | ||
| * - class_name (string): a CSS class name to add to the top-level element. | ||
| * | ||
| * The component renders a `div` element with the specified id and class name, and a set of child `div` elements, | ||
| * each representing an indicator bar. The bars are sorted in the order of their keys in the `data` prop. Each bar | ||
| * shows the label and a progress bar with the value and help text. The progress bar color is based on the value | ||
| * (red for values below 34, yellow for values between 34 and 67, and green for values above 67). The bars are | ||
| * hidden or shown based on the `shown` prop. | ||
| */ | ||
| export default class LOIndicatorBars extends Component { | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,10 +2,19 @@ import React, {Component} from 'react'; | |
| import PropTypes from 'prop-types'; | ||
|
|
||
| /** | ||
| * LOTextHighlight provides breakpoints and classes to allow for later highlighting. | ||
| * It takes a property, `text`, and | ||
| * and breaks it up based on all possible breakpoints in property `highlight_breakpoints`. | ||
| * The text is output as a variety of spans with classnames corresponding to ids. | ||
| * LOTextHighlight provides breakpoints and classes to allow for later | ||
| * highlighting. It takes a property, `text`, and and breaks it up | ||
| * based on all possible breakpoints in property | ||
| * `highlight_breakpoints`. The text is output as a variety of spans | ||
| * with classnames corresponding to ids. | ||
| * | ||
| * @param {string} text - The text to be highlighted | ||
| * @param {Object} highlight_breakpoints - An object specifying the breakpoints for highlighting. The keys should be unique IDs and the values should be objects with the following properties: | ||
| * - `id`: The unique ID for this set of highlight breakpoints | ||
| * - `value`: An array of `[start, length]` tuples specifying the start index and length of each highlight. The tuples should be sorted in ascending order by start index. | ||
| * - `label` (optional): A label to be used in combination with the highlight ID for customizing styling. | ||
| * @param {string} [class_name] - Additional class name(s) to apply to the rendered component | ||
| * @param {string} [id] - ID to apply to the rendered component | ||
| */ | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing returns statement |
||
| export default class LOTextHighlight extends Component { | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,11 +9,15 @@ import Row from 'react-bootstrap/Row'; | |
| import Col from 'react-bootstrap/Col'; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This component is currently not being used. Changed to using the individual items instead for more modularization. I'd recommend just removing this file (that can wait until we do the migration of the code though) |
||
|
|
||
| /** | ||
| * ExampleComponent is an example component. | ||
| * It takes a property, `label`, and | ||
| * displays it. | ||
| * It renders an input with the property `value` | ||
| * which is editable by the user. | ||
| * StudentOverviewCard | ||
| * | ||
| * This is the main card for a student in the Writing Observer dashboard. | ||
| * | ||
| * The key parameter passed in is data. | ||
| * | ||
| * - data.metrics variable generates a badge component for each metric object. | ||
| * - data.indicators generates a progress-style bar for each indicator object. | ||
| * - data.highlights variable is used to determine which parts of the student's text should be highlighted | ||
| */ | ||
| export default class StudentOverviewCard extends Component { | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the param and return info be included in this comment instead of a subsequent one? Also in whichever format we follow (see other comments)