|
8 | 8 | title: string; |
9 | 9 | presenter: string; |
10 | 10 | organization?: string; |
| 11 | + type: "ponencia" | "taller" | "actividad" | "torneo"; |
11 | 12 | draft?: boolean; |
12 | 13 | date: string; |
13 | 14 | start: string; |
|
37 | 38 | ); |
38 | 39 |
|
39 | 40 | const articles: Record<string, Article[]> = {}; |
| 41 | + const activities: Article[] = []; |
| 42 | + const tournaments: Article[] = []; |
40 | 43 | for (const time of times) { |
41 | 44 | articles[time.toString({ smallestUnit: "minute" })] = []; |
42 | 45 | } |
|
53 | 56 | const start = Temporal.PlainTime.from(metadata.start); |
54 | 57 | const end = Temporal.PlainTime.from(metadata.end); |
55 | 58 |
|
| 59 | + if (metadata.type === "actividad" || metadata.type === "torneo") { |
| 60 | + let i = 0; |
| 61 | + if (metadata.type === "actividad") { |
| 62 | + while ( |
| 63 | + i < activities.length && |
| 64 | + Temporal.PlainTime.compare(metadata.start, activities[i].start) > 0 |
| 65 | + ) { |
| 66 | + i++; |
| 67 | + } |
| 68 | + activities.splice(i, 0, { ...metadata, slug, date, start, end }); |
| 69 | + } else { |
| 70 | + while ( |
| 71 | + i < tournaments.length && |
| 72 | + Temporal.PlainTime.compare(metadata.start, tournaments[i].start) > 0 |
| 73 | + ) { |
| 74 | + i++; |
| 75 | + } |
| 76 | + tournaments.splice(i, 0, { ...metadata, slug, date, start, end }); |
| 77 | + } |
| 78 | + } |
| 79 | +
|
56 | 80 | let i = 0; |
57 | 81 | const dates = Object.keys(articles); |
58 | 82 | while ( |
|
80 | 104 | } |
81 | 105 | </script> |
82 | 106 |
|
83 | | -<table> |
84 | | - <thead> |
85 | | - <tr> |
86 | | - <th scope="col"></th> |
87 | | - <th scope="col">Lunes</th> |
88 | | - <th scope="col">Martes</th> |
89 | | - <th scope="col">Miércoles</th> |
90 | | - <th scope="col">Jueves</th> |
91 | | - <th scope="col">Viernes</th> |
92 | | - </tr> |
93 | | - </thead> |
94 | | - <tbody> |
95 | | - {#each Object.entries(articles) as [time, articleList]} |
| 107 | +<h3>Ponencias y Talleres</h3> |
| 108 | +<table-container> |
| 109 | + <table> |
| 110 | + <thead> |
96 | 111 | <tr> |
97 | | - <th> |
98 | | - {time} |
99 | | - - |
100 | | - {Temporal.PlainTime.from(time) |
101 | | - .add(Temporal.Duration.from({ minutes: 45 })) |
102 | | - .toString({ smallestUnit: "minutes" })} |
103 | | - </th> |
104 | | - {#each articleList as article} |
105 | | - <td rowspan={getSpan(article.end.since(article.start))}> |
106 | | - <p> |
107 | | - <a href="/events/{article.slug}"> |
108 | | - {article.title} |
109 | | - </a> |
110 | | - </p> |
111 | | - {#if article.organization} |
112 | | - <small>{article.organization}</small> |
113 | | - {/if} |
114 | | - </td> |
115 | | - {/each} |
| 112 | + <th scope="col"></th> |
| 113 | + <th scope="col">Lunes</th> |
| 114 | + <th scope="col">Martes</th> |
| 115 | + <th scope="col">Miércoles</th> |
| 116 | + <th scope="col">Jueves</th> |
| 117 | + <th scope="col">Viernes</th> |
116 | 118 | </tr> |
| 119 | + </thead> |
| 120 | + <tbody> |
| 121 | + {#each Object.entries(articles) as [time, articleList]} |
| 122 | + <tr> |
| 123 | + <th> |
| 124 | + {time} |
| 125 | + - |
| 126 | + {Temporal.PlainTime.from(time) |
| 127 | + .add(Temporal.Duration.from({ minutes: 45 })) |
| 128 | + .toString({ smallestUnit: "minutes" })} |
| 129 | + </th> |
| 130 | + {#each articleList as article} |
| 131 | + <td rowspan={getSpan(article.end.since(article.start))}> |
| 132 | + <p> |
| 133 | + <a href="/events/{article.slug}"> |
| 134 | + {article.title} |
| 135 | + </a> |
| 136 | + </p> |
| 137 | + {#if article.organization} |
| 138 | + <small>{article.organization}</small> |
| 139 | + {/if} |
| 140 | + </td> |
| 141 | + {/each} |
| 142 | + </tr> |
| 143 | + {/each} |
| 144 | + </tbody> |
| 145 | + </table> |
| 146 | +</table-container> |
| 147 | +<secondary-events> |
| 148 | + <div> |
| 149 | + <h3>Actividades</h3> |
| 150 | + {#each activities as activity} |
| 151 | + <article> |
| 152 | + <a href="/events/{activity.slug}"> |
| 153 | + <h4>{activity.title}</h4> |
| 154 | + </a> |
| 155 | + <strong> |
| 156 | + <p> |
| 157 | + {activity.date.toLocaleString("es", { |
| 158 | + weekday: "long", |
| 159 | + day: "numeric", |
| 160 | + })} |
| 161 | + </p> |
| 162 | + <p> |
| 163 | + <time datetime="{activity.date}T{activity.start}"> |
| 164 | + {activity.start.toString({ smallestUnit: "minutes" })} |
| 165 | + </time> |
| 166 | + - |
| 167 | + <time datetime="{activity.date}T{activity.end}"> |
| 168 | + {activity.end.toString({ smallestUnit: "minutes" })} |
| 169 | + </time> |
| 170 | + </p> |
| 171 | + </strong> |
| 172 | + </article> |
117 | 173 | {/each} |
118 | | - </tbody> |
119 | | -</table> |
| 174 | + </div> |
| 175 | + <div> |
| 176 | + <h3>Torneos</h3> |
| 177 | + {#each tournaments as tournament} |
| 178 | + <article> |
| 179 | + <a href="/events/{tournament.slug}"> |
| 180 | + <h4>{tournament.title}</h4> |
| 181 | + </a> |
| 182 | + <strong> |
| 183 | + <p> |
| 184 | + {tournament.date.toLocaleString("es", { |
| 185 | + weekday: "long", |
| 186 | + day: "numeric", |
| 187 | + })} |
| 188 | + </p> |
| 189 | + <p> |
| 190 | + <time datetime="{tournament.date}T{tournament.start}"> |
| 191 | + {tournament.start.toString({ smallestUnit: "minutes" })} |
| 192 | + </time> |
| 193 | + - |
| 194 | + <time datetime="{tournament.date}T{tournament.end}"> |
| 195 | + {tournament.end.toString({ smallestUnit: "minutes" })} |
| 196 | + </time> |
| 197 | + </p> |
| 198 | + </strong> |
| 199 | + </article> |
| 200 | + {/each} |
| 201 | + </div> |
| 202 | +</secondary-events> |
120 | 203 |
|
121 | 204 | <style> |
| 205 | + table-container { |
| 206 | + display: block; |
| 207 | + height: auto; |
| 208 | + max-width: 75%; |
| 209 | + overflow-x: auto; |
| 210 | + @media (width < 768px) { |
| 211 | + max-width: calc(100% - 16px); |
| 212 | + } |
| 213 | + } |
| 214 | +
|
122 | 215 | table { |
123 | 216 | table-layout: fixed; |
124 | 217 | min-width: 1000px; |
|
150 | 243 | color: light-dark(#111111, lightgray); |
151 | 244 | } |
152 | 245 | } |
| 246 | +
|
| 247 | + secondary-events { |
| 248 | + display: flex; |
| 249 | + flex-direction: row; |
| 250 | + flex-wrap: wrap; |
| 251 | + gap: 20px; |
| 252 | + h3 { |
| 253 | + text-align: center; |
| 254 | + } |
| 255 | + h4 { |
| 256 | + font-size: 1.2em; |
| 257 | + margin: 1em 0; |
| 258 | + max-width: 400px; |
| 259 | + } |
| 260 | + strong { |
| 261 | + text-transform: capitalize; |
| 262 | + text-align: end; |
| 263 | + } |
| 264 | + p { |
| 265 | + margin: 14px 0; |
| 266 | + &:last-child { |
| 267 | + text-wrap: nowrap; |
| 268 | + } |
| 269 | + } |
| 270 | + article { |
| 271 | + display: flex; |
| 272 | + flex-direction: row; |
| 273 | + align-items: center; |
| 274 | + gap: 1em; |
| 275 | + padding: 0 16px; |
| 276 | + justify-content: space-between; |
| 277 | + border: var(--border); |
| 278 | + border-bottom: none; |
| 279 | + background-color: light-dark(#eeeeee, #222222); |
| 280 | + &:nth-child(odd) { |
| 281 | + background-color: light-dark(#fafafa, #2e2e2e); |
| 282 | + } |
| 283 | + &:last-child { |
| 284 | + border-bottom: var(--border); |
| 285 | + } |
| 286 | + } |
| 287 | + } |
153 | 288 | </style> |
0 commit comments