@meetelise/chat 1.20.7 → 1.20.9

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.
@@ -22,7 +22,7 @@ import { TimePicker } from "./time-picker";
22
22
  import { LabeledOption, UnitV2 } from "../../fetchBuildingInfo";
23
23
  import { isMobile } from "../../utils";
24
24
  import axios from "axios";
25
- import { mapValues } from "lodash";
25
+ import { isNumber, isString, mapValues } from "lodash";
26
26
  import classnames from "classnames";
27
27
  import parseISO from "date-fns/parseISO";
28
28
  import compareAsc from "date-fns/compareAsc";
@@ -387,6 +387,12 @@ export class TourScheduler extends LitElement {
387
387
  grid-template-rows: 44px 54px 32px 195px 167px 1px;
388
388
  }
389
389
 
390
+ @media screen and (max-width: 1000px) {
391
+ .tour-scheduler {
392
+ transform: translate(-50%, -50%) scale(0.8, 0.6);
393
+ }
394
+ }
395
+
390
396
  h1,
391
397
  h2 {
392
398
  margin: 0;
@@ -1043,13 +1049,13 @@ export class TourScheduler extends LitElement {
1043
1049
  <me-select
1044
1050
  id="layoutType"
1045
1051
  placeholder="Select layout"
1046
- .options="${this.layoutOptions.map((i) => ({
1052
+ .options="${sortedLayouts(this.layoutOptions).map((i) => ({
1047
1053
  label: getHumanReadableLayout(i),
1048
1054
  value: i,
1049
1055
  }))}"
1050
1056
  defaultOption="Studio"
1051
1057
  @change=${() => {
1052
- // to revalidate the form
1058
+ // to revalidate the form.
1053
1059
  this.requestUpdate();
1054
1060
  }}
1055
1061
  >Studio
@@ -1239,3 +1245,43 @@ const tourTypeForSubmission = {
1239
1245
  [TourType.Self]: "self-guided-tour",
1240
1246
  [TourType.Virtual]: "live-virtual-tour",
1241
1247
  };
1248
+
1249
+ const getLayoutOrder = (layout: string) => {
1250
+ return {
1251
+ studio: 0,
1252
+ "1br": 1,
1253
+ "2br": 2,
1254
+ "3br": 3,
1255
+ "4br": 4,
1256
+ "5br": 5,
1257
+ "6br": 6,
1258
+ "7br": 7,
1259
+ "8br": 8,
1260
+ "9br": 9,
1261
+ "10br": 10,
1262
+ }[layout];
1263
+ };
1264
+
1265
+ const getLayoutFromOrder = (order: number) => {
1266
+ return {
1267
+ 0: "studio",
1268
+ 1: "1br",
1269
+ 2: "2br",
1270
+ 3: "3br",
1271
+ 4: "4br",
1272
+ 5: "5br",
1273
+ 6: "6br",
1274
+ 7: "7br",
1275
+ 8: "8br",
1276
+ 9: "9br",
1277
+ 10: "10br",
1278
+ }[order];
1279
+ };
1280
+
1281
+ const sortedLayouts = (layouts: string[]) => {
1282
+ const layoutOrder = layouts
1283
+ .map((layout) => getLayoutOrder(layout))
1284
+ .filter(isNumber)
1285
+ .sort();
1286
+ return layoutOrder.map((order) => getLayoutFromOrder(order)).filter(isString);
1287
+ };
package/src/utils.ts CHANGED
@@ -12,7 +12,7 @@ export function useInterval(callback: () => void, delay: number | null): void {
12
12
  // Set up the interval.
13
13
  useEffect(() => {
14
14
  // Don't schedule if no delay is specified.
15
- // Note: 0 is a valid value for delay.
15
+ // Note: 0 is a valid value for delay, so we can't just check for falsiness.
16
16
  if (!delay && delay !== 0) {
17
17
  return;
18
18
  }