@genspectrum/dashboard-components 0.8.1 → 0.8.3

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.
@@ -547,8 +547,8 @@ export declare class MutationsComponent extends PreactLitAdapterWithGridJsStyles
547
547
  *
548
548
  * The grid view shows the proportion for each mutation over date ranges.
549
549
  *
550
- * The grid limits the number of rows columns for browser performance reasons.
551
- * Too much data might make the browser unresponsive.
550
+ * The grid limits the number of rows and columns for browser performance reasons as
551
+ * too much data might make the browser unresponsive.
552
552
  *
553
553
  * The number of columns is limited to 200.
554
554
  * If this number are exceeded, an error message will be shown.
@@ -1029,10 +1029,7 @@ declare global {
1029
1029
 
1030
1030
  declare global {
1031
1031
  interface HTMLElementTagNameMap {
1032
- 'gs-location-filter': LocationFilterComponent;
1033
- }
1034
- interface HTMLElementEventMap {
1035
- 'gs-location-changed': CustomEvent<Record<string, string>>;
1032
+ 'gs-mutation-comparison-component': MutationComparisonComponent;
1036
1033
  }
1037
1034
  }
1038
1035
 
@@ -1040,7 +1037,7 @@ declare global {
1040
1037
  declare global {
1041
1038
  namespace JSX {
1042
1039
  interface IntrinsicElements {
1043
- 'gs-location-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1040
+ 'gs-mutation-comparison-component': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1044
1041
  }
1045
1042
  }
1046
1043
  }
@@ -1048,10 +1045,7 @@ declare global {
1048
1045
 
1049
1046
  declare global {
1050
1047
  interface HTMLElementTagNameMap {
1051
- 'gs-date-range-selector': DateRangeSelectorComponent;
1052
- }
1053
- interface HTMLElementEventMap {
1054
- 'gs-date-range-changed': CustomEvent<Record<string, string>>;
1048
+ 'gs-prevalence-over-time': PrevalenceOverTimeComponent;
1055
1049
  }
1056
1050
  }
1057
1051
 
@@ -1059,7 +1053,7 @@ declare global {
1059
1053
  declare global {
1060
1054
  namespace JSX {
1061
1055
  interface IntrinsicElements {
1062
- 'gs-date-range-selector': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1056
+ 'gs-prevalence-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1063
1057
  }
1064
1058
  }
1065
1059
  }
@@ -1067,10 +1061,7 @@ declare global {
1067
1061
 
1068
1062
  declare global {
1069
1063
  interface HTMLElementTagNameMap {
1070
- 'gs-text-input': TextInputComponent;
1071
- }
1072
- interface HTMLElementEventMap {
1073
- 'gs-text-input-changed': CustomEvent<Record<string, string>>;
1064
+ 'gs-mutations-component': MutationsComponent;
1074
1065
  }
1075
1066
  }
1076
1067
 
@@ -1078,7 +1069,7 @@ declare global {
1078
1069
  declare global {
1079
1070
  namespace JSX {
1080
1071
  interface IntrinsicElements {
1081
- 'gs-text-input': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1072
+ 'gs-mutations-component': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1082
1073
  }
1083
1074
  }
1084
1075
  }
@@ -1086,10 +1077,7 @@ declare global {
1086
1077
 
1087
1078
  declare global {
1088
1079
  interface HTMLElementTagNameMap {
1089
- 'gs-mutation-filter': MutationFilterComponent;
1090
- }
1091
- interface HTMLElementEventMap {
1092
- 'gs-mutation-filter-changed': CustomEvent<SelectedMutationFilterStrings>;
1080
+ 'gs-relative-growth-advantage': RelativeGrowthAdvantageComponent;
1093
1081
  }
1094
1082
  }
1095
1083
 
@@ -1097,7 +1085,7 @@ declare global {
1097
1085
  declare global {
1098
1086
  namespace JSX {
1099
1087
  interface IntrinsicElements {
1100
- 'gs-mutation-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1088
+ 'gs-relative-growth-advantage': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1101
1089
  }
1102
1090
  }
1103
1091
  }
@@ -1105,10 +1093,7 @@ declare global {
1105
1093
 
1106
1094
  declare global {
1107
1095
  interface HTMLElementTagNameMap {
1108
- 'gs-lineage-filter': LineageFilterComponent;
1109
- }
1110
- interface HTMLElementEventMap {
1111
- 'gs-lineage-filter-changed': CustomEvent<Record<string, string>>;
1096
+ 'gs-aggregate-component': AggregateComponent;
1112
1097
  }
1113
1098
  }
1114
1099
 
@@ -1116,7 +1101,7 @@ declare global {
1116
1101
  declare global {
1117
1102
  namespace JSX {
1118
1103
  interface IntrinsicElements {
1119
- 'gs-lineage-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1104
+ 'gs-aggregate-component': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1120
1105
  }
1121
1106
  }
1122
1107
  }
@@ -1124,7 +1109,7 @@ declare global {
1124
1109
 
1125
1110
  declare global {
1126
1111
  interface HTMLElementTagNameMap {
1127
- 'gs-mutation-comparison-component': MutationComparisonComponent;
1112
+ 'gs-number-sequences-over-time': NumberSequencesOverTimeComponent;
1128
1113
  }
1129
1114
  }
1130
1115
 
@@ -1132,7 +1117,7 @@ declare global {
1132
1117
  declare global {
1133
1118
  namespace JSX {
1134
1119
  interface IntrinsicElements {
1135
- 'gs-mutation-comparison-component': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1120
+ 'gs-number-sequences-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1136
1121
  }
1137
1122
  }
1138
1123
  }
@@ -1140,7 +1125,7 @@ declare global {
1140
1125
 
1141
1126
  declare global {
1142
1127
  interface HTMLElementTagNameMap {
1143
- 'gs-prevalence-over-time': PrevalenceOverTimeComponent;
1128
+ 'gs-mutations-over-time': MutationsOverTimeComponent;
1144
1129
  }
1145
1130
  }
1146
1131
 
@@ -1148,7 +1133,7 @@ declare global {
1148
1133
  declare global {
1149
1134
  namespace JSX {
1150
1135
  interface IntrinsicElements {
1151
- 'gs-prevalence-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1136
+ 'gs-mutations-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1152
1137
  }
1153
1138
  }
1154
1139
  }
@@ -1156,7 +1141,10 @@ declare global {
1156
1141
 
1157
1142
  declare global {
1158
1143
  interface HTMLElementTagNameMap {
1159
- 'gs-mutations-component': MutationsComponent;
1144
+ 'gs-date-range-selector': DateRangeSelectorComponent;
1145
+ }
1146
+ interface HTMLElementEventMap {
1147
+ 'gs-date-range-changed': CustomEvent<Record<string, string>>;
1160
1148
  }
1161
1149
  }
1162
1150
 
@@ -1164,7 +1152,7 @@ declare global {
1164
1152
  declare global {
1165
1153
  namespace JSX {
1166
1154
  interface IntrinsicElements {
1167
- 'gs-mutations-component': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1155
+ 'gs-date-range-selector': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1168
1156
  }
1169
1157
  }
1170
1158
  }
@@ -1172,7 +1160,10 @@ declare global {
1172
1160
 
1173
1161
  declare global {
1174
1162
  interface HTMLElementTagNameMap {
1175
- 'gs-relative-growth-advantage': RelativeGrowthAdvantageComponent;
1163
+ 'gs-location-filter': LocationFilterComponent;
1164
+ }
1165
+ interface HTMLElementEventMap {
1166
+ 'gs-location-changed': CustomEvent<Record<string, string>>;
1176
1167
  }
1177
1168
  }
1178
1169
 
@@ -1180,7 +1171,7 @@ declare global {
1180
1171
  declare global {
1181
1172
  namespace JSX {
1182
1173
  interface IntrinsicElements {
1183
- 'gs-relative-growth-advantage': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1174
+ 'gs-location-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1184
1175
  }
1185
1176
  }
1186
1177
  }
@@ -1188,7 +1179,10 @@ declare global {
1188
1179
 
1189
1180
  declare global {
1190
1181
  interface HTMLElementTagNameMap {
1191
- 'gs-aggregate-component': AggregateComponent;
1182
+ 'gs-text-input': TextInputComponent;
1183
+ }
1184
+ interface HTMLElementEventMap {
1185
+ 'gs-text-input-changed': CustomEvent<Record<string, string>>;
1192
1186
  }
1193
1187
  }
1194
1188
 
@@ -1196,7 +1190,7 @@ declare global {
1196
1190
  declare global {
1197
1191
  namespace JSX {
1198
1192
  interface IntrinsicElements {
1199
- 'gs-aggregate-component': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1193
+ 'gs-text-input': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1200
1194
  }
1201
1195
  }
1202
1196
  }
@@ -1204,7 +1198,10 @@ declare global {
1204
1198
 
1205
1199
  declare global {
1206
1200
  interface HTMLElementTagNameMap {
1207
- 'gs-number-sequences-over-time': NumberSequencesOverTimeComponent;
1201
+ 'gs-mutation-filter': MutationFilterComponent;
1202
+ }
1203
+ interface HTMLElementEventMap {
1204
+ 'gs-mutation-filter-changed': CustomEvent<SelectedMutationFilterStrings>;
1208
1205
  }
1209
1206
  }
1210
1207
 
@@ -1212,7 +1209,7 @@ declare global {
1212
1209
  declare global {
1213
1210
  namespace JSX {
1214
1211
  interface IntrinsicElements {
1215
- 'gs-number-sequences-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1212
+ 'gs-mutation-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1216
1213
  }
1217
1214
  }
1218
1215
  }
@@ -1220,7 +1217,10 @@ declare global {
1220
1217
 
1221
1218
  declare global {
1222
1219
  interface HTMLElementTagNameMap {
1223
- 'gs-mutations-over-time': MutationsOverTimeComponent;
1220
+ 'gs-lineage-filter': LineageFilterComponent;
1221
+ }
1222
+ interface HTMLElementEventMap {
1223
+ 'gs-lineage-filter-changed': CustomEvent<Record<string, string>>;
1224
1224
  }
1225
1225
  }
1226
1226
 
@@ -1228,7 +1228,7 @@ declare global {
1228
1228
  declare global {
1229
1229
  namespace JSX {
1230
1230
  interface IntrinsicElements {
1231
- 'gs-mutations-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1231
+ 'gs-lineage-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1232
1232
  }
1233
1233
  }
1234
1234
  }
package/dist/style.css CHANGED
@@ -482,7 +482,7 @@ input[type="range"] {
482
482
  --tw-contain-paint: ;
483
483
  --tw-contain-style: ;
484
484
  }/*
485
- ! tailwindcss v3.4.14 | MIT License | https://tailwindcss.com
485
+ ! tailwindcss v3.4.15 | MIT License | https://tailwindcss.com
486
486
  *//*
487
487
  1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)
488
488
  2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)
@@ -3194,35 +3194,35 @@ input.tab:checked + .tab-content,
3194
3194
  }
3195
3195
  .border-error {
3196
3196
  --tw-border-opacity: 1;
3197
- border-color: var(--fallback-er,oklch(var(--er)/var(--tw-border-opacity)));
3197
+ border-color: var(--fallback-er,oklch(var(--er)/var(--tw-border-opacity, 1)));
3198
3198
  }
3199
3199
  .border-gray-100 {
3200
3200
  --tw-border-opacity: 1;
3201
- border-color: rgb(243 244 246 / var(--tw-border-opacity));
3201
+ border-color: rgb(243 244 246 / var(--tw-border-opacity, 1));
3202
3202
  }
3203
3203
  .border-gray-200 {
3204
3204
  --tw-border-opacity: 1;
3205
- border-color: rgb(229 231 235 / var(--tw-border-opacity));
3205
+ border-color: rgb(229 231 235 / var(--tw-border-opacity, 1));
3206
3206
  }
3207
3207
  .border-gray-300 {
3208
3208
  --tw-border-opacity: 1;
3209
- border-color: rgb(209 213 219 / var(--tw-border-opacity));
3209
+ border-color: rgb(209 213 219 / var(--tw-border-opacity, 1));
3210
3210
  }
3211
3211
  .border-gray-400 {
3212
3212
  --tw-border-opacity: 1;
3213
- border-color: rgb(156 163 175 / var(--tw-border-opacity));
3213
+ border-color: rgb(156 163 175 / var(--tw-border-opacity, 1));
3214
3214
  }
3215
3215
  .border-red-500 {
3216
3216
  --tw-border-opacity: 1;
3217
- border-color: rgb(239 68 68 / var(--tw-border-opacity));
3217
+ border-color: rgb(239 68 68 / var(--tw-border-opacity, 1));
3218
3218
  }
3219
3219
  .bg-red-200 {
3220
3220
  --tw-bg-opacity: 1;
3221
- background-color: rgb(254 202 202 / var(--tw-bg-opacity));
3221
+ background-color: rgb(254 202 202 / var(--tw-bg-opacity, 1));
3222
3222
  }
3223
3223
  .bg-white {
3224
3224
  --tw-bg-opacity: 1;
3225
- background-color: rgb(255 255 255 / var(--tw-bg-opacity));
3225
+ background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1));
3226
3226
  }
3227
3227
  .p-1 {
3228
3228
  padding: 0.25rem;
@@ -3301,23 +3301,23 @@ input.tab:checked + .tab-content,
3301
3301
  }
3302
3302
  .text-\[\#606060\] {
3303
3303
  --tw-text-opacity: 1;
3304
- color: rgb(96 96 96 / var(--tw-text-opacity));
3304
+ color: rgb(96 96 96 / var(--tw-text-opacity, 1));
3305
3305
  }
3306
3306
  .text-blue-600 {
3307
3307
  --tw-text-opacity: 1;
3308
- color: rgb(37 99 235 / var(--tw-text-opacity));
3308
+ color: rgb(37 99 235 / var(--tw-text-opacity, 1));
3309
3309
  }
3310
3310
  .text-gray-600 {
3311
3311
  --tw-text-opacity: 1;
3312
- color: rgb(75 85 99 / var(--tw-text-opacity));
3312
+ color: rgb(75 85 99 / var(--tw-text-opacity, 1));
3313
3313
  }
3314
3314
  .text-neutral-500 {
3315
3315
  --tw-text-opacity: 1;
3316
- color: rgb(115 115 115 / var(--tw-text-opacity));
3316
+ color: rgb(115 115 115 / var(--tw-text-opacity, 1));
3317
3317
  }
3318
3318
  .text-red-700 {
3319
3319
  --tw-text-opacity: 1;
3320
- color: rgb(185 28 28 / var(--tw-text-opacity));
3320
+ color: rgb(185 28 28 / var(--tw-text-opacity, 1));
3321
3321
  }
3322
3322
  .underline {
3323
3323
  text-decoration-line: underline;
@@ -3347,6 +3347,9 @@ input.tab:checked + .tab-content,
3347
3347
  .duration-150 {
3348
3348
  transition-duration: 150ms;
3349
3349
  }
3350
+ .\@container {
3351
+ container-type: inline-size;
3352
+ }
3350
3353
  .mdi--fullscreen {
3351
3354
  --svg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='black' d='M5 5h5v2H7v3H5zm9 0h5v5h-2V7h-3zm3 9h2v5h-5v-2h3zm-7 3v2H5v-5h2v3z'/%3E%3C/svg%3E");
3352
3355
  }
@@ -3377,7 +3380,7 @@ input.tab:checked + .tab-content,
3377
3380
  }
3378
3381
  .focus-within\:border-gray-400:focus-within {
3379
3382
  --tw-border-opacity: 1;
3380
- border-color: rgb(156 163 175 / var(--tw-border-opacity));
3383
+ border-color: rgb(156 163 175 / var(--tw-border-opacity, 1));
3381
3384
  }
3382
3385
  .hover\:scale-110:hover {
3383
3386
  --tw-scale-x: 1.1;
@@ -3391,26 +3394,26 @@ input.tab:checked + .tab-content,
3391
3394
  }
3392
3395
  .hover\:bg-gray-100:hover {
3393
3396
  --tw-bg-opacity: 1;
3394
- background-color: rgb(243 244 246 / var(--tw-bg-opacity));
3397
+ background-color: rgb(243 244 246 / var(--tw-bg-opacity, 1));
3395
3398
  }
3396
3399
  .hover\:font-bold:hover {
3397
3400
  font-weight: 700;
3398
3401
  }
3399
3402
  .hover\:text-blue-700:hover {
3400
3403
  --tw-text-opacity: 1;
3401
- color: rgb(29 78 216 / var(--tw-text-opacity));
3404
+ color: rgb(29 78 216 / var(--tw-text-opacity, 1));
3402
3405
  }
3403
3406
  .hover\:text-blue-800:hover {
3404
3407
  --tw-text-opacity: 1;
3405
- color: rgb(30 64 175 / var(--tw-text-opacity));
3408
+ color: rgb(30 64 175 / var(--tw-text-opacity, 1));
3406
3409
  }
3407
3410
  .hover\:text-gray-400:hover {
3408
3411
  --tw-text-opacity: 1;
3409
- color: rgb(156 163 175 / var(--tw-text-opacity));
3412
+ color: rgb(156 163 175 / var(--tw-text-opacity, 1));
3410
3413
  }
3411
3414
  .hover\:text-gray-700:hover {
3412
3415
  --tw-text-opacity: 1;
3413
- color: rgb(55 65 81 / var(--tw-text-opacity));
3416
+ color: rgb(55 65 81 / var(--tw-text-opacity, 1));
3414
3417
  }
3415
3418
  .focus\:outline-none:focus {
3416
3419
  outline: 2px solid transparent;
@@ -3424,6 +3427,12 @@ input.tab:checked + .tab-content,
3424
3427
  .peer:hover ~ .peer-hover\:visible {
3425
3428
  visibility: visible;
3426
3429
  }
3430
+ @container (min-width: 30rem) {
3431
+
3432
+ .\@\[30rem\]\:visible {
3433
+ visibility: visible;
3434
+ }
3435
+ }
3427
3436
  @media (min-width: 640px) {
3428
3437
 
3429
3438
  .sm\:max-w-5xl {
package/package.json CHANGED
@@ -1,12 +1,17 @@
1
1
  {
2
2
  "name": "@genspectrum/dashboard-components",
3
- "version": "0.8.1",
3
+ "version": "0.8.3",
4
4
  "description": "GenSpectrum web components for building dashboards",
5
5
  "type": "module",
6
6
  "license": "AGPL-3.0-only",
7
7
  "main": "dist/genspectrum-components.js",
8
8
  "module": "dist/genspectrum-components.js",
9
9
  "types": "dist/genspectrum-components.d.ts",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/GenSpectrum/dashboard-components.git",
13
+ "directory": "components"
14
+ },
10
15
  "publishConfig": {
11
16
  "access": "public"
12
17
  },
@@ -101,6 +106,7 @@
101
106
  "@storybook/types": "^8.0.9",
102
107
  "@storybook/web-components": "^8.0.9",
103
108
  "@storybook/web-components-vite": "^8.0.9",
109
+ "@tailwindcss/container-queries": "^0.1.1",
104
110
  "@types/node": "^22.0.0",
105
111
  "@typescript-eslint/eslint-plugin": "^8.2.0",
106
112
  "@typescript-eslint/parser": "^8.2.0",
@@ -1,5 +1,5 @@
1
1
  import { Chart, type ChartConfiguration } from 'chart.js';
2
- import { type MutableRef, useEffect, useRef } from 'preact/hooks';
2
+ import { useEffect, useRef } from 'preact/hooks';
3
3
 
4
4
  export interface GsChartProps {
5
5
  configuration: ChartConfiguration;
@@ -21,9 +21,14 @@ const GsChart = ({ configuration }: GsChartProps) => {
21
21
 
22
22
  chartRef.current = new Chart(ctx, configuration);
23
23
 
24
- resizeChartAfterFullscreenChange(chartRef, ctx, configuration);
24
+ const resizeChartAfterFullscreenChange = () => {
25
+ chartRef.current?.destroy();
26
+ chartRef.current = new Chart(ctx, configuration);
27
+ };
28
+ document.addEventListener('fullscreenchange', resizeChartAfterFullscreenChange);
25
29
 
26
30
  return () => {
31
+ document.removeEventListener('fullscreenchange', resizeChartAfterFullscreenChange);
27
32
  chartRef.current?.destroy();
28
33
  };
29
34
  }, [canvasRef, configuration]);
@@ -32,14 +37,3 @@ const GsChart = ({ configuration }: GsChartProps) => {
32
37
  };
33
38
 
34
39
  export default GsChart;
35
-
36
- const resizeChartAfterFullscreenChange = (
37
- chartRef: MutableRef<Chart | null>,
38
- ctx: CanvasRenderingContext2D,
39
- configuration: ChartConfiguration,
40
- ) => {
41
- document.addEventListener('fullscreenchange', () => {
42
- chartRef.current?.destroy();
43
- chartRef.current = new Chart(ctx, configuration);
44
- });
45
- };
@@ -0,0 +1,22 @@
1
+ import type { MutationOverTimeMockData } from './mockConversion';
2
+
3
+ export const noDataWhenNoMutationsAreInFilter: MutationOverTimeMockData = {
4
+ query: {
5
+ lapisFilter: {
6
+ dateFrom: '1800-01-01',
7
+ dateTo: '1800-01-02',
8
+ },
9
+ sequenceType: 'nucleotide',
10
+ granularity: 'year',
11
+ lapisDateField: 'date',
12
+ lapis: 'https://lapis.cov-spectrum.org/open/v2',
13
+ },
14
+ response: {
15
+ overallMutationData: [],
16
+ mutationOverTimeSerializedAsArray: {
17
+ keysFirstAxis: [],
18
+ keysSecondAxis: [],
19
+ data: [],
20
+ },
21
+ },
22
+ };
@@ -0,0 +1,22 @@
1
+ import type { MutationOverTimeMockData } from './mockConversion';
2
+
3
+ export const noDataWhenNoMutationsAreInFilter: MutationOverTimeMockData = {
4
+ query: {
5
+ lapisFilter: {
6
+ dateFrom: '2345-01-01',
7
+ dateTo: '2020-01-02',
8
+ },
9
+ sequenceType: 'nucleotide',
10
+ granularity: 'year',
11
+ lapisDateField: 'date',
12
+ lapis: 'https://lapis.cov-spectrum.org/open/v2',
13
+ },
14
+ response: {
15
+ overallMutationData: [],
16
+ mutationOverTimeSerializedAsArray: {
17
+ keysFirstAxis: [],
18
+ keysSecondAxis: [],
19
+ data: [],
20
+ },
21
+ },
22
+ };
@@ -5,6 +5,7 @@ import { workerFunction } from '../webWorkers/workerFunction';
5
5
  import { byWeek } from './__mockData__/byWeek';
6
6
  import { defaultMockData } from './__mockData__/defaultMockData';
7
7
  import { getMutationOverTimeMock } from './__mockData__/mockConversion';
8
+ import { noDataWhenNoMutationsAreInFilter } from './__mockData__/noDataWhenNoMutationsAreInFilter';
8
9
  import { showsMessageWhenTooManyMutations } from './__mockData__/showsMessageWhenTooManyMutations';
9
10
 
10
11
  const mockQueries: { query: MutationOverTimeQuery; response: MutationOverTimeWorkerResponse }[] = [
@@ -12,6 +13,7 @@ const mockQueries: { query: MutationOverTimeQuery; response: MutationOverTimeWor
12
13
  getMutationOverTimeMock(showsMessageWhenTooManyMutations),
13
14
  getMutationOverTimeMock(byWeek),
14
15
  getMutationOverTimeMock(aminoAcidMutationsByDay),
16
+ getMutationOverTimeMock(noDataWhenNoMutationsAreInFilter),
15
17
  ];
16
18
 
17
19
  self.onmessage = async function (event: MessageEvent<MutationOverTimeQuery>) {
@@ -1,5 +1,5 @@
1
- import { Fragment, type FunctionComponent, type RefObject } from 'preact';
2
- import { useEffect, useRef, useState } from 'preact/hooks';
1
+ import { Fragment, type FunctionComponent } from 'preact';
2
+ import { useRef } from 'preact/hooks';
3
3
 
4
4
  import { type MutationOverTimeDataMap } from './MutationOverTimeData';
5
5
  import { type MutationOverTimeMutationValue } from '../../query/queryMutationsOverTime';
@@ -23,9 +23,7 @@ const MutationsOverTimeGrid: FunctionComponent<MutationsOverTimeGridProps> = ({
23
23
 
24
24
  const dates = data.getSecondAxisKeys();
25
25
 
26
- const [showProportionText, setShowProportionText] = useState(false);
27
26
  const gridRef = useRef<HTMLDivElement>(null);
28
- useShowProportion(gridRef, dates.length, setShowProportionText);
29
27
 
30
28
  return (
31
29
  <>
@@ -35,6 +33,9 @@ const MutationsOverTimeGrid: FunctionComponent<MutationsOverTimeGridProps> = ({
35
33
  reduce the number of mutations.
36
34
  </div>
37
35
  )}
36
+ {allMutations.length === 0 && (
37
+ <div className={'flex justify-center'}>No data available for your filters.</div>
38
+ )}
38
39
  <div
39
40
  ref={gridRef}
40
41
  style={{
@@ -42,6 +43,7 @@ const MutationsOverTimeGrid: FunctionComponent<MutationsOverTimeGridProps> = ({
42
43
  gridTemplateRows: `repeat(${shownMutations.length}, 24px)`,
43
44
  gridTemplateColumns: `${MUTATION_CELL_WIDTH_REM}rem repeat(${dates.length}, minmax(0.05rem, 1fr))`,
44
45
  }}
46
+ className='@container'
45
47
  >
46
48
  {shownMutations.map((mutation, rowIndex) => {
47
49
  return (
@@ -70,7 +72,6 @@ const MutationsOverTimeGrid: FunctionComponent<MutationsOverTimeGridProps> = ({
70
72
  date={date}
71
73
  mutation={mutation}
72
74
  tooltipPosition={tooltipPosition}
73
- showProportionText={showProportionText}
74
75
  colorScale={colorScale}
75
76
  />
76
77
  </div>
@@ -84,33 +85,6 @@ const MutationsOverTimeGrid: FunctionComponent<MutationsOverTimeGridProps> = ({
84
85
  );
85
86
  };
86
87
 
87
- function useShowProportion(
88
- gridRef: RefObject<HTMLDivElement>,
89
- girdColumns: number,
90
- setShowProportionText: (value: ((prevState: boolean) => boolean) | boolean) => void,
91
- ) {
92
- useEffect(() => {
93
- const checkWidth = () => {
94
- if (gridRef.current) {
95
- const width = gridRef.current.getBoundingClientRect().width;
96
- const widthPerDate = (width - remToPx(MUTATION_CELL_WIDTH_REM)) / girdColumns;
97
- const maxWidthProportionText = 28;
98
-
99
- setShowProportionText(widthPerDate > maxWidthProportionText);
100
- }
101
- };
102
-
103
- checkWidth();
104
- window.addEventListener('resize', checkWidth);
105
-
106
- return () => {
107
- window.removeEventListener('resize', checkWidth);
108
- };
109
- }, [girdColumns, gridRef, setShowProportionText]);
110
- }
111
-
112
- const remToPx = (rem: number) => rem * parseFloat(getComputedStyle(document.documentElement).fontSize);
113
-
114
88
  function getTooltipPosition(rowIndex: number, rows: number, columnIndex: number, columns: number) {
115
89
  const tooltipX = rowIndex < rows / 2 ? 'bottom' : 'top';
116
90
  const tooltipY = columnIndex < columns / 2 ? 'start' : 'end';
@@ -122,9 +96,8 @@ const ProportionCell: FunctionComponent<{
122
96
  date: Temporal;
123
97
  mutation: Substitution | Deletion;
124
98
  tooltipPosition: TooltipPosition;
125
- showProportionText: boolean;
126
99
  colorScale: ColorScale;
127
- }> = ({ value, mutation, date, tooltipPosition, showProportionText, colorScale }) => {
100
+ }> = ({ value, mutation, date, tooltipPosition, colorScale }) => {
128
101
  const dateClass = toTemporalClass(date);
129
102
 
130
103
  const tooltipContent = (
@@ -151,7 +124,7 @@ const ProportionCell: FunctionComponent<{
151
124
  }}
152
125
  className={`w-full h-full text-center hover:font-bold text-xs group`}
153
126
  >
154
- {showProportionText ? formatProportion(value.proportion, 0) : undefined}
127
+ <span className='invisible @[30rem]:visible'>{formatProportion(value.proportion, 0)}</span>
155
128
  </div>
156
129
  </Tooltip>
157
130
  </div>