<script setup>
import { computed } from 'vue';
import { useMessageContext } from '../provider.js';

const { contentAttributes } = useMessageContext();

const title = computed(() => contentAttributes.value?.title || 'Table');
const rowCount = computed(() => contentAttributes.value?.rows?.length || 0);
</script>

<template>
  <div class="table-placeholder">
    <div class="placeholder-icon">
      <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
        <rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect>
        <line x1="3" y1="9" x2="21" y2="9"></line>
        <line x1="3" y1="15" x2="21" y2="15"></line>
        <line x1="9" y1="3" x2="9" y2="21"></line>
        <line x1="15" y1="3" x2="15" y2="21"></line>
      </svg>
    </div>
    <div class="placeholder-content">
      <h4 class="placeholder-title">{{ title }}</h4>
      <p class="placeholder-text">
        {{ rowCount }} 行表格数据
      </p>
    </div>
  </div>
</template>

<style scoped>
.table-placeholder {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  max-width: 320px;
}

.dark .table-placeholder {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  border-color: #475569;
}

.placeholder-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #3b82f6;
}

.placeholder-content {
  flex: 1;
}

.placeholder-title {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  margin: 0 0 4px 0;
}

.dark .placeholder-title {
  color: #f1f5f9;
}

.placeholder-text {
  font-size: 13px;
  color: #64748b;
  margin: 0;
}

.dark .placeholder-text {
  color: #94a3b8;
}
</style>
