|
| 1 | +<script setup> |
| 2 | +import { Icon } from "@iconify/vue"; |
| 3 | +import { Link } from "@inertiajs/vue3"; |
| 4 | +import FieldDisplay from "./FieldDisplay.vue"; |
| 5 | +
|
| 6 | +defineProps({ |
| 7 | + changedFields: { |
| 8 | + type: Array, |
| 9 | + required: true, |
| 10 | + }, |
| 11 | + originalResource: { |
| 12 | + type: Object, |
| 13 | + required: true, |
| 14 | + }, |
| 15 | + hasChanges: { |
| 16 | + type: Boolean, |
| 17 | + required: true, |
| 18 | + }, |
| 19 | +}); |
| 20 | +</script> |
| 21 | + |
| 22 | +<template> |
| 23 | + <div class="grid grid-cols-1 lg:grid-cols-2 gap-6"> |
| 24 | + <!-- Proposed Changes Column --> |
| 25 | + <div |
| 26 | + class="bg-gray-50 dark:bg-gray-900 border border-gray-200 dark:border-gray-800 rounded-lg" |
| 27 | + > |
| 28 | + <div |
| 29 | + class="bg-primary/5 dark:bg-primary/10 border-b border-gray-200 dark:border-gray-800 px-4 py-3" |
| 30 | + > |
| 31 | + <h2 |
| 32 | + class="text-lg font-semibold text-gray-900 dark:text-gray-100 flex items-center gap-2" |
| 33 | + > |
| 34 | + <Icon |
| 35 | + icon="mdi:plus-circle" |
| 36 | + class="w-5 h-5 text-primary" |
| 37 | + /> |
| 38 | + Proposed Changes |
| 39 | + </h2> |
| 40 | + </div> |
| 41 | + <div class="p-4 space-y-4"> |
| 42 | + <FieldDisplay |
| 43 | + v-for="field in changedFields" |
| 44 | + :key="field.key" |
| 45 | + :field="field" |
| 46 | + :value="field.proposedValue" |
| 47 | + altText="Proposed Image" |
| 48 | + /> |
| 49 | + <p |
| 50 | + v-if="!hasChanges" |
| 51 | + class="text-gray-500 dark:text-gray-400 italic" |
| 52 | + > |
| 53 | + No changes were proposed. |
| 54 | + </p> |
| 55 | + </div> |
| 56 | + </div> |
| 57 | + |
| 58 | + <!-- Current Version Column --> |
| 59 | + <div |
| 60 | + class="bg-gray-50 dark:bg-gray-900 border border-gray-200 dark:border-gray-800 rounded-lg" |
| 61 | + > |
| 62 | + <div |
| 63 | + class="bg-gray-100 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-800 px-4 py-3" |
| 64 | + > |
| 65 | + <Link |
| 66 | + :href=" |
| 67 | + route('resources.show', { |
| 68 | + slug: originalResource.slug, |
| 69 | + }) |
| 70 | + " |
| 71 | + class="group" |
| 72 | + > |
| 73 | + <h2 |
| 74 | + class="text-lg font-semibold text-gray-900 dark:text-gray-100 flex items-center gap-2 group-hover:text-primary duration-200" |
| 75 | + > |
| 76 | + <Icon |
| 77 | + icon="mdi:file-document" |
| 78 | + class="w-5 h-5 text-gray-600 dark:text-gray-300 group-hover:text-primary duration-200" |
| 79 | + /> |
| 80 | + Current Version |
| 81 | + </h2> |
| 82 | + </Link> |
| 83 | + </div> |
| 84 | + <div class="p-4 space-y-4"> |
| 85 | + <FieldDisplay |
| 86 | + v-for="field in changedFields" |
| 87 | + :key="field.key" |
| 88 | + :field="field" |
| 89 | + :value="field.originalValue" |
| 90 | + altText="Current Image" |
| 91 | + /> |
| 92 | + <p |
| 93 | + v-if="!hasChanges" |
| 94 | + class="text-gray-500 dark:text-gray-400 italic" |
| 95 | + > |
| 96 | + No changes to compare. |
| 97 | + </p> |
| 98 | + </div> |
| 99 | + </div> |
| 100 | + </div> |
| 101 | +</template> |
0 commit comments