ka-extension / ka-extension-ts

A browser extension for Khan Academy.
MIT License
19 stars 11 forks source link

User info rework #153

Closed lukekrikorian closed 5 years ago

lukekrikorian commented 5 years ago

This commit reworks the user info part of the extension, found on one's profile page. I've reworked the code to be an asynchronous function, which allows us to use await, resulting in much cleaner code without the massive promise spaghetti. Also, I've made some changes which result in near instantaneous execution of this feature, compared to the older version which took a few second. This is because originally we were waiting for the table element to be generated by React before fetching the data we'd need to update the table - this has been switched.

I've also made a few functional changes. Firstly, I've moved the Date joined table information to a title attribute on the original Date joined element. The difference between the two is the element displays something like 5 years ago and the title shows the exact date and time. I made this change because it looks simpler. The second change I made was to remove the User kaid row from the table. This was mostly because this looked very messy surrounded with the other data. Finally, I added a link the internal API endpoint for that user with the More info table row.

Finally, I separated the duplicateBadges functionality from the userInfo function, and we're now executing it from extension-impl.ts.