Commit a3c3282 1 parent e9a1462 commit a3c3282 Copy full SHA for a3c3282
File tree 3 files changed +36
-15
lines changed
3 files changed +36
-15
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ import CountryFlags from './helpers/CountryFlags';
26
26
import ExperienceCircle from './helpers/ExperienceCircle' ;
27
27
import ExperiencesForRides from './helpers/ExperiencesForRides' ;
28
28
import LikeRide from './helpers/LikeRide' ;
29
+ import { NumberOfLikesCount } from './helpers/NumberOfLikesCount' ;
29
30
30
31
export function HitchhikingTrip ( {
31
32
user,
@@ -76,6 +77,7 @@ export function HitchhikingTrip({
76
77
< div className = "flex flex-col items-center justify-between text-gray-500" >
77
78
< div className = "flex items-center mt-2 gap-2 dark:text-white" >
78
79
< ExperiencesForRides rides = { rides } />
80
+ < NumberOfLikesCount trip = { trip } />
79
81
< CountryFlags trip = { trip } />
80
82
</ div >
81
83
{ rides . length > 0 && (
@@ -107,9 +109,8 @@ export function HitchhikingTrip({
107
109
</ div >
108
110
< article >
109
111
< div
110
- className = { `h-56 sm:h-64 xl:h-76 pb-4 ${
111
- ridesWithPhoto . length === 0 && 'hidden'
112
- } `}
112
+ className = { `h-56 sm:h-64 xl:h-76 pb-4 ${ ridesWithPhoto . length === 0 && 'hidden'
113
+ } `}
113
114
>
114
115
< Carousel slideInterval = { 5000 } slide = { true } >
115
116
{ ridesWithPhoto . map (
Original file line number Diff line number Diff line change
1
+ import { Trip } from '@/types'
2
+ import { Tooltip } from 'flowbite-react'
3
+ import React , { FC } from 'react'
4
+ import { FaHeart } from 'react-icons/fa'
5
+
6
+ interface NumberOfLikesCountProps { trip : Trip } ;
7
+
8
+ export const NumberOfLikesCount : FC < NumberOfLikesCountProps > = ( { trip } ) => {
9
+ if ( trip . likes_count === 0 ) return null ;
10
+
11
+ return (
12
+ < Tooltip content = { `Received ${ trip . likes_count } likes` } >
13
+ < div className = 'relative gap-2 flex items-center' >
14
+ { trip . likes_count }
15
+ < FaHeart className = 'text-red-500' />
16
+ </ div >
17
+ </ Tooltip >
18
+ )
19
+ }
Original file line number Diff line number Diff line change @@ -14,29 +14,30 @@ export type Location = {
14
14
export type Timestamp = { seconds : number ; nanoseconds : number } ;
15
15
16
16
export type Trip = {
17
- id : number | string ;
18
- to_param : string ;
19
- arrival : Date ;
20
- departure : Date ;
21
- created_at : Date ;
22
- google_duration ?: number ;
23
- distance ?: number ;
24
- travelling_with : number ;
25
17
age_at_trip : number ;
18
+ arrival : Date ;
26
19
average_speed : string ;
20
+ center : string ;
21
+ comments : Comment [ ] ;
27
22
country_distances : Country [ ] ;
28
- origin : Location ;
23
+ created_at : Date ;
24
+ departure : Date ;
29
25
destination : Location ;
26
+ distance ?: number ;
27
+ google_duration ?: number ;
28
+ id : number | string ;
29
+ likes_count : number ;
30
+ origin : Location ;
30
31
rides : Ride [ ] ;
32
+ to_param : string ;
31
33
total_distance : number ;
32
- center : string ;
33
- user_id : number ;
34
+ travelling_with : number ;
34
35
user : {
35
36
username : string ;
36
37
md5_email : string ;
37
38
gender : 'male' | 'female' | 'non-binary' | null ;
38
39
} ;
39
- comments : Comment [ ] ;
40
+ user_id : number ;
40
41
} ;
41
42
42
43
export type TripUser = {
You can’t perform that action at this time.
0 commit comments