@@ -28,8 +28,8 @@ export type Props = {
2828 * @note role shall be `student` when the current user is tutor and vice versa
2929 */
3030 role : "tutor" | "student" ;
31- topics : Array < string > ;
32- level : string ;
31+ topics ?: string [ ] ;
32+ level ? : string ;
3333 } ;
3434
3535 sendingMessage : boolean ;
@@ -138,10 +138,12 @@ export const LessonCard: React.FC<Props> = ({
138138 } , [ getTitle ] ) ;
139139
140140 const isEnded = useMemo ( ( ) => end . isBefore ( dayjs ( ) ) , [ end ] ) ;
141+
141142 const isOngoing = useMemo (
142143 ( ) => ! canceled && dayjs ( ) . isBetween ( dayjs ( start ) , end ) ,
143144 [ canceled , start , end ]
144145 ) ;
146+
145147 const isFuture = useMemo (
146148 ( ) => ! canceled && dayjs ( ) . isBefore ( dayjs ( start ) ) ,
147149 [ canceled , start ]
@@ -203,8 +205,8 @@ export const LessonCard: React.FC<Props> = ({
203205 } , [ canceled , currentUserRole , isEnded , intl , onJoin , onRebook , onSendMsg ] ) ;
204206
205207 const buttonType = useMemo (
206- ( ) => ( currentUserRole === "tutor" && isOngoing ? "main" : "natural" ) ,
207- [ currentUserRole , isOngoing ]
208+ ( ) => ( isOngoing ? "main" : "natural" ) ,
209+ [ isOngoing ]
208210 ) ;
209211
210212 const button = (
@@ -216,15 +218,21 @@ export const LessonCard: React.FC<Props> = ({
216218 onClick = { action . onClick }
217219 loading = { sendingMessage }
218220 >
219- < Typography
220- tag = "span"
221- className = { cn (
222- "text-caption font-semibold" ,
223- isOngoing ? "text-natural-50" : "text-natural-700"
224- ) }
225- >
226- { action . label }
227- </ Typography >
221+ { isOngoing ? (
222+ < Typography
223+ tag = "span"
224+ className = { cn ( "text-caption font-semibold text-natural-50" ) }
225+ >
226+ { action . label }
227+ </ Typography >
228+ ) : (
229+ < Typography
230+ tag = "span"
231+ className = "text-caption font-semibold text-natural-700"
232+ >
233+ { action . label }
234+ </ Typography >
235+ ) }
228236 </ Button >
229237 ) ;
230238
@@ -261,28 +269,35 @@ export const LessonCard: React.FC<Props> = ({
261269 >
262270 { title }
263271 </ Typography >
272+
264273 { ! canceled ? (
265- < Menu actions = { actions } >
266- < More className = "[&>*]:fill-natural-800 w-4 h-1" />
267- </ Menu >
274+ < div className = "border border-natural-100 rounded-lg py-1 px-2" >
275+ < Menu actions = { actions } >
276+ < More className = "w-4 h-1 transform -rotate-90 [&>*]:fill-natural-800" />
277+ </ Menu >
278+ </ div >
268279 ) : null }
269280 </ >
270281 ) }
271282 </ div >
283+
272284 < div className = "flex flex-col gap-6" >
273285 < div className = "flex gap-2" >
274286 < div className = "relative min-w-[74px] min-h-[74px] aspect-square shrink-0" >
275- < div
276- className = { cn (
277- "absolute w-[19px] h-[19px] right-0 top-0 p-0.5 bg-success-700 rounded-full z-10" ,
278- "flex items-center justify-center"
279- ) }
280- >
281- < Typography tag = "span" className = "text-natural-0 text-[10px]" >
282- { member . level }
283- </ Typography >
284- </ div >
285- < div className = "w-full h-full rounded-full overflow-hidden" >
287+ { currentUserRole === "tutor" ? (
288+ < div
289+ className = { cn (
290+ "absolute w-[19px] h-[19px] right-0 top-0 p-0.5 bg-success-700 rounded-full z-10" ,
291+ "flex items-center justify-center"
292+ ) }
293+ >
294+ < Typography tag = "span" className = "text-natural-0 text-[10px]" >
295+ { member . level }
296+ </ Typography >
297+ </ div >
298+ ) : null }
299+
300+ < div className = "w-full h-full max-w-[75px] max-h-[75px] rounded-full overflow-hidden" >
286301 < AvatarV2 src = { member . image } alt = { member . name } id = { member . id } />
287302 </ div >
288303 </ div >
@@ -299,10 +314,10 @@ export const LessonCard: React.FC<Props> = ({
299314 < Clock className = "w-3.5 h-3.5" />
300315 < Typography
301316 tag = "span"
302- className = "text-natural-700 flex items-center text-tiny font-normal "
317+ className = "flex items-center text-tiny text-natural-700 "
303318 >
304319 { dayjs ( start ) . format ( "h:mm a" ) }
305- { " - " }
320+ { " الي " }
306321 { dayjs ( start ) . add ( duration , "minutes" ) . format ( "h:mm a" ) }
307322 </ Typography >
308323 </ div >
@@ -318,26 +333,31 @@ export const LessonCard: React.FC<Props> = ({
318333 </ div >
319334 </ div >
320335
321- < div className = "mt-2 flex items-center gap-1" >
322- { member . topics . slice ( 0 , 4 ) . map ( ( topic ) => (
323- < Typography
324- key = { topic }
325- tag = "span"
326- className = "border border-natural-500 rounded-[200px] px-1.5 py-1"
327- >
328- { topic }
329- </ Typography >
330- ) ) }
331- { member . topics . length > 4 && (
332- < Typography
333- key = "remaining"
334- tag = "span"
335- className = "border border-natural-500 rounded-[200px] px-1.5 py-1"
336- >
337- { member . topics . length - 4 } +
338- </ Typography >
339- ) }
340- </ div >
336+ { currentUserRole === "tutor" &&
337+ member . topics &&
338+ member . topics . length > 0 ? (
339+ < div className = "mt-2 flex items-center gap-1" >
340+ { member . topics . slice ( 0 , 4 ) . map ( ( topic ) => (
341+ < Typography
342+ key = { topic }
343+ tag = "span"
344+ className = "text-tiny text-natural-500 border border-natural-500 rounded-[200px] px-1.5 py-1"
345+ >
346+ { topic }
347+ </ Typography >
348+ ) ) }
349+
350+ { member . topics . length > 4 && (
351+ < Typography
352+ key = "remaining"
353+ tag = "span"
354+ className = "text-tiny text-natural-500 border border-natural-500 rounded-[200px] px-1.5 py-1"
355+ >
356+ { member . topics . length - 4 } +
357+ </ Typography >
358+ ) }
359+ </ div >
360+ ) : null }
341361 </ div >
342362 </ div >
343363 < div className = "flex gap-4" >
@@ -346,7 +366,9 @@ export const LessonCard: React.FC<Props> = ({
346366 < Button
347367 startIcon = { < AllMessages className = "icon w-4 h-4" /> }
348368 type = "natural"
369+ variant = "secondary"
349370 size = "large"
371+ onClick = { onSendMsg }
350372 />
351373 ) }
352374 </ div >
0 commit comments