From 9fa04e28cc929102fdcef4a0952e82c47c610b10 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Antoine=20Dupr=C3=A9?= <ant.dupre@gmail.com>
Date: Wed, 17 May 2023 01:10:00 +0200
Subject: [PATCH] fix: territory fields null and description white space normal

---
 src/styles/index.scss                  |  4 +++-
 src/widjets-display-territory-tzcld.js | 28 +++++++++++++++++---------
 2 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/src/styles/index.scss b/src/styles/index.scss
index fcbdac0..59c3b55 100644
--- a/src/styles/index.scss
+++ b/src/styles/index.scss
@@ -315,7 +315,9 @@ solid-form {
     box-shadow: none!important;
   }
 }
-
+.white-space-normal {
+  white-space: normal!important;
+}
 /* All link on main */ 
 main .link {
   color: var(--color-primary);
diff --git a/src/widjets-display-territory-tzcld.js b/src/widjets-display-territory-tzcld.js
index 42c4e2f..1f8b25c 100644
--- a/src/widjets-display-territory-tzcld.js
+++ b/src/widjets-display-territory-tzcld.js
@@ -249,16 +249,26 @@ import("./utils.js").then((utils) => {
 
             </div>`;
 
-          render += `<div><solid-display class="segment" bind-resources="" nested-field="tzcld_profile" fields="regions"
-          widget-regions="customtzcld-display-territory-regions"
-          data-src="${tzcldprofile.id}" solid-resource=""></solid-display>
-          <div class="region segment tag color-fourth">${await etiquettes.kind.name}</div>
-          <div class="region segment tag color-fourth">${await etiquettes.step_state.name}</div>
-          </div>
+          render += `<div class="margin-top-xxsmall">
+            <solid-display class="segment" bind-resources="" nested-field="tzcld_profile" fields="regions"     widget-regions="customtzcld-display-territory-regions" data-src="${tzcldprofile.id}" solid-resource=""></solid-display>`;
+          if (await etiquettes.kind != null) {
+          render += `<div class="region segment tag color-fourth">${await etiquettes.kind.name}</div>`;
+          }
+console.log(etiquettes.step_state) ;
+          if (await etiquettes.step_state != null) {
+          render += `<div class="region segment tag color-fourth">${await etiquettes.step_state.name}</div>`;
+          }
+          render += `</div>`;
 
-          <div class="margin-top-small"><a class="text-color-primary" href="${await tzcldprofile.profile.website}">${await tzcldprofile.profile.website}</a></div>
-          <div class="description margin-top-small">${await tzcldprofile.profile.description}</div>
-        </div>
+          if (await tzcldprofile.profile.website != '') {
+          render += `<div class="margin-top-small"><a class="text-color-primary" href="${await tzcldprofile.profile.website}">${await tzcldprofile.profile.website}</a></div>`;
+          }
+          if (await tzcldprofile.profile.description != '') {
+          render += `<div class="description margin-top-small white-space-normal">${await tzcldprofile.profile.description}</div>`;
+          }
+          
+          
+        render += `</div>
       </div>` ;//tzcld-territory-profile-wrapper
 
         
-- 
GitLab