Skip to content

Commit 02a7815

Browse files
committed
Add interface files for every relevant .res file
Also remove some dead code / restructure some references that were unweild by the warning system.
1 parent 3eca2b1 commit 02a7815

File tree

137 files changed

+2388
-1610
lines changed

Some content is hidden

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

137 files changed

+2388
-1610
lines changed

src/Blog.js

Lines changed: 21 additions & 53 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Blog.res

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,13 @@
1515

1616
module Link = Next.Link
1717

18-
let rescriptDefaultImg = "https://res.cloudinary.com/dmm9n7v9f/image/upload/v1598616442/reason%20association/rescript-lang.org/art-3-rescript-launch_ovoibg.jpg"
18+
let _rescriptDefaultImg = "https://res.cloudinary.com/dmm9n7v9f/image/upload/v1598616442/reason%20association/rescript-lang.org/art-3-rescript-launch_ovoibg.jpg"
1919
let planetPreviewImg = "https://res.cloudinary.com/dmm9n7v9f/image/upload/v1587479463/Reason%20Association/reasonml.org/reasonml_art2_1280_vhzxnz.png"
2020

2121
// For encoding reasons, see https://shripadk.github.io/react/docs/jsx-gotchas.html
2222
let middleDotSpacer = " " ++ (Js.String.fromCharCode(183) ++ " ")
2323

2424
module Badge = {
25-
type color =
26-
| Turtle
27-
| Orange
28-
2925
@react.component
3026
let make = (~badge: BlogFrontmatter.Badge.t) => {
3127
let bgColor = switch badge {
@@ -229,7 +225,9 @@ module Post = {
229225
}
230226

231227
let orderByDate = (posts: array<t>): array<t> =>
232-
posts->Js.Array.copy->Js.Array2.sortInPlaceWith((a, b) => {
228+
posts
229+
->Js.Array.copy
230+
->Js.Array2.sortInPlaceWith((a, b) => {
233231
let aV = a.frontmatter.date->DateStr.toDate->Js.Date.valueOf
234232
let bV = b.frontmatter.date->DateStr.toDate->Js.Date.valueOf
235233
if aV === bV {
@@ -267,7 +265,9 @@ let default = (props: props): React.element => {
267265
<h2 className="font-bold text-night-dark text-2xl mb-2">
268266
{React.string("Some Blog Posts are Malformed!")}
269267
</h2>
270-
<p> {React.string("Any blog post with invalid data will not be displayed in production.")} </p>
268+
<p>
269+
{React.string("Any blog post with invalid data will not be displayed in production.")}
270+
</p>
271271
<div>
272272
<p className="font-bold mt-4"> {React.string("Errors:")} </p>
273273
<ul>
@@ -294,7 +294,8 @@ let default = (props: props): React.element => {
294294
let filtered = switch currentSelection {
295295
| All => posts
296296
| Archived => archived
297-
| Category(selected) => Belt.Array.keep(posts, ({frontmatter}) =>
297+
| Category(selected) =>
298+
Belt.Array.keep(posts, ({frontmatter}) =>
298299
switch Js.Null.toOption(frontmatter.category) {
299300
| Some(category) => category === selected
300301
| None => false
@@ -399,8 +400,9 @@ let default = (props: props): React.element => {
399400

400401
let getStaticProps: Next.GetStaticProps.t<props, params> = _ctx => {
401402
let authors = BlogFrontmatter.Author.getAllAuthors()
402-
let (posts, malformed, archived, availableCategories) =
403-
BlogApi.getAllPosts()->Belt.Array.reduce(([], [], [], []), (acc, postData) => {
403+
let (posts, malformed, archived, availableCategories) = BlogApi.getAllPosts()->Belt.Array.reduce(
404+
([], [], [], []),
405+
(acc, postData) => {
404406
let (posts, malformed, archived, availableCategories) = acc
405407
let id = postData.slug
406408

@@ -446,7 +448,8 @@ let getStaticProps: Next.GetStaticProps.t<props, params> = _ctx => {
446448

447449
(posts, malformed, archived, newAvailableCat)
448450
}
449-
})
451+
},
452+
)
450453

451454
let props = {
452455
posts: Post.orderByDate(posts),

src/Blog.resi

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
module Post: {
2+
type t = {
3+
id: string,
4+
frontmatter: BlogFrontmatter.t,
5+
}
6+
}
7+
8+
module Malformed: {
9+
type t = {
10+
id: string,
11+
message: string,
12+
}
13+
}
14+
15+
let planetPreviewImg: string
16+
17+
type params = {slug: string}
18+
type props = {
19+
posts: array<Post.t>,
20+
archived: array<Post.t>,
21+
malformed: array<Malformed.t>,
22+
availableCategories: array<BlogFrontmatter.Category.t>,
23+
}
24+
25+
let default: props => React.element
26+
27+
let getStaticProps: Next.GetStaticProps.t<props, params>

src/BlogArticle.js

Lines changed: 4 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/BlogArticle.res

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,6 @@ module BlogHeader = {
134134
}
135135
}
136136

137-
let cwd = Node.Process.cwd()
138-
139137
let default = (props: props) => {
140138
let {fullslug} = props
141139

0 commit comments

Comments
 (0)