Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 24 additions & 11 deletions src/components/Table/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
import Toggle from 'react-toggle';
import ReactTooltip from 'react-tooltip';
import { useTable, useFilters, useSortBy } from 'react-table';
import { FaQuestionCircle, FaLock } from 'react-icons/fa';
import { FaLock, FaExternalLinkAlt, FaQuestionCircle } from 'react-icons/fa';
import {
DefaultColumnFilter,
SelectDifficultyColumnFilter,
Expand Down Expand Up @@ -105,13 +105,15 @@ const Table = () => {
totalDifficultyCount.Hard}
</span>
</Badge>
<br />
<Badge className="easy" pill>
<span
data-tip={`You've completed ${difficultyCount.Easy}/${totalDifficultyCount.Easy} easy questions`}
>
Easy: {difficultyCount.Easy}/{totalDifficultyCount.Easy}
</span>
</Badge>
<br />
<Badge className="medium" pill>
<span
data-tip={`You've completed ${difficultyCount.Medium}/${totalDifficultyCount.Medium} medium questions`}
Expand All @@ -120,6 +122,7 @@ const Table = () => {
{totalDifficultyCount.Medium}
</span>
</Badge>
<br />
<Badge className="hard" pill>
<span
data-tip={`You've completed ${difficultyCount.Hard}/${totalDifficultyCount.Hard} hard questions`}
Expand Down Expand Up @@ -154,11 +157,21 @@ const Table = () => {
},
},
{
Header: 'Name',
accessor: 'name',
Header: 'Questions',
accessor: 'questions',
Cell: cellInfo => {
return (
<span>
<NavLink
target="_blank"
href={cellInfo.row.original.url}
onClick={() => {
Event(
'Table',
'Clicked question url',
`${cellInfo.row.original.name} question url`,
);
}}
>
{cellInfo.row.original.premium ? (
<span data-tip="Requires leetcode premium to view">
<FaLock />{' '}
Expand All @@ -167,26 +180,26 @@ const Table = () => {
''
)}
{cellInfo.row.original.name}
</span>
</NavLink>
);
},
},
{
Header: 'URL',
accessor: 'url',
Header: 'Solutions',
accessor: 'solutions',
Cell: cellInfo => (
<NavLink
target="_blank"
href={cellInfo.row.original.url}
href={`${cellInfo.row.original.url}discuss`}
onClick={() => {
Event(
'Table',
'Clicked url',
`${cellInfo.row.original.name} url`,
'Clicked solution',
`${cellInfo.row.original.name} solution`,
);
}}
>
{cellInfo.row.original.url}
<FaExternalLinkAlt />
</NavLink>
),
disableFilters: true,
Expand Down
1 change: 0 additions & 1 deletion src/data/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1804,7 +1804,6 @@ const questions = [
'Uber',
'Snapchat',
'Google',
'Google',
'Oracle',
],
},
Expand Down