<view class="favorites-page">
    <view class="category-filter">
      <view class="filter-chip {{favTab === 'all' ? 'active' : ''}}" bindtap="onFavTabChange" data-value="all">全部</view>
      <view class="filter-chip {{favTab === 'plant' ? 'active' : ''}}" bindtap="onFavTabChange" data-value="plant">百科</view>
      <view class="filter-chip {{favTab === 'post' ? 'active' : ''}}" bindtap="onFavTabChange" data-value="post">动态</view>
    </view>

    <scroll-view 
        scroll-y 
        class="fav-scroll" 
        enhanced 
        show-scrollbar="{{false}}"
        bindscrolltolower="onReachBottom"
    >
      <view wx:if="{{favorites.length > 0}}" class="fav-list">
        <t-swipe-cell wx:for="{{favorites}}" wx:key="id">
            <view class="fav-item" bindtap="goToDetail" data-item="{{item}}">
            
            <!-- Render Wiki Plant -->
            <block wx:if="{{item.type === 'plant'}}">
                <t-image src="{{item.image}}" mode="aspectFill" class="fav-img plant-img" width="160rpx" height="160rpx" />
                <view class="fav-info">
                    <text class="fav-title">{{item.name}}</text>
                    <text class="fav-subtitle">{{item.latinName}}</text>
                    <view class="fav-meta">
                        <t-tag size="small" variant="light" theme="success">植物百科</t-tag>
                        <text wx:if="{{item.difficultyLabel}}" class="meta-diff">难度: {{item.difficultyLabel}}</text>
                    </view>
                </view>
            </block>

            <!-- Render Community Post -->
            <block wx:else>
                <t-image 
                    src="{{item.postImage || item.avatar}}" 
                    mode="aspectFill" 
                    class="fav-img post-img" 
                    width="160rpx" height="160rpx"
                />
                <view class="fav-info">
                    <text class="fav-title post-title">{{item.content || '无标题'}}</text>
                    <view class="fav-user-row">
                        <t-avatar image="{{item.avatar}}" size="small" />
                        <text class="user-nickname">{{item.nickname}}</text>
                    </view>
                    <view class="fav-meta">
                        <t-tag size="small" variant="light" theme="primary">社区动态</t-tag>
                        <text class="meta-time">{{item.time}}</text>
                    </view>
                </view>
            </block>
            </view>
            <view slot="right" class="delete-btn" catchtap="onSwipeClick" data-item="{{item}}">
                <text>删除</text>
            </view>
        </t-swipe-cell>
      </view>
      
      <!-- Empty State -->
      <view wx:elif="{{!isLoading}}" class="empty-state">
        <t-icon name="star" size="80rpx" color="#E0E0E0" style="margin-bottom: 24rpx;" />
        <text class="empty-text">暂无收藏内容</text>
      </view>
      
      <!-- Loading State -->
      <view class="loading-footer" wx:if="{{isLoading}}">
          <t-loading theme="circular" size="40rpx" text="加载中..." />
      </view>
      <view wx:if="{{!hasMore && favorites.length > 0}}" class="no-more-text">没有更多了</view>
      
      <view style="height: 60rpx;"></view>
    </scroll-view>
</view>
