|
44 | 44 | import arrowTwo from './arrow-two.svg'; |
45 | 45 | import { camelize } from '$lib/helpers/string'; |
46 | 46 | import { SelectSearchItem } from '$lib/elements'; |
47 | | - import { isRelationshipToMany } from '../document-[document]/attributes/store'; |
48 | 47 |
|
49 | 48 | // Props |
50 | 49 | export let data: Models.AttributeRelationship; |
|
102 | 101 |
|
103 | 102 | $: getCollections(search).then((res) => (collectionList = res)); |
104 | 103 | $: collections = collectionList?.collections?.filter((n) => n.$id !== $collection.$id) ?? []; |
105 | | - $: isToMany = isRelationshipToMany(data); |
106 | 104 |
|
107 | 105 | $: if (editing) { |
108 | 106 | way = data.twoWay ? 'two' : 'one'; |
|
234 | 232 | <span>{data.key}</span> |
235 | 233 | </div> |
236 | 234 | </div> |
237 | | - <div> |
238 | | - <p class="u-text-center"> |
239 | | - <b data-private>{camelize($collection.name)}</b> can contain {data.relationType && |
240 | | - !['oneToOne', 'oneToMany'].includes(data.relationType) |
241 | | - ? 'many' |
242 | | - : 'one'} |
243 | | - <b data-private>{data.key}</b> |
244 | | - </p> |
245 | | - <p class="u-text-center"> |
246 | | - <b data-private>{camelize($collection.name)}</b> can belong to {isToMany |
247 | | - ? 'many' |
248 | | - : 'one'} |
249 | | - <b data-private>{data.key}</b> |
250 | | - </p> |
251 | | - </div> |
| 235 | + {#if data.relationType} |
| 236 | + <div> |
| 237 | + <p class="u-text-center"> |
| 238 | + <b data-private>{camelize($collection.name)}</b> can contain {[ |
| 239 | + 'oneToOne', |
| 240 | + 'manyToOne' |
| 241 | + ].includes(data.relationType) |
| 242 | + ? 'one' |
| 243 | + : 'many'} |
| 244 | + <b data-private>{camelize(data.key)}</b> |
| 245 | + </p> |
| 246 | + <p class="u-text-center"> |
| 247 | + <b data-private>{camelize(data.key)}</b> |
| 248 | + can belong to {['oneToOne', 'oneToMany'].includes(data.relationType) |
| 249 | + ? 'one' |
| 250 | + : 'many'} |
| 251 | + <b data-private>{camelize($collection.name)}</b> |
| 252 | + </p> |
| 253 | + </div> |
| 254 | + {/if} |
252 | 255 | </div> |
253 | 256 | <InputSelect |
254 | 257 | id="deleting" |
|
0 commit comments