@@ -29,44 +29,51 @@ const DifficultyAbbreviations: Record<string, string> = {
2929 hard : 'Hard'
3030} ;
3131
32+ export const StatusColors : Record < string , string > = {
33+ SOLVED : 'green' ,
34+ ATTEMPTED : 'violet' ,
35+ TO_DO : 'gray'
36+ } ;
37+
38+ const IconProps = { size : 16 , stroke : 1.5 } ;
39+
3240const QuestionItem : React . FC < {
3341 question : LeetCodeQuestion ;
3442 onGenerateSuccess : ( p : string ) => void ;
3543} > = ( { question, onGenerateSuccess } ) => {
3644 const [ showGenerateIcon , setShowGenerateIcon ] = React . useState ( false ) ;
3745
3846 const statusIcon = ( ) => {
39- const size = 16 ;
4047 if ( ! question . status ) {
4148 return null ;
4249 }
4350 switch ( question . status ) {
4451 case 'SOLVED' :
4552 return (
4653 < Tooltip fz = "xs" label = "Solved" >
47- < IconCheck size = { size } color = "green" stroke = { 1.5 } />
54+ < IconCheck color = { StatusColors [ question . status ] } { ... IconProps } />
4855 </ Tooltip >
4956 ) ;
5057 case 'ATTEMPTED' :
5158 return (
5259 < Tooltip fz = "xs" label = "Attempted" >
53- < IconCircle size = { size } color = "gray" stroke = { 1.5 } />
60+ < IconCircle color = { StatusColors [ question . status ] } { ... IconProps } />
5461 </ Tooltip >
5562 ) ;
5663 case 'TO_DO' :
5764 default :
5865 return question . paidOnly ? (
5966 < Tooltip fz = "xs" label = "Paid Only" >
60- < IconLock size = { size } color = { LeetCodeMainColor } stroke = { 1.5 } />
67+ < IconLock color = { LeetCodeMainColor } { ... IconProps } />
6168 </ Tooltip >
6269 ) : (
63- < div style = { { width : size , height : size } } > </ div >
70+ < div style = { { width : IconProps . size , height : IconProps . size } } > </ div >
6471 ) ;
6572 }
6673 } ;
6774
68- const generate = ( slug : string ) => {
69- generateNotebook ( slug )
75+ const generate = ( ) => {
76+ generateNotebook ( question . titleSlug )
7077 . then ( ( { filePath } ) => {
7178 onGenerateSuccess ( filePath ) ;
7279 } )
@@ -88,13 +95,15 @@ const QuestionItem: React.FC<{
8895 fz = "sm"
8996 fw = { 600 }
9097 >
98+ { question . questionFrontendId }
99+ { '. ' }
91100 { question . title }
92101 </ Anchor >
93102 </ Group >
94103 </ Table . Td >
95104
96105 < Table . Td className = { classes . ac_column } >
97- < Tooltip fz = "xs" label = "Acceptance Rate" position = { ' top-start' } >
106+ < Tooltip fz = "xs" label = "Acceptance Rate" position = " top-start" >
98107 < Text fz = "sm" c = "gray" >
99108 { ( question . acRate * 100 ) . toFixed ( 2 ) } %
100109 </ Text >
@@ -122,7 +131,7 @@ const QuestionItem: React.FC<{
122131 size = "sm"
123132 variant = "transparent"
124133 color = { LeetCodeMainColor }
125- onClick = { ( ) => generate ( question . titleSlug ) }
134+ onClick = { ( ) => generate ( ) }
126135 >
127136 < IconBrandLeetcode stroke = { 1.5 } />
128137 </ ActionIcon >
0 commit comments