@@ -22,7 +22,8 @@ defmodule ComponentsGuideWeb.CalendarController do
22
22
}
23
23
24
24
react = % {
25
- react18: % { release: { 2022 , 3 , 29 } }
25
+ react18: % { release: { 2022 , 3 , 29 } } ,
26
+ react_query4: % { release: { 2022 , 7 , 18 } } ,
26
27
}
27
28
28
29
jest = % {
@@ -90,6 +91,7 @@ defmodule ComponentsGuideWeb.CalendarController do
90
91
deno1_23: "https://deno.com/blog/v1.23" ,
91
92
deno1_24: "https://deno.com/blog/v1.24" ,
92
93
react18: "https://reactjs.org/blog/2022/03/29/react-v18.html" ,
94
+ react_query4: "https://tanstack.com/blog/announcing-tanstack-query-v4" ,
93
95
firefox99: "https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Releases/99" ,
94
96
firefox100: "https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Releases/100" ,
95
97
firefox101: "https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Releases/101" ,
@@ -102,14 +104,44 @@ defmodule ComponentsGuideWeb.CalendarController do
102
104
jest28: "https://jestjs.io/blog/2022/04/25/jest-28"
103
105
}
104
106
107
+ dates_to_items =
108
+ for group <- groups do
109
+ for { id , % { release: yymmdd } } <- group do
110
+ { yymmdd , id }
111
+ end
112
+ end
113
+ |> List . flatten ( )
114
+ |> Enum . group_by ( fn { k , _ } -> k end , fn { _ , v } -> v end )
115
+ |> Map . new ( )
116
+
117
+ IO . inspect ( dates_to_items )
118
+
105
119
today = Date . utc_today ( )
106
120
121
+ calendar_extra = fn date ->
122
+ yymmdd = Date . to_erl ( date )
123
+
124
+ ids = Map . get ( dates_to_items , yymmdd , [ ] )
125
+ ComponentsGuideWeb.CalendarView . icon_links ( ids , links )
126
+
127
+ # case Map.get(dates_to_items, yymmdd) do
128
+ # nil ->
129
+ # ""
130
+
131
+ # ids ->
132
+ # for id <- ids do
133
+ # ComponentsGuideWeb.CalendarView.icon_link(id)
134
+ # end
135
+ # end
136
+ end
137
+
107
138
assigns = [
108
139
page_title:
109
140
"Calendar of when important tools are released, become LTS, and reach end-of-life" ,
110
141
today: today ,
111
142
current_week: today |> Date . to_erl ( ) |> iso_week_number ( ) ,
112
- list: create_list ( groups , links )
143
+ list: create_list ( groups , links ) ,
144
+ calendar_extra: calendar_extra
113
145
]
114
146
115
147
render ( conn , "index.html" , assigns )
@@ -188,6 +220,31 @@ defmodule ComponentsGuideWeb.CalendarView do
188
220
end
189
221
end
190
222
223
+ def icon_link ( id , link ) do
224
+ assigns = % {
225
+ what: pretty_name ( id ) ,
226
+ href: link || "#" ,
227
+ icon: pretty_icon ( id )
228
+ }
229
+
230
+ ~H"""
231
+ < a href = { @ href } >
232
+ < span class = "text-3xl not-prose " > <%= @ icon %> </ span >
233
+ <%= @ what %>
234
+ </ a >
235
+ """
236
+ end
237
+
238
+ def icon_links ( ids , links ) do
239
+ assigns = % { ids: ids }
240
+
241
+ ~H"""
242
+ <%= for id <- @ ids do %>
243
+ <%= ComponentsGuideWeb.CalendarView . icon_link ( id , Map . get ( links , id ) ) %>
244
+ <% end %>
245
+ """
246
+ end
247
+
191
248
defp week_diff ( date ) do
192
249
today = Date . utc_today ( )
193
250
{ current_year , current_week } = :calendar . iso_week_number ( Date . to_erl ( today ) )
@@ -212,6 +269,7 @@ defmodule ComponentsGuideWeb.CalendarView do
212
269
<< "postgres" <> version >> -> "Postgres #{ pretty_version ( version ) } "
213
270
<< "swift" <> version >> -> "Swift #{ pretty_version ( version ) } "
214
271
<< "go" <> version >> -> "Go #{ pretty_version ( version ) } "
272
+ << "react_query" <> version >> -> "React Query #{ pretty_version ( version ) } "
215
273
<< "react" <> version >> -> "React #{ pretty_version ( version ) } "
216
274
<< "jest" <> version >> -> "Jest #{ pretty_version ( version ) } "
217
275
<< "aws_lambda_nodejs" <> version >> -> "AWS Lambda Node.js #{ pretty_version ( version ) } "
@@ -250,6 +308,9 @@ defmodule ComponentsGuideWeb.CalendarView do
250
308
<< "go" <> _ >> ->
251
309
"https://cdn.jsdelivr.net/npm/simple-icons@v6/icons/go.svg"
252
310
311
+ << "react_query" <> _ >> ->
312
+ "https://cdn.jsdelivr.net/npm/simple-icons@v7/icons/reactquery.svg"
313
+
253
314
<< "react" <> _ >> ->
254
315
"https://cdn.jsdelivr.net/npm/simple-icons@v6/icons/react.svg"
255
316
0 commit comments