<div
  class="week-glance"
  data-test-week-glance
  {{did-insert this.scrollOnLoad}}
>
  {{#if @collapsible}}
    <button
      type="button"
      class="title collapsible"
      aria-expanded={{if @collapsed "false" "true"}}
      data-test-week-title
      {{on "click" (fn (optional @toggleCollapsed) @collapsed)}}
    >
      {{this.title}}
      {{#if @showFullTitle}}
        {{t "general.weekAtAGlance"}}
      {{/if}}
      <FaIcon @icon={{if @collapsed "caret-right" "caret-down"}} />
    </button>
  {{else}}
    <h2 class="title"
      role={{if @collapsible "button"}}
      data-test-week-title
    >
      {{this.title}}
      {{#if @showFullTitle}}
        {{t "general.weekAtAGlance"}}
      {{/if}}
    </h2>
  {{/if}}
  {{#unless @collapsed}}
    {{#if this.eventsLoaded}}
      {{#if (gt this.nonIlmPreWorkEvents.length 0)}}
        {{#each this.nonIlmPreWorkEvents as |event|}}
          <WeekGlanceEvent @event={{event}} />
        {{/each}}
      {{else}}
        <p>
          {{t "general.none"}}
        </p>
      {{/if}}
    {{else}}
      <p>
        <FaIcon @icon="spinner" @spin={{true}} />
        {{t "general.loadingEvents"}}
      </p>
    {{/if}}
  {{/unless}}
</div>
