Newer
Older
navi-1 / webclient / src / components / messages / UiComponentCard.vue
@Eugene Sukhodolskiy Eugene Sukhodolskiy 9 days ago 1 KB Enable navi_ui card_grid for realtor profile
<template>
  <div class="ui-component-card">
    <div class="ui-component-header">
      <span class="ui-component-icon">🧩</span>
      <span class="ui-component-name">{{ props.component.component }}</span>
      <span class="ui-component-badge">UI</span>
    </div>
    <div class="ui-component-body">
      <component :is="renderer" :data="props.component.payload" />
    </div>
  </div>
</template>

<script setup>
import { computed } from 'vue'
import CardGrid from './CardGrid.vue'

const props = defineProps({
  component: { type: Object, required: true }
})

const renderer = computed(() => {
  const name = props.component.component ?? ''
  if (name === 'card_grid') return CardGrid
  // Fallback: raw JSON preview for unknown components
  return null
})
</script>

<style scoped>
.ui-component-card {
  margin: 8px 0;
  background: var(--surface, #1e1e2e);
  border: 1px solid var(--border, #2a2a3e);
  overflow: hidden;
}

.ui-component-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border, #2a2a3e);
  user-select: none;
}

.ui-component-icon {
  font-size: 1.2em;
  line-height: 1;
}

.ui-component-name {
  flex: 1;
  font-size: 0.9em;
  font-weight: 500;
  color: var(--text, #cdd6f4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ui-component-badge {
  font-size: 0.7em;
  text-transform: uppercase;
  padding: 2px 8px;
  background: var(--accent-muted, #313244);
  color: var(--accent, #4ec9b0);
}

.ui-component-body {
  padding: 12px 14px;
}
</style>