@@ -22,7 +22,8 @@ defmodule ComponentsGuideWeb.CalendarController do
2222 }
2323
2424 react = % {
25- react18: % { release: { 2022 , 3 , 29 } }
25+ react18: % { release: { 2022 , 3 , 29 } } ,
26+ react_query4: % { release: { 2022 , 7 , 18 } } ,
2627 }
2728
2829 jest = % {
@@ -90,6 +91,7 @@ defmodule ComponentsGuideWeb.CalendarController do
9091 deno1_23: "https://deno.com/blog/v1.23" ,
9192 deno1_24: "https://deno.com/blog/v1.24" ,
9293 react18: "https://reactjs.org/blog/2022/03/29/react-v18.html" ,
94+ react_query4: "https://tanstack.com/blog/announcing-tanstack-query-v4" ,
9395 firefox99: "https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Releases/99" ,
9496 firefox100: "https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Releases/100" ,
9597 firefox101: "https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Releases/101" ,
@@ -102,14 +104,44 @@ defmodule ComponentsGuideWeb.CalendarController do
102104 jest28: "https://jestjs.io/blog/2022/04/25/jest-28"
103105 }
104106
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+
105119 today = Date . utc_today ( )
106120
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+
107138 assigns = [
108139 page_title:
109140 "Calendar of when important tools are released, become LTS, and reach end-of-life" ,
110141 today: today ,
111142 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
113145 ]
114146
115147 render ( conn , "index.html" , assigns )
@@ -188,6 +220,31 @@ defmodule ComponentsGuideWeb.CalendarView do
188220 end
189221 end
190222
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+
191248 defp week_diff ( date ) do
192249 today = Date . utc_today ( )
193250 { current_year , current_week } = :calendar . iso_week_number ( Date . to_erl ( today ) )
@@ -212,6 +269,7 @@ defmodule ComponentsGuideWeb.CalendarView do
212269 << "postgres" <> version >> -> "Postgres #{ pretty_version ( version ) } "
213270 << "swift" <> version >> -> "Swift #{ pretty_version ( version ) } "
214271 << "go" <> version >> -> "Go #{ pretty_version ( version ) } "
272+ << "react_query" <> version >> -> "React Query #{ pretty_version ( version ) } "
215273 << "react" <> version >> -> "React #{ pretty_version ( version ) } "
216274 << "jest" <> version >> -> "Jest #{ pretty_version ( version ) } "
217275 << "aws_lambda_nodejs" <> version >> -> "AWS Lambda Node.js #{ pretty_version ( version ) } "
@@ -250,6 +308,9 @@ defmodule ComponentsGuideWeb.CalendarView do
250308 << "go" <> _ >> ->
251309 "https://cdn.jsdelivr.net/npm/simple-icons@v6/icons/go.svg"
252310
311+ << "react_query" <> _ >> ->
312+ "https://cdn.jsdelivr.net/npm/simple-icons@v7/icons/reactquery.svg"
313+
253314 << "react" <> _ >> ->
254315 "https://cdn.jsdelivr.net/npm/simple-icons@v6/icons/react.svg"
255316
0 commit comments