<ion-header >
  <ion-toolbar>
    <ion-title>我的动态</ion-title>
  <ion-buttons slot="end">
    <ion-button (click)="closeHelp()">
      <ion-icon name="close"></ion-icon>
    </ion-button>
  </ion-buttons>
</ion-toolbar>
</ion-header>

<ion-content [fullscreen]="true">
<ion-accordion-group [multiple]="true" [value]="['first', 'third']">
        <ion-accordion value="first">
          <ion-item slot="header" color="light">
            <ion-label>发布的帖子</ion-label>
          </ion-item>
          <div class="ion-padding" slot="content">
      <ion-label>
        <div class="card-section" *ngFor="let post of userPosts">
          <ion-card>
          <h1 class="title">帖子标题：{{ post?.get('title') }}</h1>
          <div class="post-content-container">
            <p class="post-content" [class.collapsed]="post?.get('content').length > 200" (click)="toggleContent(post)">
              {{ showFullContent(post) }}
            </p>
            <p *ngIf="post?.get('content').length > 200" class="view-more" (click)="toggleContent(post)">
              {{ isContentCollapsed(post) ? '查看更多' : '收起' }}
            </p>
          </div>
          <img *ngIf="post?.get('avatar') !== 'undefined'" class="post-avatar" src="{{ post?.get('avatar') }}" />
        </ion-card>
        </div>
      </ion-label>
        </div>
        </ion-accordion>
  

        <ion-accordion value="second">
          <ion-item slot="header" color="light">
            <ion-label>发表的评论</ion-label>
          </ion-item>
           <div class="ion-padding" slot="content">
            <ion-label>
              <div  class="card-section" *ngFor="let comment of userComments">
                <ion-card>
                <div class="comment">
                <ion-label class="mycomment">我的评论：{{ comment.get('content') }}</ion-label>
              </div>
              <div class="post">
                <ng-container *ngIf="getPostByComment(comment)">
                  <h1 class="title">帖子标题: {{ getPostByComment(comment)?.get('title') }}</h1>
                  <p class="post-content">帖子内容: {{ getPostByComment(comment)?.get('content') }}</p>
                  <img *ngIf="getPostByComment(comment)?.get('avatar') !== 'undefined'" class="post-avatar" src="{{ getPostByComment(comment)?.get('avatar') }}" />
                
                </ng-container>
            </div>
          </ion-card>
              </div>
            </ion-label>
          </div>
                 

        </ion-accordion>
</ion-accordion-group>
</ion-content> 
