{% extends "base.html" %}

{% block content %}
<div class="bg-white dark:bg-slate-800 shadow rounded-lg p-6">
    <div class="flex justify-between items-center mb-6">
        <h2 class="text-2xl font-bold text-gray-900 dark:text-white">知识库 (Wiki)</h2>
        {% if session.get('is_admin') %}
        <a href="{{ url_for('wiki.edit', page_path='new') }}" class="px-4 py-2 bg-yrtv-600 text-white rounded hover:bg-yrtv-500">New Page</a>
        {% endif %}
    </div>
    
    <div class="space-y-2">
        {% for page in pages %}
        <a href="{{ url_for('wiki.view', page_path=page.path) }}" class="block p-4 border border-gray-200 dark:border-gray-700 rounded hover:bg-gray-50 dark:hover:bg-slate-700">
            <div class="flex justify-between items-center">
                <span class="text-lg font-medium text-yrtv-600">{{ page.title }}</span>
                <span class="text-sm text-gray-500">{{ page.path }}</span>
            </div>
        </a>
        {% else %}
        <p class="text-gray-500">暂无文档。</p>
        {% endfor %}
    </div>
</div>
{% endblock %}
