Skip to content

Commit 98a4289

Browse files
committed
add site Footer, add next/prev page links (with wrap-around)
add h1 page titles on /models, /api, /how-to-contribute add figure captions to data/wbm/readme.md
1 parent 9a59191 commit 98a4289

File tree

11 files changed

+84
-30
lines changed

11 files changed

+84
-30
lines changed

data/wbm/fetch_process_wbm_dataset.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -440,9 +440,8 @@ def fix_bad_struct_index_mismatch(material_id: str) -> str:
440440
text=f"<b>dataset cropped to within +/- {e_form_cutoff} eV/atom</b>",
441441
showarrow=False,
442442
)
443-
fig.update_layout(
444-
xaxis_title="WBM formation energy (eV/atom)", margin=dict(l=10, r=10, t=40, b=10)
445-
)
443+
x_axis_title = "WBM uncorrected formation energy (eV/atom)"
444+
fig.update_layout(xaxis_title=x_axis_title, margin=dict(l=10, r=10, t=40, b=10))
446445

447446

448447
# %%

data/wbm/readme.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ The full set of processing steps used to curate the WBM test set from the raw da
2121
- remove 6 pathological structures (with 0 volume)
2222
- remove formation energy outliers below -5 and above 5 eV/atom (502 and 22 crystals respectively out of 257,487 total, including an anomaly of 500 structures at exactly -10 eV/atom)
2323

24+
<caption>WBM Formation energy distribution. 524 materials outside green dashed lines were discarded.</caption>
2425
<slot name="hist-e-form-per-atom">
2526
<img src="./2022-12-07-hist-e-form-per-atom.svg" alt="WBM formation energy histogram indicating outlier cutoffs">
2627
</slot>
@@ -71,8 +72,7 @@ materialscloud:2021.68 includes a readme file with a description of the dataset,
7172

7273
## Data Plots
7374

74-
Heatmap of elemental prevalence in WBM dataset.
75-
75+
<caption>Heatmap of elemental prevalence in WBM dataset.</caption>
7676
<slot name="wbm-elements-log">
7777
<img src="./2022-12-30-wbm-elements-log.svg" alt="Periodic table log heatmap of WBM elements">
7878
</slot>

site/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"@typescript-eslint/parser": "^5.48.0",
2626
"eslint": "^8.31.0",
2727
"eslint-plugin-svelte3": "^4.0.0",
28-
"hastscript": "^7.1.0",
28+
"hastscript": "^7.2.0",
2929
"highlight.js": "^11.7.0",
3030
"mdsvex": "^0.10.6",
3131
"prettier": "^2.8.1",
@@ -34,11 +34,11 @@
3434
"rehype-slug": "^5.1.0",
3535
"svelte": "^3.55.0",
3636
"svelte-check": "^3.0.1",
37-
"svelte-github-corner": "^0.1.0",
37+
"svelte-github-corner": "^0.2.0",
3838
"svelte-preprocess": "^5.0.0",
3939
"svelte-toc": "^0.5.1",
4040
"svelte2tsx": "^0.6.0",
41-
"sveriodic-table": "^0.1.1",
41+
"sveriodic-table": "^0.1.2",
4242
"tslib": "^2.4.1",
4343
"typescript": "^4.9.4",
4444
"vite": "^4.0.4"

site/src/app.css

+17-6
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@
1515
}
1616
body {
1717
background: var(--night);
18-
padding: calc(1ex + 2vw);
1918
font-family: -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
2019
color: var(--text-color);
2120
line-height: 1.5;
2221
}
22+
main {
23+
padding: calc(1ex + 2vw);
24+
}
2325
button {
2426
color: var(--text-color);
2527
cursor: pointer;
@@ -37,6 +39,15 @@ a {
3739
a:hover {
3840
color: orange;
3941
}
42+
a.link {
43+
padding: 0 4pt;
44+
background-color: rgba(255, 255, 255, 0.1);
45+
border-radius: 3pt;
46+
transition: 0.2s;
47+
}
48+
a.link[aria-current='page'] {
49+
color: mediumseagreen;
50+
}
4051
code {
4152
overflow-wrap: break-word;
4253
padding: 1pt 3pt;
@@ -81,11 +92,7 @@ tbody tr:nth-child(odd) {
8192
}
8293

8394
h1 {
84-
display: flex;
85-
font-size: clamp(2rem, 2rem + 2vw, 3rem);
86-
place-items: center;
87-
place-content: center;
88-
margin: 1.2em 0;
95+
text-align: center;
8996
}
9097

9198
:where(h2, h3, h4, h5, h6) {
@@ -128,3 +135,7 @@ aside.toc.desktop {
128135
left: calc(50vw + 50em / 2);
129136
max-width: 16em;
130137
}
138+
139+
caption {
140+
display: block;
141+
}

site/src/lib/Footer.svelte

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<script>
2+
import { repository } from '$site/package.json'
3+
import Icon from '@iconify/svelte'
4+
</script>
5+
6+
<footer>
7+
Maintained by <a href="https://github.com/janosh">Janosh Riebesell</a>
8+
<a href="mailto:[email protected]"><Icon icon="mdi:email" inline /></a>
9+
on
10+
<a href={repository}><Icon icon="octicon:mark-github" inline /></a>
11+
</footer>
12+
13+
<style>
14+
footer {
15+
display: flex;
16+
gap: 1ex;
17+
place-content: center;
18+
place-items: center;
19+
padding: 3vh 3vw;
20+
background: #00061a;
21+
}
22+
</style>

site/src/lib/Nav.svelte

+2-11
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
</script>
1212

1313
<nav>
14-
{#each routes as route, idx}
14+
{#each routes as href, idx}
1515
{#if idx > 0}<strong>&bull;</strong>{/if}
16-
<a href={route} aria-current={is_current(route)}>{route}</a>
16+
<a {href} aria-current={is_current(href)} class="link">{href}</a>
1717
{/each}
1818
</nav>
1919

@@ -27,13 +27,4 @@
2727
flex-wrap: wrap;
2828
font-size: 1.1em;
2929
}
30-
nav > a {
31-
padding: 0 4pt;
32-
background-color: rgba(255, 255, 255, 0.1);
33-
border-radius: 3pt;
34-
transition: 0.2s;
35-
}
36-
nav > a[aria-current='page'] {
37-
color: mediumseagreen;
38-
}
3930
</style>

site/src/routes/+layout.svelte

+20-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<script lang="ts">
22
import { page } from '$app/stores'
3+
import Footer from '$lib/Footer.svelte'
34
import Nav from '$lib/Nav.svelte'
45
import { repository } from '$site/package.json'
56
import { onMount } from 'svelte'
@@ -23,6 +24,11 @@
2324
$: headingSelector = `main :is(${
2425
$page.url.pathname === `/api` ? `h1, ` : ``
2526
}h2, h3, h4):not(.toc-exclude)`
27+
28+
$: current_route_idx = routes.findIndex((route) => route === $page.url.pathname)
29+
// get prev/next route with wrap-around
30+
$: next_route = routes[(current_route_idx + 1) % routes.length]
31+
$: prev_route = routes[(current_route_idx - 1 + routes.length) % routes.length]
2632
</script>
2733

2834
<Toc {headingSelector} breakpoint={1250} warnOnEmpty={false} />
@@ -33,12 +39,19 @@
3339

3440
<GitHubCorner href={repository} />
3541

36-
<Nav {routes} />
37-
3842
<main>
43+
<Nav {routes} />
44+
3945
<slot />
46+
47+
<section>
48+
<a href={prev_route} class="link">&laquo; {prev_route}</a>
49+
<a href={next_route} class="link">{next_route} &raquo;</a>
50+
</section>
4051
</main>
4152

53+
<Footer />
54+
4255
<style>
4356
main {
4457
margin: auto;
@@ -59,4 +72,9 @@
5972
a[href='/']:hover {
6073
background-color: rgba(255, 255, 255, 0.2);
6174
}
75+
section {
76+
display: flex;
77+
justify-content: space-between;
78+
margin-top: 4em;
79+
}
6280
</style>

site/src/routes/about-the-test-set/+page.svelte

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
gap: 1ex;
4444
position: absolute;
4545
left: 50%;
46-
transform: translateX(-50%);
46+
transform: translateX(-50%) translateY(100%);
4747
z-index: 1;
4848
}
4949
strong {

site/src/routes/api/+page.svelte

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1+
<h1>API</h1>
2+
13
{#each Object.values(import.meta.glob(`./*.md`, { eager: true })) as file}
24
<svelte:component this={file?.default} />
35
{/each}
46

57
<style>
8+
/* select all but first module h1s */
9+
:global(h1[id^='module-']:not(:nth-of-type(2))) {
10+
margin: 4em 0 0;
11+
}
612
:global(hr) {
713
border: none;
8-
margin: 3em;
914
}
1015
:global(code) {
1116
line-height: 1em;

site/src/routes/how-to-contribute/+page.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# How to contribute
2+
13
## 🔨 &thinsp; Installation
24

35
The recommended way to acquire the train and test data for this benchmark is through its Python package [available onPyPI](https://pypi.org/project/matbench-discovery):
@@ -165,3 +167,7 @@ git commit -m 'add <model_name> to Matbench Discovery leaderboard'
165167
```
166168

167169
And you're done! Once tests pass and the PR is merged, your model will be added to the leaderboard! 🎉
170+
171+
## Troubleshooting
172+
173+
Having problems using or contributing to the project? Please [open an issue on GitHub](https://github.com/janosh/matbench-discovery/issues). We're happy to help!

site/src/routes/models/+page.svelte

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
export let data: PageData
77
</script>
88

9+
<h1>Models</h1>
10+
911
<ol>
1012
{#each data.model_metas as [key, meta], idx}
1113
{@const { repo, doi, preprint, url, date_added } = meta}
@@ -20,7 +22,7 @@
2022
{/each}
2123
</nav>
2224
<p>
23-
Date added: {new Date().toISOString().split(`T`)[0]}
25+
Date added: {new Date(date_added).toISOString().split(`T`)[0]}
2426
&nbsp;&bull;&nbsp; Benchmark version: {meta.matbench_discovery_version}
2527
</p>
2628
<strong>Authors</strong>

0 commit comments

Comments
 (0)