-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
chore: update comments #86
base: dev
Are you sure you want to change the base?
Conversation
/** | ||
* Card component that displays a card with a title and recharts chart content as children. | ||
* | ||
* @param {Object} props - The properties object. |
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.
I think we want to specify the tiltle, children and darkmode as props properties,
The way this is currently formatted makes it seem like the component takes 4 input parameters: props, title, children, isDarkMode. (I think the props.____ might be confusing, and the limited description for props as well)
How does the VScode mouseover look for this? If it is similar to other react component's documentation, you can disregard this
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.
Using CardProps as the type of props instead of Object may help
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.
I looked into more JSDoc documentation, and using dot notation seems to be the standard way to do this, so I think the CardProps type is the only change needed here
* | ||
* @component | ||
* @param {Object} props - The props object. | ||
* @param {Object} props.event - The event object containing details about the event. |
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.
I think we can use our own types here (TGEvent instead of Object as a type is more descriptive)
* @param {Function} props.setCurrentIp - Function to update the currently selected IP address. | ||
* @returns {JSX.Element} The rendered component. | ||
* | ||
* @typedef {Object} IPLocation |
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.
Oooo, Okay maybe this is how we should be doing it then. Didn't know about this formatting.
<p> | ||
<strong>Location: </strong> | ||
{currentIpLoc?.city}, {currentIpLoc?.region},{' '} | ||
{currentIpLoc?.country} | ||
</p> | ||
{/* Make sure the chart renders only when IP is selected */} | ||
{/* TODO: Render the IpAccessOverTimeChart component only when an IP is selected//possible display styling issue */} |
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.
This is currently how it works, (see line 71)
* @typedef {IPLocation & CountedEvent} IPLocationCountedEvent | ||
* | ||
* @example | ||
* <IpAccessCombined currentIp="192.168.1.1" setCurrentIp={setIp} /> |
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.
also sweet
* | ||
* @returns {JSX.Element} The rendered bar chart component. | ||
* | ||
* @remarks |
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.
!!
* @property {string} source - The source of the event. | ||
* @property {number} count - The count of events from this source. | ||
* | ||
* @state {CountedEvent[]} events - The fetched events data. |
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.
!!
* @state {boolean} loading - The loading status of the data fetch. | ||
* @state {string | null} selectedEventSource - The selected event source when a bar is clicked. | ||
* | ||
* @hook {useEffect} Fetches events data on component mount. |
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.
!!
* | ||
* @hook {useEffect} Fetches events data on component mount. | ||
* | ||
* @function handleClick |
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.
!!
* @component | ||
* @example | ||
* return ( | ||
* <UserActivityChart /> |
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.
You used the tsx ...
markdown before, I think that is probably preferred to this return ( ... ) syntax
Linked issue/ticket
#51
Description
adds comments in JsDocs syntax to front-end charts and components.
Reproduction steps
Inside source folder under components, and charts subfolders. Each file now has comments for future developers.
Checklist