
<ion-item color="{{ post.you_are_mentioned ? 'mention' : '' }}" (click)="showProfile(post.user)">
  <ion-avatar item-start >
    <img src="{{ post.user.content.avatar_image.link }}">
  </ion-avatar>
  <h2>{{ post.user.name }}</h2>
  <p>@{{ post.user.username }}</p>
  <ion-note item-end>
    <div text-right>
      {{ post.created_at | timeago }}<br/>
      {{ post.source.name }}
    </div>
  </ion-note>
</ion-item>

<ion-card-content>
  <div *ngIf="post.is_deleted; else renderBlock"></div>
  <ng-template #renderBlock >
    <div [innerHTML]="post.content.html | parser"></div>
    <div *ngIf="post.raw">
      <div *ngFor="let r of post.raw">
        <div *ngIf="r.type == 'nl.chimpnut.blog.post'">
          <hr>
          <div>{{ r.value.body }}</div>
        </div>
      </div>
    </div>
  </ng-template>
</ion-card-content>

<div *ngIf="post.raw">
  <ion-list *ngFor="let r of post.raw">
    <div *ngIf="r.type == 'io.pnut.core.oembed'">
      <div *ngIf="hideImg; then hidebtn else thumbbtn"></div>
      <ng-template #thumbbtn>
        <ion-item>
          <ion-thumbnail item-start>
            <img src="{{ r.value.thumbnail_url || r.value.url }}" (click)="showImage(r.value.url)">
          </ion-thumbnail>
          <h2>{{ r.value.title }}</h2>
          <p>{{ r.value.description }}</p>
        </ion-item>
      </ng-template>
      <ng-template #hidebtn>
        <ion-item>
          <button ion-button icon-start (click)="showImage(r.value.url)">
            <ion-icon name="image"></ion-icon>
            {{ r.value.title }}
          </button>
          <p>{{ r.value.description }}</p>
        </ion-item>
      </ng-template>
    </div>
  </ion-list>
</div>

<div *ngIf="post.reposted_by_string">
  <ion-item><ion-note>{{ post.reposted_by_string }}</ion-note></ion-item>
</div>

<ion-row>
  <ion-col>
    <button ion-button icon-left clear small block (click)="showReplyPost(post,'reply')">
      <ion-icon name="ios-undo"></ion-icon>
    </button>
  </ion-col>
  <ion-col>
    <button ion-button icon-left clear small block (click)="showReplyPost(post,'quote')">
      <ion-icon name="quote"></ion-icon>
    </button>
  </ion-col>
  <ion-col>
    <button ion-button icon-left clear small block (click)="repost(post.id, post.you_reposted)">
      <ion-icon name="repeat"></ion-icon>
      <div *ngIf="post.counts.reposts > 0">{{ post.counts.reposts }}</div>
    </button>
  </ion-col>
  <ion-col>
    <button ion-button icon-left clear small block (click)="bookmark(post.id, post.you_bookmarked)">
      <ion-icon name="star"></ion-icon>
      <div *ngIf="post.counts.bookmarks > 0">{{ post.counts.bookmarks }}</div>
    </button>
  </ion-col>
  <ion-col>
    <button ion-button icon-left clear small block (click)="fetchThread(post.thread_id)">
      <ion-icon name="chatboxes"></ion-icon>
      <div *ngIf="post.counts.replies > 0">{{ post.counts.replies }}</div>
    </button>
  </ion-col>
  <ion-col>
    <button ion-button icon-left clear small block (click)="presentPostMenu($event, post)">
      <ion-icon name="more"></ion-icon>
    </button>
  </ion-col>
</ion-row>
