Skip to content

Commit 96a93f8

Browse files
authored
Merge pull request #71 from UW-Macrostrat/explore-style
Minor fixes
2 parents 6d38323 + 400e344 commit 96a93f8

File tree

3 files changed

+28
-17
lines changed

3 files changed

+28
-17
lines changed

pages/checkin/index.ts

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { Overlay2 } from "@blueprintjs/core";
1010
import { LithologyList } from "@macrostrat/data-components";
1111
import { ClientOnly } from "vike-react/ClientOnly";
1212
import { macrostratApiURL } from "@macrostrat-web/settings";
13+
import { ContentPage } from "~/layouts";
1314

1415
function Map(props) {
1516
return h(
@@ -23,13 +24,22 @@ function Map(props) {
2324
}
2425

2526
export function Checkins({checkin, comments}) {
26-
console.log("Checkin data:", checkin);
27+
if (checkin === undefined) {
28+
return h('div', [
29+
h(ContentPage, [
30+
h('h2', "Checkin not found"),
31+
h(Divider),
32+
h('p', "This checkin does not exist or has been deleted."),
33+
]),
34+
h(Footer)
35+
]);
36+
}
2737
const center = {
2838
lat: checkin.lat,
2939
lng: checkin.lng
3040
}
3141

32-
let profile_pic = h('div.profile-header',h(BlankImage, {src: getProfilePicUrl(checkin.person_id), className: "profile-picture"}));
42+
let profile_pic = h('div.profile-header', h(BlankImage, {src: getProfilePicUrl(checkin.person_id), className: "profile-picture"}));
3343

3444
// format rating
3545
let ratingArr = [];
@@ -48,8 +58,8 @@ export function Checkins({checkin, comments}) {
4858
const headerBody = h('h4', {className: 'observation-header'}, checkin.notes);
4959

5060
observations.push(
51-
h('div', {className: 'observation'}, [
52-
h('a', {href: "/photo/" + checkin.photo},
61+
h.if(checkin.photo || checkin.notes)('div', {className: 'observation'}, [
62+
h.if(checkin.photo)('a', {href: "/photo/" + checkin.photo},
5363
h(BlankImage, { className: 'observation-image', src: imageSrc, alt: "presentation" })
5464
),
5565
h("div.observation-body", headerBody),
@@ -61,9 +71,11 @@ export function Checkins({checkin, comments}) {
6171
// if photo exists
6272
const imageSrc = getImageUrl(checkin.person_id, observation.photo);
6373

74+
console.log("Observation data:", observation);
75+
6476
observations.push(
65-
h('div', {className: 'observation'}, [
66-
h('a', {href: "/photo/" + observation.photo},
77+
h.if(observation.photo || observation.lat || observation.lng || !objectNull(observation.fossils) || !objectNull(observation.minerals) || !objectNull(observation.rocks))('div', {className: 'observation'}, [
78+
h.if(observation.photo)('a', {href: "/photo/" + observation.photo},
6779
h(BlankImage, { className: 'observation-image', src: imageSrc })
6880
),
6981
h(ObservationFooter, {observation}),
@@ -188,7 +200,7 @@ export function ObservationFooter({observation}) {
188200
lithologies.push({
189201
name: rocks.interval.name,
190202
int_id: rocks.interval.int_id,
191-
color: `rgba(${rocks.interval.color})`,
203+
color: rocks.interval.color.includes("#") ? rocks.interval.color : `rgba(${rocks.interval.color})`,
192204
})
193205
}
194206

@@ -225,6 +237,8 @@ export function ObservationFooter({observation}) {
225237
}
226238
};
227239

240+
console.log("Rocks data:", lithologies);
241+
228242
// observation body
229243
return h.if(show)("div", {className: 'observation-body'}, [
230244
observation.lat && rocks.strat_name?.strat_name_long ? h('h4', {className: 'observation-header'}, [
@@ -236,4 +250,8 @@ export function ObservationFooter({observation}) {
236250
h('p', {className: "notes"}, rocks.notes),
237251
]),
238252
]);
253+
}
254+
255+
function objectNull(obj) {
256+
return Object.keys(obj).length === 0 && obj.constructor === Object;
239257
}

pages/explore/+Page.client.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -464,11 +464,6 @@ function AutoComplete({setFilteredData, autocompleteOpen, setAutocompleteOpen})
464464
const data = useRockdAPI(queryString + "&page=" + page)?.success.data;
465465
const nextData = useRockdAPI(queryString + "&page=" + (page + 1))?.success.data;
466466

467-
console.log("current", data)
468-
console.log("next", nextData)
469-
470-
console.log(queryString + "&page=" + page)
471-
472467
// add markers for filtered checkins
473468
let coordinates = [];
474469
let lngs = [];
@@ -729,14 +724,12 @@ function ClickedCheckins({setSelectedCheckin}) {
729724

730725
if(cluster.length > 0) {
731726
const zoom = cluster[0].properties.expansion_zoom;
732-
console.log("cluster", cluster[0]);
733-
734-
console.log("zoom", zoom);
735727

736728
map.flyTo({
737729
center: cluster[0].geometry.coordinates,
738730
zoom: zoom + 2,
739-
speed: 0.5,
731+
speed: 10,
732+
curve: .5,
740733
});
741734
}
742735

pages/explore/main.module.sass

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ body
410410
width: 100px
411411

412412
.selected
413-
background-color: var(--accent-secondary-color)
413+
background-color: var(--accent-secondary-color) !important
414414

415415
.bp5-card, .bp5-navbar, .bp5-button
416416
border-radius: 4px

0 commit comments

Comments
 (0)