@@ -52,32 +52,34 @@ export interface CheckinProps {
5252 } > ;
5353 mapRef ?: React . RefObject < mapboxgl . Map > ;
5454 setInspectPosition ?: ( position : { lat : number ; lng : number } ) => void ;
55- rockdAPIUrl : string ;
55+ rockdCheckinURL : string ;
56+ rockdImageURL : string ;
57+ rockdProfilePicURL : string ;
5658}
5759
5860export function RockdWebsiteCheckinList ( props : CheckinProps ) {
5961 /** Checkin list component used in the Rockd website */
60- const { result, mapRef, setInspectPosition, rockdAPIUrl } = props ;
61- const isDarkMode = useDarkMode ( ) . isEnabled ;
62- let checkins = [ ] ;
62+ const {
63+ result,
64+ mapRef,
65+ setInspectPosition,
66+ rockdCheckinURL,
67+ rockdImageURL,
68+ rockdProfilePicURL,
69+ } = props ;
6370 const map = mapRef ?. current ;
6471 const len = result . length ;
65- const color = isDarkMode ? "white" : "black" ;
6672
6773 return h (
6874 result . map ( ( checkin ) => {
6975 // format rating
7076 let ratingArr = [ ] ;
7177 for ( var i = 0 ; i < checkin . rating ; i ++ ) {
72- ratingArr . push (
73- h ( Icon , { className : "star" , icon : "star" , style : { color } } ) ,
74- ) ;
78+ ratingArr . push ( h ( Icon , { className : "star" , icon : "star" } ) ) ;
7579 }
7680
7781 for ( var i = 0 ; i < 5 - checkin . rating ; i ++ ) {
78- ratingArr . push (
79- h ( Icon , { className : "star" , icon : "star-empty" , style : { color } } ) ,
80- ) ;
82+ ratingArr . push ( h ( Icon , { className : "star" , icon : "star-empty" } ) ) ;
8183 }
8284
8385 let imageView = null ;
@@ -86,7 +88,7 @@ export function RockdWebsiteCheckinList(props: CheckinProps) {
8688 const imgSrc = getImageUrl (
8789 checkin . person_id ,
8890 checkin . photo ,
89- rockdAPIUrl ,
91+ rockdImageURL ,
9092 ) ;
9193 imageView = h ( [
9294 h ( "img.observation-img" , {
@@ -98,7 +100,6 @@ export function RockdWebsiteCheckinList(props: CheckinProps) {
98100 h ( Icon , {
99101 className : "details-image" ,
100102 icon : "arrow-right" ,
101- style : { color } ,
102103 } ) ,
103104 ] ) ,
104105 ] ) ;
@@ -108,7 +109,6 @@ export function RockdWebsiteCheckinList(props: CheckinProps) {
108109 h ( Icon , {
109110 className : "details-image" ,
110111 icon : "arrow-right" ,
111- style : { color } ,
112112 } ) ,
113113 ] ) ;
114114 }
@@ -159,7 +159,10 @@ export function RockdWebsiteCheckinList(props: CheckinProps) {
159159 "h3.profile-pic" ,
160160
161161 h ( "img.profile-pic" , {
162- src : getProfilePicUrl ( checkin . person_id , rockdAPIUrl ) ,
162+ src : getProfilePicUrl (
163+ checkin . person_id ,
164+ rockdProfilePicURL ,
165+ ) ,
163166 } ) ,
164167 )
165168 : null ,
@@ -182,35 +185,30 @@ export function RockdWebsiteCheckinList(props: CheckinProps) {
182185 "a" ,
183186 {
184187 className : "checkin-link" ,
185- href : "/checkin /" + checkin . checkin_id ,
188+ href : rockdCheckinURL + " /" + checkin . checkin_id ,
186189 target : "_blank" ,
187190 } ,
188191 imageView ,
189192 ) ,
190193 h ( "div" , { className : "checkin-footer" } , [
191194 h ( "div" , { className : "likes-container" } , [
192195 h ( Icon , {
193- className : "likes-icon " + ( isDarkMode ? "icon-dark-mode" : "" ) ,
196+ className : "likes-icon" ,
194197 icon : "thumbs-up" ,
195- style : { color } ,
196198 } ) ,
197199 h ( "h3" , { className : "likes" } , checkin . likes ) ,
198200 ] ) ,
199201 h ( "div" , { className : "observations-container" } , [
200202 h ( Icon , {
201- className :
202- "observations-icon " + ( isDarkMode ? "icon-dark-mode" : "" ) ,
203+ className : "observations-icon" ,
203204 icon : "camera" ,
204- style : { color } ,
205205 } ) ,
206206 h ( "h3" , { className : "likes" } , checkin . observations . length ) ,
207207 ] ) ,
208208 h ( "div" , { className : "comments-container" } , [
209209 h ( Icon , {
210- className :
211- "comments-icon " + ( isDarkMode ? "icon-dark-mode" : "" ) ,
210+ className : "comments-icon" ,
212211 icon : "comment" ,
213- style : { color } ,
214212 } ) ,
215213 h ( "h3" , { className : "comments" } , checkin . comments ) ,
216214 ] ) ,
@@ -221,12 +219,10 @@ export function RockdWebsiteCheckinList(props: CheckinProps) {
221219 ) ;
222220}
223221
224- function getImageUrl ( person_id , photo_id , rockdAPIUrl ) {
225- return (
226- rockdAPIUrl + "/protected/image/" + person_id + "/thumb_large/" + photo_id
227- ) ;
222+ function getImageUrl ( person_id , photo_id , rockdImageURL ) {
223+ return rockdImageURL + "/" + person_id + "/thumb_large/" + photo_id ;
228224}
229225
230- function getProfilePicUrl ( person_id , rockdAPIUrl ) {
231- return rockdAPIUrl + "/protected/gravatar /" + person_id ;
226+ function getProfilePicUrl ( person_id , rockdProfilePicURL ) {
227+ return rockdProfilePicURL + "/" + person_id ;
232228}
0 commit comments