@genspectrum/dashboard-components 0.6.3 → 0.6.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -72,6 +72,10 @@ export class YearMonthDay {
72
72
  return this.text;
73
73
  }
74
74
 
75
+ englishName(): string {
76
+ return this.dayjs.format('dddd, MMMM D, YYYY');
77
+ }
78
+
75
79
  get firstDay(): YearMonthDay {
76
80
  return this;
77
81
  }
@@ -123,6 +127,10 @@ export class YearWeek {
123
127
  return this.text;
124
128
  }
125
129
 
130
+ englishName(): string {
131
+ return `Week ${this.isoWeekNumber}, ${this.isoYearNumber}`;
132
+ }
133
+
126
134
  get firstDay(): YearMonthDay {
127
135
  // "The first week of the year, hence, always contains 4 January." https://en.wikipedia.org/wiki/ISO_week_date
128
136
  const firstDay = dayjs()
@@ -135,12 +143,14 @@ export class YearWeek {
135
143
  }
136
144
 
137
145
  get lastDay(): YearMonthDay {
138
- const lastDay = dayjs()
146
+ const firstDay = dayjs()
139
147
  .year(this.isoYearNumber)
140
- .month(12)
141
- .date(31)
142
- .isoWeek(this.isoWeekNumber)
143
- .endOf('isoWeek');
148
+ .startOf('year')
149
+ .add((this.isoWeekNumber - 1) * 7, 'day')
150
+ .startOf('week')
151
+ .add(1, 'day');
152
+ const lastDay = firstDay.add(6, 'day');
153
+
144
154
  return this.cache.getYearMonthDay(lastDay.format('YYYY-MM-DD'));
145
155
  }
146
156
 
@@ -179,6 +189,10 @@ export class YearMonth {
179
189
  return this.text;
180
190
  }
181
191
 
192
+ englishName(): string {
193
+ return `${monthName(this.monthNumber)} ${this.yearNumber}`;
194
+ }
195
+
182
196
  get firstDay(): YearMonthDay {
183
197
  return this.cache.getYearMonthDay(dayjs(`${this.yearNumber}-${this.monthNumber}-01`).format('YYYY-MM-DD'));
184
198
  }
@@ -223,6 +237,10 @@ export class Year {
223
237
  return this.text;
224
238
  }
225
239
 
240
+ englishName(): string {
241
+ return this.year.toString();
242
+ }
243
+
226
244
  get firstMonth(): YearMonth {
227
245
  return this.cache.getYearMonth(`${this.year}-01`);
228
246
  }
@@ -255,6 +273,12 @@ export class Year {
255
273
  }
256
274
  }
257
275
 
276
+ function monthName(month: number): string {
277
+ return dayjs()
278
+ .month(month - 1)
279
+ .format('MMMM');
280
+ }
281
+
258
282
  export type Temporal = YearMonthDay | YearWeek | YearMonth | Year;
259
283
 
260
284
  export function generateAllDaysInRange(start: YearMonthDay, end: YearMonthDay): YearMonthDay[] {
@@ -17,6 +17,11 @@ import { PreactLitAdapterWithGridJsStyles } from '../PreactLitAdapterWithGridJsS
17
17
  *
18
18
  * The grid view shows the proportion for each mutation over date ranges.
19
19
  *
20
+ * The grid will show at max 100 rows and 200 columns for browser performance reasons.
21
+ * More data might make the browser unresponsive.
22
+ * If the numbers are exceeded, an error message will be shown.
23
+ * In both cases, the `lapisFilter` should be narrowed down to reduce the number of mutations or date ranges.
24
+ * The number of date ranges can also be reduced by selecting a larger granularity (months instead of weeks).
20
25
  */
21
26
  @customElement('gs-mutations-over-time')
22
27
  export class MutationsOverTimeComponent extends PreactLitAdapterWithGridJsStyles {