<?php
/**
 * HuSNS - 骨架屏组件
 * 提供页面加载时的占位骨架效果
 */

/**
 * 生成帖子卡片骨架屏
 * @param int $count 骨架屏数量
 */
function renderPostSkeleton($count = 3) {
    for ($i = 0; $i < $count; $i++) {
        echo '
        <div class="moment-card skeleton-card">
            <div class="moment-header">
                <div class="skeleton-avatar"></div>
                <div class="skeleton-user-info">
                    <div class="skeleton-line skeleton-username"></div>
                    <div class="skeleton-line skeleton-time"></div>
                </div>
                <div class="skeleton-dot"></div>
            </div>
            <div class="moment-content">
                <div class="skeleton-line skeleton-content"></div>
                <div class="skeleton-line skeleton-content"></div>
                <div class="skeleton-line skeleton-content-short"></div>
            </div>
            <div class="skeleton-images">
                <div class="skeleton-image"></div>
                <div class="skeleton-image"></div>
                <div class="skeleton-image"></div>
            </div>
            <div class="moment-actions skeleton-actions">
                <div class="skeleton-action"></div>
                <div class="skeleton-action"></div>
                <div class="skeleton-action"></div>
                <div class="skeleton-action"></div>
            </div>
        </div>';
    }
}

/**
 * 生成用户卡片骨架屏
 * @param int $count 骨架屏数量
 */
function renderUserSkeleton($count = 3) {
    for ($i = 0; $i < $count; $i++) {
        echo '
        <div class="user-card skeleton-user-card">
            <div class="skeleton-avatar skeleton-avatar-lg"></div>
            <div class="skeleton-user-info-lg">
                <div class="skeleton-line skeleton-username-lg"></div>
                <div class="skeleton-line skeleton-bio"></div>
            </div>
            <div class="skeleton-btn"></div>
        </div>';
    }
}

/**
 * 生成评论列表骨架屏
 * @param int $count 骨架屏数量
 */
function renderCommentSkeleton($count = 3) {
    for ($i = 0; $i < $count; $i++) {
        echo '
        <div class="comment-item skeleton-comment">
            <div class="skeleton-avatar skeleton-avatar-sm"></div>
            <div class="skeleton-comment-body">
                <div class="skeleton-line skeleton-comment-username"></div>
                <div class="skeleton-line skeleton-comment-content"></div>
                <div class="skeleton-line skeleton-comment-content-short"></div>
            </div>
        </div>';
    }
}

/**
 * 生成页面加载骨架屏
 */
function renderPageLoading() {
    echo '
    <div class="page-loading-skeleton">
        <div class="skeleton-header">
            <div class="skeleton-header-left"></div>
            <div class="skeleton-header-title"></div>
            <div class="skeleton-header-right"></div>
        </div>
        <div class="skeleton-content">
            <div class="skeleton-section">
                <div class="skeleton-line skeleton-section-title"></div>
                <div class="skeleton-grid">
                    <div class="skeleton-grid-item"></div>
                    <div class="skeleton-grid-item"></div>
                    <div class="skeleton-grid-item"></div>
                    <div class="skeleton-grid-item"></div>
                </div>
            </div>
            <div class="skeleton-section">
                <div class="skeleton-line skeleton-section-title"></div>
                ';
                renderPostSkeleton(2);
                echo '
            </div>
        </div>
    </div>';
}
?>
