Skip to content

Commit 021f4e0

Browse files
committed
added staging and production folders
1 parent 19092e1 commit 021f4e0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+4483
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ The new website also contains an uopdated version of [trips viewer](https://gith
1717
6. Start the live-reloading development server with `yarn run dev`. The server will be available at
1818
`http://localhost:3000` by default.
1919

20-
ALTERNATIVLY
20+
ALTERNATIVELY
2121

2222
1. Clone the repository
2323
2. Pull down submodules (`git submodule update --init --recursive`)

pages/production/+Page.mdx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export { ContentPage as default } from "~/layouts";
2+
import { PageHeader, PageBreadcrumbs } from "~/components";
3+
4+
<PageHeader title="Development pages"></PageHeader>
5+
<PageBreadcrumbs></PageBreadcrumbs>
6+
7+
- [Test Site](/dev/test-site/main-page)

pages/production/+config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export default {
2+
// Forces global style separation from other pages by reloading
3+
clientRouting: false,
4+
passToClient: [
5+
'urlParsed'
6+
]
7+
};
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
import { PageHeader } from "~/components";
2+
import { Image, Navbar, Footer } from "./index";
3+
import "./main.styl";
4+
import "./main-page.styl";
5+
6+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"></link>
7+
8+
<div class="new_container field">
9+
<div class="mask">
10+
<Image src="main-page/field.jpg" className="start-img back-img"></Image>
11+
<div class="main-content row row-eq-height">
12+
<div class="side">
13+
<div class="center-me">
14+
<div class="center">
15+
<Image src="main-page/rockd_transparent.png" className="not-huge"></Image>
16+
<p>Learn, explore, and document your geologic world</p>
17+
<a href="https://itunes.apple.com/us/app/id1153056624"><Image src="main-page/appstore.png" className="download-badge ios"></Image></a>
18+
<a href="https://play.google.com/store/apps/details?id=org.macrostrat.rockd"><Image src="main-page/google-play-badge.png" className="download-badge android"></Image></a>
19+
<p><a class="explore-link" href="/explore">Explore the data</a></p>
20+
</div>
21+
</div>
22+
<Image src="main-page/main.png" className="main-img"></Image>
23+
</div>
24+
</div>
25+
</div>
26+
</div>
27+
28+
<div class="new_container map-container">
29+
<div class="side">
30+
<div class="map-imgs">
31+
<Image src="main-page/grand_canyon.jpg" className="map-shot grand_canyon"></Image>
32+
<Image src="main-page/new_zealand.jpg" className="map-shot new_zealand"></Image>
33+
<Image src="main-page/world.jpg" className="map-shot world"></Image>
34+
<Image src="main-page/appalachia.jpg" className="map-shot appalachia"></Image>
35+
</div>
36+
37+
<div class="center map-info">
38+
<h1>Instant access to more than 290 <a href="https://macrostrat.org/map/sources">geologic maps</a> globally</h1>
39+
<p>Includes direct links to <a href="https://macrostrat.org">Macrostrat</a> and <a href="https://xdd.wisc.edu">xDD</a> (where available)</p>
40+
</div>
41+
</div>
42+
</div>
43+
44+
<div class="new_container white-container">
45+
<div class="row">
46+
<div class="col-sm-6 col-sm-offset-3">
47+
<div class="headline-alligner">
48+
<div class="center curious">
49+
<h1>Curious what you're standing on?</h1>
50+
<p>The Dashboard distills key facts about your location into a single, easy-to-read interface</p>
51+
</div>
52+
</div>
53+
</div>
54+
<div class="col-xs-12 dashboard-img-container">
55+
<Image src="main-page/pilbara-australia.png"></Image>
56+
<Image src="main-page/huronian-supergroup.png"></Image>
57+
<Image src="main-page/copper-harbor.png"></Image>
58+
59+
<Image src="main-page/appalachian-foreland.png"></Image>
60+
<Image src="main-page/gotthard-pass.png"></Image>
61+
<Image src="main-page/ozark-plateau.png"></Image>
62+
<Image src="main-page/eastern-australia.png"></Image>
63+
64+
</div>
65+
</div>
66+
</div>
67+
68+
<div class="new_container red_rock">
69+
<Image src="main-page/red_rock.jpg" className="back-img red-rock-img"></Image>
70+
<div class="img-container row row-eq-height">
71+
<div class="col-sm-6 stats-container">
72+
<Image src="main-page/profile.png" className="profile-img"></Image>
73+
</div>
74+
75+
<div class="col-sm-6 center-me">
76+
<div class="headline-alligner">
77+
<div class="center">
78+
<h1>"The best geologist is the one who has seen the most rocks"</h1>
79+
<p>Track your progress through the geologic rock record with summary statistics about your checkins</p>
80+
</div>
81+
</div>
82+
</div>
83+
</div>
84+
</div>
85+
86+
87+
<div class="record-block">
88+
<div class="row">
89+
<div class="col-sm-6 col-sm-offset-3">
90+
<div class="headline-alligner">
91+
<div class="center">
92+
<h1>Record your observations</h1>
93+
<p>Rockd allows you to easily record your geological observations, using your location to provide spatially informed suggestions for nearby geologic units, time intervals, and fossils</p>
94+
</div>
95+
</div>
96+
</div>
97+
98+
<div class="col-sm-6">
99+
<div class="headline-alligner">
100+
<div class="center">
101+
<Image src="main-page/checkin.png" className="record-block-img"></Image>
102+
<p class="record-img-caption"><span>Take pictures of and rate features</span></p>
103+
</div>
104+
</div>
105+
</div>
106+
107+
<div class="col-sm-6">
108+
<div class="headline-alligner">
109+
<div class="center">
110+
<Image src="main-page/strat-names.png" className="record-block-img"></Image>
111+
<p class="record-img-caption"><span>Tag stratigraphic names, even offline</span></p>
112+
</div>
113+
</div>
114+
</div>
115+
116+
<div class="col-sm-6">
117+
<div class="headline-alligner">
118+
<div class="center">
119+
<Image src="main-page/strike-dip.png" className="record-block-img"></Image>
120+
<p class="record-img-caption"><span>Use your phone's compass to record strike and dip</span></p>
121+
</div>
122+
</div>
123+
</div>
124+
125+
<div class="col-sm-6">
126+
<div class="headline-alligner">
127+
<div class="center">
128+
<Image src="main-page/taxa.png" className="record-block-img"></Image>
129+
<p class="record-img-caption"><span>Search for and tag <a href="https://paleobiodb.org">Paleobiology Database</a> taxa.</span></p>
130+
</div>
131+
</div>
132+
</div>
133+
</div>
134+
</div>
135+
136+
<Footer></Footer>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { PageHeader } from "~/components";
2+
import { Footer } from "../index";
3+
import "./main.styl";
4+
import "../main.styl";
5+
import { App } from "./index";
6+
7+
<App></App>
8+
<Footer></Footer>
Lines changed: 198 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
import h from "@macrostrat/hyper";
2+
import { LngLatCoords } from "@macrostrat/map-interface";
3+
import { useEffect, useState } from 'react';
4+
import { usePageContext } from 'vike-react/usePageContext';
5+
import 'mapbox-gl/dist/mapbox-gl.css';
6+
import { BlankImage, Image } from "../index";
7+
8+
function imageExists(image_url){
9+
var http = new XMLHttpRequest();
10+
11+
http.open('HEAD', image_url, false);
12+
http.send();
13+
14+
return http.status != 404;
15+
}
16+
17+
export function App() {
18+
const pageContext = usePageContext();
19+
const [userData, setUserData] = useState(null);
20+
const [loading, setLoading] = useState(true);
21+
const [error, setError] = useState(null);
22+
const [checkinNum, setCheckin] = useState(null);
23+
24+
let stop;
25+
26+
useEffect(() => {
27+
if (pageContext.urlParsed) {
28+
stop = parseInt(pageContext.urlParsed.search.checkin);
29+
setCheckin(stop);
30+
} else {
31+
setCheckin(0);
32+
}
33+
console.log(`Fetching data for checkin ID: ` + stop);
34+
35+
// Ensure trip ID is valid
36+
if (isNaN(stop)) {
37+
setLoading(false);
38+
setError('Invalid checkin ID.');
39+
return;
40+
}
41+
42+
fetch("https://rockd.org/api/v2/protected/checkins?checkin_id=" + stop)
43+
.then(response => {
44+
if (!response.ok) {
45+
throw new Error('Network response was not ok');
46+
}
47+
return response.json();
48+
})
49+
.then(data => {
50+
console.log('Fetched data:', data); // Log fetched data for debugging
51+
if (data.success && data.success.data.length > 0) {
52+
setUserData(data.success.data[0]);
53+
} else {
54+
setUserData(null);
55+
}
56+
})
57+
.catch(error => {
58+
console.error('Fetch error:', error);
59+
setError(error.message);
60+
})
61+
.finally(() => {
62+
setLoading(false);
63+
});
64+
}, []);
65+
66+
if (loading) {
67+
if(checkinNum == null) {
68+
return h("div", { className: 'loading' }, [
69+
h("h1", "Loading checkin..."),
70+
]);
71+
} else {
72+
return h("div", { className: 'loading' }, [
73+
h("h1", "Loading checkin " + checkinNum + "..."),
74+
]);
75+
}
76+
77+
}
78+
79+
if (error) {
80+
return h("div", { className: 'error' }, [
81+
h("h1", "Error"),
82+
h("p", error)
83+
]);
84+
}
85+
86+
if (!userData) {
87+
return h("div", { className: 'error' }, [
88+
h("h1", "Trip " + checkinNum + " not found"),
89+
]);
90+
}
91+
92+
let checkin = userData;
93+
console.log(checkin)
94+
95+
let profile_pic = h(BlankImage, {src: "https://rockd.org/api/v2/protected/gravatar/" + checkin.person_id, className: "profile-pic"});
96+
97+
// format rating
98+
let ratingArr = [];
99+
for(var i = 0; i < checkin.rating; i++) {
100+
ratingArr.push(h(Image, {className: "star", src: "blackstar.png"}));
101+
}
102+
103+
// get observations
104+
let observations = [];
105+
106+
// add checkin photo and notes
107+
console.log("Checkin photo: ", checkin.photo != null);
108+
let headerImg;
109+
if(imageExists("https://rockd.org/api/v1/protected/image/" + checkin.person_id + "/thumb_large/" + checkin.photo) && checkin.photo != null) {
110+
headerImg = h(BlankImage, {className: 'observation-img', src: "https://rockd.org/api/v1/protected/image/" + checkin.person_id + "/thumb_large/" + checkin.photo})
111+
} else {
112+
headerImg = h(BlankImage, { className: 'observation-img', src: "https://storage.macrostrat.org/assets/rockd/rockd.jpg"})
113+
}
114+
115+
observations.push(
116+
h('div', {className: 'observation'}, [
117+
headerImg,
118+
h('h4', {className: 'observation-header'}, checkin.notes),
119+
])
120+
);
121+
122+
// add observations
123+
for(var i = 0; i < checkin.observations.length; i++) {
124+
let observation = checkin.observations[i];
125+
console.log("Observation " + i);
126+
console.log(observation);
127+
128+
if(Object.keys(observation.rocks).length != 0) {
129+
// get liths
130+
let liths = [];
131+
for(var j = 0; j < observation.rocks.liths.length; j++) {
132+
liths.push(h('p', observation.rocks.liths[j].name));
133+
}
134+
135+
136+
let LngLatProps = {
137+
position: {
138+
lat: observation.lat,
139+
lng: observation.lng
140+
},
141+
precision: 3,
142+
zoom: 10
143+
};
144+
145+
// LngLatCoords(LngLatProps);
146+
147+
148+
// if photo exists
149+
if (imageExists("https://rockd.org/api/v1/protected/image/" + checkin.person_id + "/thumb_large/" + observation.photo)) {
150+
observations.push(
151+
h('div', {className: 'observation'}, [
152+
h(BlankImage, { className: 'observation-img', src: "https://rockd.org/api/v1/protected/image/" + checkin.person_id + "/thumb_large/" + observation.photo}),
153+
h('h4', {className: 'observation-header'}, observation.rocks.strat_name?.strat_name_long),
154+
h('div', {className: 'observation-details'}, [
155+
h('p', {className: 'observation-detail'}, observation.rocks.strat_name?.strat_name_long),
156+
h('p', {className: 'observation-detail'}, observation.rocks.map_unit?.unit_name),
157+
h('p', {className: 'observation-detail'}, observation.age_est.name + " (" + observation.age_est.b_age + " - " + observation.age_est.t_age + ")"),
158+
h('p', {className: 'observation-detail'}, liths),
159+
h('p', {className: 'observation-detail'}, observation.orientation.feature?.name),
160+
h('p', {className: 'observation-detail'}, "Coords: " + observation.lat + ", " + observation.lng),
161+
]),
162+
])
163+
);
164+
} else {
165+
observations.push(
166+
h('div', {className: 'observation'}, [
167+
h(BlankImage, { className: 'observation-img', src: "https://storage.macrostrat.org/assets/rockd/rockd.jpg"}),
168+
h('h4', {className: 'observation-header'}, observation.rocks.strat_name?.strat_name_long),
169+
h('div', {className: 'observation-details'}, [
170+
h('p', {className: 'observation-detail'}, observation.rocks.strat_name?.strat_name_long),
171+
h('p', {className: 'observation-detail'}, observation.rocks.map_unit?.unit_name),
172+
h('p', {className: 'observation-detail'}, observation.age_est.name + " (" + observation.age_est.b_age + " - " + observation.age_est.t_age + ")"),
173+
h('p', {className: 'observation-detail'}, liths),
174+
h('p', {className: 'observation-detail'}, observation.orientation.feature?.name),
175+
]),
176+
])
177+
);
178+
}
179+
}
180+
}
181+
182+
return h('div', { className: 'main'}, [
183+
h('h1', { className: "checkin-header" }, checkin.description),
184+
h(BlankImage, { className: "location-img", src: "https://api.mapbox.com/styles/v1/jczaplewski/cje04mr9l3mo82spihpralr4i/static/geojson(%7B%22type%22%3A%22Point%22%2C%22coordinates%22%3A%5B" + checkin.lng + "%2C" + checkin.lat + "%5D%7D)/" + checkin.lng + "," + checkin.lat + ",5,0/1200x400?access_token=" + import.meta.env.VITE_MAPBOX_API_TOKEN }),
185+
h('div', { className: 'stop-header' }, [
186+
h('h3', {className: 'profile-pic'}, profile_pic),
187+
h('div', {className: 'stop-main-info'}, [
188+
h('h3', {className: 'name'}, checkin.first_name + " " + checkin.last_name),
189+
h('h4', {className: 'edited'}, checkin.created),
190+
h('p', {className: 'location'}, [
191+
h('p', "Near " + checkin.near),
192+
]),
193+
h('h3', {className: 'rating'}, ratingArr),
194+
]),
195+
]),
196+
h('div', { className: 'observations' }, observations),
197+
]);
198+
}

0 commit comments

Comments
 (0)