Skip to content
Next Next commit
update datatip date
  • Loading branch information
leo-step committed Aug 5, 2022
commit a4115a7966ab78cd0ca516ba8657f35e17473f34
11 changes: 9 additions & 2 deletions src/components/Table/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
} from './filters';
import { Event } from '../Shared/Tracking';

import questions from '../../data';
import questions, { updated } from '../../data';

import 'react-toggle/style.css';
import './styles.scss';
Expand Down Expand Up @@ -353,13 +353,20 @@ const Table = () => {
},
{
Header: () => {
const date = new Date(updated);
const month = date.toLocaleString('default', {
month: 'long',
});
const year = date.getFullYear();
return (
<>
<div
style={{ whiteSpace: 'nowrap', display: 'inline-block' }}
>
Companies{' '}
<span data-tip="Companies retrieved from Leetcode Premium (January 2022)">
<span
data-tip={`Companies retrieved from Leetcode Premium (${month} ${year})`}
Copy link
Owner

Choose a reason for hiding this comment

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

Thank you for this update - could we make a tiny adjustment?

Suggested change
data-tip={`Companies retrieved from Leetcode Premium (${month} ${year})`}
data-tip={`Companies retrieved from Leetcode Premium on (${month} ${day}, ${year})`}

The list of companies would ideally be updated every week right after Leetcode update the companies for each question. It'd be nice to have the date included to understand the last time things were ran!

>
<FaQuestionCircle />
</span>
</div>
Expand Down
6 changes: 3 additions & 3 deletions src/data/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import questions from './questions.json';

const sortBy = { Easy: 0, Medium: 1, Hard: 2 };
const { updated, data } = questions;

export default questions.data.sort(
(a, b) => sortBy[a.difficulty] - sortBy[b.difficulty],
);
export { updated };
export default data.sort((a, b) => sortBy[a.difficulty] - sortBy[b.difficulty]);