@@ -2,13 +2,14 @@ import { LngLatCoords } from "@macrostrat/map-interface";
22import { useState , useCallback } from 'react' ;
33import 'mapbox-gl/dist/mapbox-gl.css' ;
44import { BlankImage , Footer , getProfilePicUrl , getImageUrl } from "~/components/general" ;
5- import { Icon } from "@blueprintjs/core" ;
5+ import { Icon , Divider } from "@blueprintjs/core" ;
66import h from "./main.module.sass" ;
77import { SETTINGS } from "@macrostrat-web/settings" ;
88import "@macrostrat/style-system" ;
99import { Overlay2 } from "@blueprintjs/core" ;
1010import { LithologyList } from "@macrostrat/data-components" ;
1111import { ClientOnly } from "vike-react/ClientOnly" ;
12+ import { ExpansionPanel } from "@macrostrat/map-interface" ;
1213
1314function Map ( props ) {
1415 return h (
@@ -252,22 +253,39 @@ function observationFooter(observation) {
252253}
253254
254255function Comments ( { comments} ) {
256+ const commentArr = [ ] ;
257+
258+ comments . forEach ( ( item , index ) => {
259+ const { created, comment, person_id, name, likes } = item ;
260+
261+ const commentNode = h ( 'div.comment' , [
262+ h ( 'div.comment-author' , [
263+ h ( BlankImage , {
264+ className : 'comment-pic' ,
265+ src : getProfilePicUrl ( person_id ) ,
266+ alt : "profile picture"
267+ } ) ,
268+ h ( 'p' , { className : 'comment-author' } , name ) ,
269+ ] ) ,
270+ h ( 'p' , { className : 'comment-text' } , comment ) ,
271+ h ( 'p' , { className : 'comment-date' } , created ) ,
272+ h ( 'div.comment-likes' , [
273+ h ( Icon , { icon : 'thumbs-up' , className : 'like-icon' } ) ,
274+ h ( 'p' , { className : 'comment-likes' } , String ( likes ) ) ,
275+ ] )
276+ ] ) ;
277+
278+ commentArr . push ( commentNode ) ;
279+
280+ // Add divider between comments (but not after the last one)
281+ if ( index < comments . length - 1 ) {
282+ commentArr . push ( h ( Divider ) ) ;
283+ }
284+ } ) ;
285+
255286 return h ( 'div.comments' , [
256- h ( 'h3' , 'Comments' ) ,
257- comments . map ( item => {
258- const { created, comment, person_id, name, likes } = item ;
259- return h ( 'div.comment' , [
260- h ( 'div.comment-author' , [
261- h ( BlankImage , { className : 'profile-picture' , src : getProfilePicUrl ( person_id ) , alt : "profile picture" } ) ,
262- h ( 'p' , { className : 'comment-author' } , name ) ,
263- ] ) ,
264- h ( 'p' , { className : 'comment-text' } , comment ) ,
265- h ( 'p' , { className : 'comment-date' } , created ) ,
266- h ( 'div.comment-likes' , [
267- h ( Icon , { icon : 'thumbs-up' , className : 'like-icon' } ) ,
268- h ( 'p' , { className : 'comment-likes' } , likes ) ,
269- ] )
270- ] ) ;
271- } )
287+ h ( 'h2' , 'Comments' ) ,
288+ h ( Divider ) ,
289+ ...commentArr
272290 ] ) ;
273291}
0 commit comments