<TopicDismissButtons
  @position="top"
  @selectedTopics={{this.selected}}
  @model={{this.model}}
  @showResetNew={{this.showResetNew}}
  @showDismissRead={{this.showDismissRead}}
  @resetNew={{action "resetNew"}}
/>

<DiscoveryTopicsList
  @model={{this.model}}
  @refresh={{action "refresh"}}
  @incomingCount={{this.topicTrackingState.incomingCount}}
  as |discoveryTopicList|
>
  {{#if this.top}}
    <div class="top-lists">
      <PeriodChooser
        @period={{this.period}}
        @action={{action "changePeriod"}}
        @fullDay={{false}}
      />
    </div>
  {{else}}
    {{#if this.topicTrackingState.hasIncoming}}
      <a
        href
        {{on "click" this.showInserted}}
        class="alert alert-info clickable"
      >
        <CountI18n
          @key="topic_count_"
          @suffix={{this.topicTrackingState.filter}}
          @count={{this.topicTrackingState.incomingCount}}
        />
      </a>
    {{/if}}
  {{/if}}

  {{#if this.hasTopics}}
    <TopicList
      @ascending={{this.ascending}}
      @highlightLastVisited={{true}}
      @showPosters={{true}}
      @canBulkSelect={{this.canBulkSelect}}
      @toggleBulkSelect={{action "toggleBulkSelect"}}
      @updateAutoAddTopicsToBulkSelect={{action
        "updateAutoAddTopicsToBulkSelect"
      }}
      @hideCategory={{this.model.hideCategory}}
      @order={{this.order}}
      @bulkSelectEnabled={{this.bulkSelectEnabled}}
      @bulkSelectAction={{action "refresh"}}
      @selected={{this.selected}}
      @expandGloballyPinned={{this.expandGloballyPinned}}
      @expandAllPinned={{this.expandAllPinned}}
      @category={{this.category}}
      @topics={{this.model.topics}}
      @scrollOnLoad={{true}}
      @onScroll={{discoveryTopicList.saveScrollPosition}}
    />
  {{/if}}
</DiscoveryTopicsList>

<footer class="topic-list-bottom">
  <ConditionalLoadingSpinner @condition={{this.model.loadingMore}} />
  {{#if this.allLoaded}}
    <TopicDismissButtons
      @position="bottom"
      @selectedTopics={{this.selected}}
      @model={{this.model}}
      @showResetNew={{this.showResetNew}}
      @showDismissRead={{this.showDismissRead}}
      @resetNew={{action "resetNew"}}
    />

    <FooterMessage
      @education={{this.footerEducation}}
      @message={{this.footerMessage}}
    >
      {{#if this.latest}}
        {{#if this.canCreateTopicOnCategory}}
          <DiscourseLinkedText
            @action={{route-action "createTopic"}}
            @text="topic.suggest_create_topic"
          />
        {{/if}}
      {{else if this.top}}
        {{html-safe
          (i18n
            "topic.browse_all_categories_latest_or_top" basePath=(base-path)
          )
        }}
        <TopPeriodButtons
          @period={{this.period}}
          @action={{action "changePeriod"}}
        />
      {{else}}
        {{html-safe
          (i18n "topic.browse_all_categories_latest" basePath=(base-path))
        }}
      {{/if}}
    </FooterMessage>
  {{/if}}
</footer>