1
1
module Route.Index exposing (ActionData , Data , Model , Msg , footer , route )
2
2
3
+ import Article
3
4
import BackendTask exposing (BackendTask )
4
5
import BackendTask.File
5
6
import Colours
@@ -9,9 +10,8 @@ import FatalError exposing (FatalError)
9
10
import FeatherIcons
10
11
import Head
11
12
import Head.Seo as Seo
12
- import Html.Styled as Html exposing (Attribute , Html , styled )
13
- import Html.Styled.Attributes exposing (css , media )
14
- import Html.Styled.Events exposing (onClick )
13
+ import Html.Styled as Html exposing (Html )
14
+ import Html.Styled.Attributes exposing (css )
15
15
import Icon
16
16
import Icosahedron
17
17
import Pages.Url
@@ -40,6 +40,12 @@ type alias RouteParams =
40
40
41
41
42
42
type alias Data =
43
+ { projects : ProjectData
44
+ , blogPosts : BlogData
45
+ }
46
+
47
+
48
+ type alias ProjectData =
43
49
{ -- top 3 "pinned" projects
44
50
pinnedProjects : List Project
45
51
@@ -48,6 +54,10 @@ type alias Data =
48
54
}
49
55
50
56
57
+ type alias BlogData =
58
+ List ( Route . Route , Article . Metadata )
59
+
60
+
51
61
type alias ActionData =
52
62
{}
53
63
@@ -110,6 +120,13 @@ subscriptions routeParams path shared model =
110
120
111
121
data : BackendTask FatalError Data
112
122
data =
123
+ BackendTask . succeed Data
124
+ |> BackendTask . andMap getProjects
125
+ |> BackendTask . andMap getBlogPosts
126
+
127
+
128
+ getProjects : BackendTask FatalError ProjectData
129
+ getProjects =
113
130
BackendTask . File . rawFile " projects.yml"
114
131
|> BackendTask . allowFatal
115
132
|> BackendTask . andThen Project . getProjects
@@ -118,6 +135,13 @@ data =
118
135
( \ data_ -> { pinnedProjects = data_. featured, homeProjects = data_. home } )
119
136
120
137
138
+ getBlogPosts : BackendTask FatalError BlogData
139
+ getBlogPosts =
140
+ Article . allMetadata
141
+ |> BackendTask . allowFatal
142
+ |> BackendTask . map ( List . take 3 )
143
+
144
+
121
145
head :
122
146
App Data ActionData RouteParams
123
147
-> List Head . Tag
@@ -194,10 +218,8 @@ view app shared model =
194
218
, property " gap" " 4em"
195
219
]
196
220
]
197
- [ about
198
- , projects app. data
199
-
200
- -- , blog
221
+ [ blog app. data. blogPosts
222
+ , projects app. data. projects
201
223
, footer
202
224
]
203
225
]
@@ -236,7 +258,7 @@ jumbotron =
236
258
, fontSize ( px 25 )
237
259
]
238
260
]
239
- [ Html . text " Welcome to my website! I am a CS Student at the University of Alberta . I enjoy making webapps, primarily with React and Elm, and I'm also a big Docker + DevOps fan." ]
261
+ [ Html . text " Welcome to my website! I'm a software engineer currently at InEight . I enjoy making webapps, primarily with React and Elm, and I'm also a big Docker + DevOps fan. I hope you enjoy your time here! " ]
240
262
, jumbotronNavbar
241
263
, Icon . view
242
264
[ css [ displayFlex, flexDirection column, alignItems center ] ]
@@ -290,10 +312,8 @@ jumbotronNavbar : Html msg
290
312
jumbotronNavbar =
291
313
let
292
314
navItems =
293
- [ ( " About " , " #about " , False )
315
+ [ ( " Blog " , " #blog " , False )
294
316
, ( " Projects" , " #projects" , False )
295
-
296
- -- , ( "Blog", "#blog", False )
297
317
, ( " Resume" , " https://joshuaji.com/resume/Joshua%20Ji%20Resume.pdf" , True )
298
318
]
299
319
in
@@ -341,47 +361,49 @@ icosahedron model =
341
361
342
362
343
363
344
- -- -- ABOUT
364
+ -- -- BLOG
345
365
346
366
347
- about : Html msg
348
- about =
349
- let
350
- textBlock =
351
- styled Html . p
352
- [ fontSize ( em 1.3 ) ]
353
- in
367
+ blog : BlogData -> Html msg
368
+ blog data_ =
354
369
Html . div
355
370
[ css
356
371
[ Util . flexDirection Util . Column
357
372
, property " gap" " 2em"
358
373
]
359
374
]
360
- [ Util . linkedHeader " about" " About"
361
- , textBlock [] [ Html . text " I started off with HTML, CSS and Javascript: making blogs, web apps, or anything that seemed cool to me." ]
362
- , textBlock []
363
- [ Html . text " Currently, I use "
364
- , Util . textLink " https://elm-lang.org/" " Elm"
365
- , Html . text " and Typescript for most of my projects, and I'm learning Haskell, Purescript and Rust on my free time."
375
+ [ Util . linkedHeader " blog" " Blog"
376
+ , Html . h2 [] [ Html . text " 📅 Recent Posts" ]
377
+ , recentPosts data_
378
+ , Html . div
379
+ [ css
380
+ [ Util . flexDirection Util . Row
381
+ , alignItems center
382
+ , fontSize ( em 1.25 )
383
+ ]
366
384
]
367
- , textBlock []
368
- [ Html . text " I've recently been taking a deep dive into DevOps. I've recently interned at "
369
- , Util . textLink " https://www.nanosticsdx.com/" " Nanostics"
370
- , Html . text " where I worked on deploying and maintaining a ML model on Azure, as well as creating a webapp interface for it."
385
+ [ Util . textRouteLink Route . Blog " All posts"
386
+ , Icon . view [] { icon = FeatherIcons . chevronRight, strokeWidth = 2 , size = 20 , msg = Nothing }
371
387
]
372
- , textBlock []
373
- [ Html . text " In my free time, I like to play volleyball and walk my dog. I always try to find time to read, check me out on "
374
- , Util . textLink " https://hardcover.app/@OshuaJay" " Hardcover"
375
- , Html . text " !"
388
+ ]
389
+
390
+
391
+ recentPosts : BlogData -> Html msg
392
+ recentPosts data_ =
393
+ Html . div
394
+ [ css
395
+ [ Util . flexDirection Util . Column
396
+ , property " gap" " 1em"
376
397
]
377
398
]
399
+ ( List . map Article . view data_)
378
400
379
401
380
402
381
403
-- -- PROJECTS
382
404
383
405
384
- projects : Data -> Html msg
406
+ projects : ProjectData -> Html msg
385
407
projects data_ =
386
408
Html . div
387
409
[ css
@@ -399,7 +421,7 @@ projects data_ =
399
421
, fontSize ( em 1.25 )
400
422
]
401
423
]
402
- [ Util . textRouteLink Route . AllProjects " See more projects"
424
+ [ Util . textRouteLink Route . AllProjects " More projects"
403
425
, Icon . view [] { icon = FeatherIcons . chevronRight, strokeWidth = 2 , size = 20 , msg = Nothing }
404
426
]
405
427
@@ -419,38 +441,6 @@ featuredProjects projs =
419
441
( List . map Project . viewFeatured projs)
420
442
421
443
422
- homeProjects : List Project -> Html msg
423
- homeProjects projs =
424
- Html . div
425
- [ css
426
- [ Util . flexDirection Util . Column
427
- , alignItems center
428
- , justifyContent center
429
- , property " gap" " 0.75em"
430
- ]
431
- ]
432
- ( List . map Project . view projs)
433
-
434
-
435
-
436
- -- -- BLOG
437
-
438
-
439
- blog : Html msg
440
- blog =
441
- Html . div
442
- [ css
443
- [ Util . flexDirection Util . Column
444
- , property " gap" " 2em"
445
- ]
446
- ]
447
- [ Util . linkedHeader " blog" " Blog"
448
- , Html . h2 [] [ Html . text " Work in progress..." ]
449
-
450
- -- , Html.h2 [] [ Html.text "📅 Recent Posts" ]
451
- ]
452
-
453
-
454
444
455
445
-- -- FOOTER
456
446
0 commit comments