@meetelise/chat 1.70.1 → 1.72.0

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.
@@ -2,13 +2,12 @@ import { css, html, LitElement, TemplateResult } from "lit";
2
2
  import { customElement, property, state } from "lit/decorators.js";
3
3
  import { classMap } from "lit/directives/class-map.js";
4
4
  import "../actions/action-confirm-button";
5
- import "../shared/simple-tooltip";
5
+ import "./scheduler-popover";
6
6
  import { tourSchedulerStyles } from "../Scheduler/tourSchedulerStyles";
7
7
  import { InputStyles } from "../actions/InputStyles";
8
8
  import floorplanImageCardStyles from "../FeeCalculator/components/floorplan-image-card/floorplan-image-card-styles";
9
9
  import floorPlanSelectorStyles from "../FeeCalculator/components/floor-plan-selector/floor-plan-selector-styles";
10
10
  import { BuildingIcon } from "../icons/BuildingIcon";
11
- import { XOutlineIcon } from "../icons/XOutlineIcon";
12
11
  import {
13
12
  CommunitiesResponse,
14
13
  Community,
@@ -18,7 +17,7 @@ import {
18
17
  toCommunitySummary,
19
18
  } from "./tourItineraryApi";
20
19
  import { formatHourMinute, formatShortDate } from "./tourTimes";
21
- import { formatCurrency } from "../../utils";
20
+ import { formatCurrency, isMobile, onMobileChange } from "../../utils";
22
21
 
23
22
  export type CommunityLoader = (
24
23
  filters: CommunityFilters
@@ -42,11 +41,10 @@ type FilterId = "bedrooms" | "moveIn" | "budget";
42
41
  const FILTER_IDS: FilterId[] = ["bedrooms", "moveIn", "budget"];
43
42
 
44
43
  /**
45
- * Lists a central group's top communities so the prospect can pick one, or, in
46
- * the "extend" variant after a booking, up to the number of stops left. Ranking
47
- * and every reason come from the server. The cards and badges are the fee
48
- * calculator's. The scheduler holds the picks; after a booking it shows them,
49
- * with Continue, in its footer (`renderSelectionTray`).
44
+ * Lists a central group's top communities so the prospect can pick one: the
45
+ * community to tour, or, in the "extend" variant after a booking, the next stop
46
+ * to add. Ranking and every reason come from the server. The cards and badges
47
+ * are the fee calculator's.
50
48
  */
51
49
  @customElement("community-picker")
52
50
  export class CommunityPicker extends LitElement {
@@ -60,31 +58,51 @@ export class CommunityPicker extends LitElement {
60
58
  @property({ attribute: false })
61
59
  initial: CommunitiesResponse | null = null;
62
60
 
63
- /** The picks so far; a click asks for a change with `selection-change`. */
61
+ /** The pick so far, if any; a click asks for a change with `selection-change`. */
64
62
  @property({ attribute: false })
65
63
  selected: CommunitySummary[] = [];
66
64
 
67
- /** How many communities may be picked: the stops left in the itinerary. */
68
- @property({ type: Number })
69
- maxSelectable = 0;
65
+ /**
66
+ * The prospect's filters, which the scheduler shares with its form for this
67
+ * visit; a change is reported with `filters-change`.
68
+ */
69
+ @property({ attribute: false })
70
+ filters: CommunityFilters = EMPTY_FILTERS;
70
71
 
71
- @state() private filters: CommunityFilters = EMPTY_FILTERS;
72
72
  @state() private openFilter: FilterId | null = null;
73
73
  @state() private communities: Community[] = [];
74
74
  @state() private loading = false;
75
75
  @state() private error: string | null = null;
76
+ @state() private mobile = isMobile();
76
77
 
77
78
  private requestId = 0;
79
+ private cleanupMobileListener?: () => void;
80
+
81
+ connectedCallback(): void {
82
+ super.connectedCallback();
83
+ this.cleanupMobileListener = onMobileChange((m) => (this.mobile = m));
84
+ }
85
+
86
+ disconnectedCallback(): void {
87
+ this.cleanupMobileListener?.();
88
+ super.disconnectedCallback();
89
+ }
90
+
91
+ /** The scheduler's unfiltered page, while no filter is set. */
92
+ private get initialPage(): CommunitiesResponse | null {
93
+ return FILTER_IDS.some((id) => this.isFilterActive(id))
94
+ ? null
95
+ : this.initial;
96
+ }
78
97
 
79
98
  willUpdate(): void {
80
99
  // Show the page the scheduler already has from the first paint.
81
- if (!this.hasUpdated && this.initial) {
82
- this.communities = this.initial.communities;
83
- }
100
+ const initial = this.initialPage;
101
+ if (!this.hasUpdated && initial) this.communities = initial.communities;
84
102
  }
85
103
 
86
104
  firstUpdated(): void {
87
- if (!this.initial) void this.reload();
105
+ if (!this.initialPage) void this.reload();
88
106
  }
89
107
 
90
108
  private async reload(): Promise<void> {
@@ -106,6 +124,13 @@ export class CommunityPicker extends LitElement {
106
124
 
107
125
  private setFilters(next: Partial<CommunityFilters>): void {
108
126
  this.filters = { ...this.filters, ...next };
127
+ this.dispatchEvent(
128
+ new CustomEvent("filters-change", {
129
+ detail: { filters: this.filters },
130
+ bubbles: true,
131
+ composed: true,
132
+ })
133
+ );
109
134
  void this.reload();
110
135
  }
111
136
 
@@ -116,15 +141,7 @@ export class CommunityPicker extends LitElement {
116
141
  private toggle(community: Community): void {
117
142
  if (!community.tourable) return;
118
143
  // One to pick: a click picks it, in place of any earlier pick.
119
- if (this.maxSelectable === 1) {
120
- this.emitSelection([toCommunitySummary(community)]);
121
- } else if (this.isSelected(community.building_id)) {
122
- this.emitSelection(
123
- this.selected.filter((s) => s.building_id !== community.building_id)
124
- );
125
- } else if (this.selected.length < this.maxSelectable) {
126
- this.emitSelection([...this.selected, toCommunitySummary(community)]);
127
- }
144
+ this.emitSelection([toCommunitySummary(community)]);
128
145
  }
129
146
 
130
147
  private emitSelection(communities: CommunitySummary[]): void {
@@ -138,11 +155,8 @@ export class CommunityPicker extends LitElement {
138
155
  }
139
156
 
140
157
  private heading(): string {
141
- if (this.variant === "extend") {
142
- return "Add Nearby Communities to Your Tour";
143
- }
144
- return this.maxSelectable > 1
145
- ? `Select Up to ${this.maxSelectable} Communities to Tour`
158
+ return this.variant === "extend"
159
+ ? "Add Nearby Communities to Your Tour"
146
160
  : "Select a Community to Tour";
147
161
  }
148
162
 
@@ -157,9 +171,13 @@ export class CommunityPicker extends LitElement {
157
171
  private filterLabel(id: FilterId): string {
158
172
  const f = this.filters;
159
173
  if (id === "bedrooms") {
174
+ // A count from the form can be one the chips don't offer, e.g. 4.
160
175
  return f.bedrooms.length
161
- ? BEDROOM_OPTIONS.filter((o) => f.bedrooms.includes(o.value))
162
- .map((o) => o.label)
176
+ ? f.bedrooms
177
+ .map(
178
+ (n) =>
179
+ BEDROOM_OPTIONS.find((o) => o.value === n)?.label ?? `${n} bd`
180
+ )
163
181
  .join(", ")
164
182
  : "Bedrooms";
165
183
  }
@@ -171,101 +189,115 @@ export class CommunityPicker extends LitElement {
171
189
  : "Budget";
172
190
  }
173
191
 
174
- private renderFilters(): TemplateResult {
192
+ /** Each filter's controls, in the panel its chip opens. */
193
+ private renderFilterPanel(id: FilterId): TemplateResult {
175
194
  const f = this.filters;
195
+ if (id === "bedrooms") {
196
+ return html`<div
197
+ class="floor-plan-selector-badges"
198
+ role="group"
199
+ aria-label="Bedrooms"
200
+ >
201
+ ${BEDROOM_OPTIONS.map(
202
+ (o) => html`<button
203
+ class=${classMap({
204
+ "floor-plan-badge": true,
205
+ selected: f.bedrooms.includes(o.value),
206
+ })}
207
+ aria-pressed=${String(f.bedrooms.includes(o.value))}
208
+ @click=${() =>
209
+ this.setFilters({
210
+ bedrooms: f.bedrooms.includes(o.value)
211
+ ? f.bedrooms.filter((b) => b !== o.value)
212
+ : [...f.bedrooms, o.value].sort(),
213
+ })}
214
+ >
215
+ ${o.label}
216
+ </button>`
217
+ )}
218
+ </div>`;
219
+ }
220
+ if (id === "moveIn") {
221
+ return html`<div class="date-field">
222
+ <label for="move-in">Move-in date</label>
223
+ <input
224
+ id="move-in"
225
+ type="date"
226
+ .value=${f.moveIn ?? ""}
227
+ @change=${(e: Event) => {
228
+ this.openFilter = null;
229
+ this.setFilters({
230
+ moveIn: (e.target as HTMLInputElement).value || null,
231
+ });
232
+ }}
233
+ />
234
+ </div>`;
235
+ }
236
+ return html`<div class="date-field">
237
+ <label for="max-budget">Max monthly rent ($)</label>
238
+ <input
239
+ id="max-budget"
240
+ type="number"
241
+ inputmode="numeric"
242
+ min="0"
243
+ step="50"
244
+ .value=${f.maxBudget === null ? "" : String(f.maxBudget)}
245
+ @change=${(e: Event) => {
246
+ const value = parseInt((e.target as HTMLInputElement).value, 10);
247
+ this.openFilter = null;
248
+ this.setFilters({
249
+ maxBudget: Number.isFinite(value) && value > 0 ? value : null,
250
+ });
251
+ }}
252
+ />
253
+ </div>`;
254
+ }
255
+
256
+ private renderFilters(): TemplateResult {
176
257
  const open = this.openFilter;
177
258
  return html`<div class="picker-toolbar" role="group" aria-label="Filters">
178
- ${FILTER_IDS.map(
179
- (id) => html`<button
259
+ ${FILTER_IDS.map(
260
+ (id) => html`<scheduler-popover
261
+ ?open=${open === id}
262
+ ?inline=${this.mobile}
263
+ @popover-close=${() => {
264
+ // Another chip's click opens its own panel before this one hears it.
265
+ if (this.openFilter === id) this.openFilter = null;
266
+ }}
267
+ >
268
+ <button
269
+ slot="trigger"
180
270
  class=${classMap({
181
271
  "floor-plan-badge": true,
182
272
  selected: this.isFilterActive(id),
183
273
  })}
184
274
  aria-expanded=${String(open === id)}
185
- aria-controls="picker-filters"
275
+ aria-controls=${`filter-${id}`}
186
276
  @click=${() => (this.openFilter = open === id ? null : id)}
187
277
  >
188
278
  ${this.filterLabel(id)}
189
- </button>`
190
- )}
191
- ${FILTER_IDS.some((id) => this.isFilterActive(id))
192
- ? html`<button
193
- class="clear-filters"
194
- @click=${() => {
195
- this.openFilter = null;
196
- this.setFilters(EMPTY_FILTERS);
197
- }}
198
- >
199
- Clear all
200
- </button>`
201
- : ""}
202
- </div>
203
- <div
204
- id="picker-filters"
205
- class=${classMap({ "advanced-section": true, open: open !== null })}
206
- >
207
- <div
208
- class="floor-plan-selector-badges"
209
- role="group"
210
- aria-label="Bedrooms"
211
- ?hidden=${open !== "bedrooms"}
212
- >
213
- ${BEDROOM_OPTIONS.map(
214
- (o) => html`<button
215
- class=${classMap({
216
- "floor-plan-badge": true,
217
- selected: f.bedrooms.includes(o.value),
218
- })}
219
- aria-pressed=${String(f.bedrooms.includes(o.value))}
220
- @click=${() =>
221
- this.setFilters({
222
- bedrooms: f.bedrooms.includes(o.value)
223
- ? f.bedrooms.filter((b) => b !== o.value)
224
- : [...f.bedrooms, o.value].sort(),
225
- })}
226
- >
227
- ${o.label}
228
- </button>`
229
- )}
230
- </div>
231
- <div class="date-field" ?hidden=${open !== "moveIn"}>
232
- <label for="move-in">Move-in date</label>
233
- <input
234
- id="move-in"
235
- type="date"
236
- .value=${f.moveIn ?? ""}
237
- @change=${(e: Event) =>
238
- this.setFilters({
239
- moveIn: (e.target as HTMLInputElement).value || null,
240
- })}
241
- />
242
- </div>
243
- <div class="date-field" ?hidden=${open !== "budget"}>
244
- <label for="max-budget">Max monthly rent ($)</label>
245
- <input
246
- id="max-budget"
247
- type="number"
248
- inputmode="numeric"
249
- min="0"
250
- step="50"
251
- .value=${f.maxBudget === null ? "" : String(f.maxBudget)}
252
- @change=${(e: Event) => {
253
- const value = parseInt((e.target as HTMLInputElement).value, 10);
254
- this.setFilters({
255
- maxBudget: Number.isFinite(value) && value > 0 ? value : null,
256
- });
279
+ </button>
280
+ <div id=${`filter-${id}`} class="filter-panel">
281
+ ${open === id ? this.renderFilterPanel(id) : ""}
282
+ </div>
283
+ </scheduler-popover>`
284
+ )}
285
+ ${FILTER_IDS.some((id) => this.isFilterActive(id))
286
+ ? html`<button
287
+ class="clear-filters"
288
+ @click=${() => {
289
+ this.openFilter = null;
290
+ this.setFilters(EMPTY_FILTERS);
257
291
  }}
258
- />
259
- </div>
260
- </div>`;
292
+ >
293
+ Clear all
294
+ </button>`
295
+ : ""}
296
+ </div>`;
261
297
  }
262
298
 
263
299
  private renderCard(c: Community): TemplateResult {
264
300
  const selected = this.isSelected(c.building_id);
265
- const full =
266
- this.maxSelectable > 1 &&
267
- !selected &&
268
- this.selected.length >= this.maxSelectable;
269
301
  const next = c.next_available;
270
302
  // Extension times are all on the day already booked.
271
303
  const sameDay = !!next && this.variant === "extend";
@@ -274,61 +306,55 @@ export class CommunityPicker extends LitElement {
274
306
  c.price_from.bedrooms === 0 ? "Studio" : `${c.price_from.bedrooms} BR`
275
307
  } from ${formatCurrency(c.price_from.amount)}`
276
308
  : "";
277
- const card = html`<button
278
- class=${classMap({
279
- "floorplan-image-card": true,
280
- selected,
281
- disabled: !c.tourable || full,
282
- })}
283
- aria-pressed=${String(selected)}
284
- aria-disabled=${String(!c.tourable || full)}
285
- @click=${() => this.toggle(c)}
286
- >
287
- ${c.image_url
288
- ? html`<span class="section-left"
289
- ><img src=${c.image_url} alt=""
290
- /></span>`
291
- : ""}
292
- <span class="section-right">
293
- ${c.best_match || price || c.distance_mi !== null
294
- ? html`<span class="card-tags">
295
- ${c.best_match
296
- ? html`<span class="floor-plan-badge">Best match</span>`
297
- : ""}
298
- ${price
299
- ? html`<span class="floor-plan-badge">${price}</span>`
300
- : ""}
301
- ${c.distance_mi !== null
302
- ? html`<span class="distance"
303
- >${c.distance_mi.toFixed(1)} mi</span
304
- >`
305
- : ""}
306
- </span>`
307
- : ""}
308
- <span class="image-card-title">${c.name}</span>
309
- <span class="image-card-subtitle">${formatAddress(c.address)}</span>
310
- ${!c.tourable
311
- ? html`<span class="image-card-subtitle"
312
- >${c.unavailable_reason ?? ""}</span
313
- >`
314
- : next
315
- ? html`<span class="next-available"
316
- >Next available:
317
- ${formatShortDate(next.date)}${this.variant === "extend"
318
- ? ` · ${formatHourMinute(next.time)}`
319
- : ""}</span
320
- >`
321
- : ""}
322
- ${sameDay ? html`<span class="same-day">Same day</span>` : ""}
323
- </span>
324
- </button>`;
325
309
  return html`<li>
326
- ${full && c.tourable
327
- ? html`<simple-tooltip
328
- tooltip=${`You can choose up to ${this.maxSelectable}`}
329
- >${card}</simple-tooltip
330
- >`
331
- : card}
310
+ <button
311
+ class=${classMap({
312
+ "floorplan-image-card": true,
313
+ selected,
314
+ disabled: !c.tourable,
315
+ })}
316
+ aria-pressed=${String(selected)}
317
+ aria-disabled=${String(!c.tourable)}
318
+ @click=${() => this.toggle(c)}
319
+ >
320
+ ${c.image_url
321
+ ? html`<span class="section-left"
322
+ ><img src=${c.image_url} alt=""
323
+ /></span>`
324
+ : ""}
325
+ <span class="section-right">
326
+ ${c.best_match || price || c.distance_mi !== null
327
+ ? html`<span class="card-tags">
328
+ ${c.best_match
329
+ ? html`<span class="floor-plan-badge">Best match</span>`
330
+ : ""}
331
+ ${price
332
+ ? html`<span class="floor-plan-badge">${price}</span>`
333
+ : ""}
334
+ ${c.distance_mi !== null
335
+ ? html`<span class="distance"
336
+ >${c.distance_mi.toFixed(1)} mi</span
337
+ >`
338
+ : ""}
339
+ </span>`
340
+ : ""}
341
+ <span class="image-card-title">${c.name}</span>
342
+ <span class="image-card-subtitle">${formatAddress(c.address)}</span>
343
+ ${!c.tourable
344
+ ? html`<span class="image-card-subtitle"
345
+ >${c.unavailable_reason ?? ""}</span
346
+ >`
347
+ : next
348
+ ? html`<span class="next-available"
349
+ >Next available:
350
+ ${formatShortDate(next.date)}${this.variant === "extend"
351
+ ? ` · ${formatHourMinute(next.time)}`
352
+ : ""}</span
353
+ >`
354
+ : ""}
355
+ ${sameDay ? html`<span class="same-day">Same day</span>` : ""}
356
+ </span>
357
+ </button>
332
358
  </li>`;
333
359
  }
334
360
 
@@ -413,12 +439,12 @@ export class CommunityPicker extends LitElement {
413
439
  margin-bottom: 16px;
414
440
  }
415
441
 
416
- .picker-toolbar .floor-plan-badge:not(.selected) {
442
+ .picker-toolbar [slot="trigger"].floor-plan-badge:not(.selected) {
417
443
  background: #ffffff;
418
444
  border-color: #e7e7e7;
419
445
  }
420
446
 
421
- .picker-toolbar .floor-plan-badge:not(.selected):hover {
447
+ .picker-toolbar [slot="trigger"].floor-plan-badge:not(.selected):hover {
422
448
  background: #f8f9fa;
423
449
  }
424
450
 
@@ -432,18 +458,26 @@ export class CommunityPicker extends LitElement {
432
458
  text-decoration: underline;
433
459
  }
434
460
 
435
- #picker-filters [hidden] {
436
- display: none;
461
+ .filter-panel .floor-plan-selector-badges {
462
+ margin: 0;
463
+ overflow: visible;
437
464
  }
438
465
 
439
- #picker-filters .floor-plan-selector-badges {
466
+ .filter-panel .date-field {
467
+ margin: 0;
468
+ width: 14rem;
469
+ }
470
+
471
+ /* Phones: the panel opens in place under the chips, as the filter row did. */
472
+ scheduler-popover[inline] .filter-panel .floor-plan-selector-badges {
473
+ flex-wrap: wrap;
440
474
  justify-content: center;
441
- margin-bottom: 12px;
442
475
  }
443
476
 
444
- #picker-filters .date-field {
445
- margin: 0 auto 12px;
477
+ scheduler-popover[inline] .filter-panel .date-field {
478
+ margin: 0 auto;
446
479
  max-width: 16rem;
480
+ width: auto;
447
481
  }
448
482
 
449
483
  .floor-plan-selector-badges {
@@ -565,97 +599,6 @@ export class CommunityPicker extends LitElement {
565
599
  ];
566
600
  }
567
601
 
568
- /**
569
- * The picks and Continue, in the scheduler's footer under either picker. The
570
- * scheduler renders it so the footer stays its own, as on every other step.
571
- */
572
- export const renderSelectionTray = ({
573
- selected,
574
- mobile,
575
- onRemove,
576
- onContinue,
577
- }: {
578
- selected: CommunitySummary[];
579
- mobile: boolean;
580
- onRemove: (buildingId: number) => void;
581
- onContinue: () => void;
582
- }): TemplateResult | string =>
583
- selected.length === 0
584
- ? ""
585
- : html`<div
586
- id="tour-scheduler-footer"
587
- class=${classMap({ tray: true, stacked: mobile })}
588
- >
589
- <ul
590
- class="floor-plan-selector-badges"
591
- aria-label="Selected communities"
592
- >
593
- ${selected.map(
594
- (s) => html`<li class="floor-plan-badge">
595
- ${s.name}
596
- <button
597
- class="remove"
598
- aria-label=${`Remove ${s.name}`}
599
- @click=${() => onRemove(s.building_id)}
600
- >
601
- ${XOutlineIcon("#737373")}
602
- </button>
603
- </li>`
604
- )}
605
- </ul>
606
- <action-confirm-button
607
- id="continue-bttn"
608
- text="Continue"
609
- height="50px"
610
- width=${mobile ? "100%" : "145px"}
611
- .onClick=${onContinue}
612
- ></action-confirm-button>
613
- </div>`;
614
-
615
- /**
616
- * Styles for `renderSelectionTray`: the fee calculator's badges (its padding and
617
- * radius), without the rest of its stylesheet, which also styles `:host`.
618
- */
619
- export const selectionTrayStyles = css`
620
- .tray {
621
- gap: 12px;
622
- }
623
-
624
- .tray .floor-plan-selector-badges {
625
- display: flex;
626
- flex-wrap: wrap;
627
- gap: 8px;
628
- list-style: none;
629
- margin: 0;
630
- padding: 0;
631
- }
632
-
633
- .tray .floor-plan-badge {
634
- align-items: center;
635
- background: #f3f3f3;
636
- border: 1px solid #e7e7e7;
637
- border-radius: 16px;
638
- display: inline-flex;
639
- font-size: 13px;
640
- gap: 6px;
641
- padding: 6px 12px;
642
- white-space: nowrap;
643
- }
644
-
645
- .remove {
646
- background: none;
647
- border: none;
648
- cursor: pointer;
649
- display: inline-flex;
650
- padding: 0;
651
- }
652
-
653
- .remove svg {
654
- height: 9px;
655
- width: 9px;
656
- }
657
- `;
658
-
659
602
  declare global {
660
603
  interface HTMLElementTagNameMap {
661
604
  "community-picker": CommunityPicker;
@@ -105,6 +105,14 @@ export class ItineraryEditor extends LitElement {
105
105
  @property({ type: Boolean })
106
106
  canEditCommunities = false;
107
107
 
108
+ /** Adding stops to a booking: only the stops, as the design's itinerary. */
109
+ @property({ type: Boolean })
110
+ stopsOnly = false;
111
+
112
+ /** With `stopsOnly`, the itinerary has room for another stop. */
113
+ @property({ type: Boolean })
114
+ canAddStop = false;
115
+
108
116
  @property({ type: Boolean })
109
117
  loading = false;
110
118
 
@@ -198,10 +206,11 @@ export class ItineraryEditor extends LitElement {
198
206
  </div>
199
207
  ${this.canEditCommunities
200
208
  ? html`<button
201
- class="floor-plan-badge"
209
+ class="icon-button change-community"
210
+ aria-label="Change community"
202
211
  @click=${() => emit(this, "edit-communities", {})}
203
212
  >
204
- Change
213
+ ${PencilIcon()}
205
214
  </button>`
206
215
  : ""}
207
216
  </div> `;
@@ -421,7 +430,8 @@ export class ItineraryEditor extends LitElement {
421
430
  </button>`}
422
431
  ${editing ? this.renderTimePicker(stop) : ""}
423
432
  </div>
424
- ${!stop.fixed && (ids.length > 1 || this.problems.length > 0)
433
+ ${!stop.fixed &&
434
+ (ids.length > 1 || this.problems.length > 0 || this.stopsOnly)
425
435
  ? this.renderRemove(stop.building_id, community?.name ?? "")
426
436
  : ""}
427
437
  </div>
@@ -463,17 +473,32 @@ export class ItineraryEditor extends LitElement {
463
473
  : ""}`;
464
474
  }
465
475
 
476
+ private renderStops(): TemplateResult {
477
+ return html`<ol class="stops" aria-busy=${String(this.loading)}>
478
+ ${this.stops.map((stop, i) => this.renderStop(stop, i))}
479
+ ${this.problems.map((p) => this.renderProblem(p))}
480
+ </ol>`;
481
+ }
482
+
466
483
  private renderItinerary(): TemplateResult {
467
484
  return html`<h2 class="journey-header">
468
485
  Your Itinerary ${this.loading ? html`<mini-loader></mini-loader>` : ""}
469
486
  </h2>
470
- <ol class="stops" aria-busy=${String(this.loading)}>
471
- ${this.stops.map((stop, i) => this.renderStop(stop, i))}
472
- ${this.problems.map((p) => this.renderProblem(p))}
473
- </ol>`;
487
+ ${this.renderStops()}`;
474
488
  }
475
489
 
476
490
  render(): TemplateResult {
491
+ if (this.stopsOnly) {
492
+ return html`${this.renderStops()}
493
+ ${this.canAddStop
494
+ ? html`<button
495
+ class="floor-plan-badge add-stop"
496
+ @click=${() => emit(this, "add-stop", {})}
497
+ >
498
+ + Add another stop
499
+ </button>`
500
+ : ""}`;
501
+ }
477
502
  const itinerary = !this.selectedTypeOpensLink && !this.single;
478
503
  return html`<div id="tour-type-menu-outer-container">
479
504
  ${this.renderCommunity()} ${this.renderTourTypes()}
@@ -524,6 +549,15 @@ export class ItineraryEditor extends LitElement {
524
549
  margin-top: 20px;
525
550
  }
526
551
 
552
+ /* The pencil sits centred on the community card's right. */
553
+ .icon-button.change-community {
554
+ align-self: center;
555
+ }
556
+
557
+ .add-stop {
558
+ width: 100%;
559
+ }
560
+
527
561
  .community {
528
562
  background: #ffffff;
529
563
  border: 1px solid #e7e7e7;