From 49e174c816143f57af4871ff74992327e0555500 Mon Sep 17 00:00:00 2001
From: antoine37120 <ant.dupre@gmail.com>
Date: Sat, 23 Sep 2023 11:38:02 +0200
Subject: [PATCH] fix: load conversion if note loade

---
 src/utils.js             |  3 +-
 src/views-terrytories.js | 85 ++++++++++++++++++++++++++++------------
 2 files changed, 63 insertions(+), 25 deletions(-)

diff --git a/src/utils.js b/src/utils.js
index eaaa02e..0c3acda 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -8,8 +8,9 @@ export const TZCLD_URLS = {
   my_territory_follow: 'tzcld-suivit',
   my_territory_exchanges: 'tzcld-echnages',
   my_territory_all_exchanges: 'tzcld-tous-les-echnages',
-  my_territory_exchange: 'tzcld-echnage',
   my_territory_add_exchange: 'tzcld-add-echnage',
+  my_territory_exchange_space: 'tzcld-echnage-space',
+  my_territory_exchange: 'tzcld-echnage',
   my_territory_edit_exchange: 'tzcld-edit-echnage',
 }
 
diff --git a/src/views-terrytories.js b/src/views-terrytories.js
index e052568..5172986 100644
--- a/src/views-terrytories.js
+++ b/src/views-terrytories.js
@@ -86,11 +86,9 @@ import("./utils.js").then((utils) => {
                         </li>
                       </solid-route>
                       </solid-ac-checker>
-                      <solid-route name="${utils.TZCLD_URLS.my_territory_exchanges}" use-id></solid-route>
                       <solid-route name="${utils.TZCLD_URLS.my_territory_all_exchanges}" use-id></solid-route>
-                      <solid-route name="${utils.TZCLD_URLS.my_territory_exchange}" use-id></solid-route>
                       <solid-route name="${utils.TZCLD_URLS.my_territory_add_exchange}" use-id></solid-route>
-                      <solid-route name="${utils.TZCLD_URLS.my_territory_edit_exchange}" use-id></solid-route>
+                      <solid-route name="${utils.TZCLD_URLS.my_territory_exchange_space}" use-id></solid-route>
                     </ul>
                   </solid-router>
                 </nav>`;
@@ -242,7 +240,19 @@ import("./utils.js").then((utils) => {
                     </span>
                   </template>
                 </solid-widget>
+
                 
+                <solid-widget name="tzcld-exchanges-conversations-feed">
+                          <template>
+                          <h3 class="text-color-heading text-semibold text-letter-spacing-large">Commentaires</h3>
+                          <solid-conversation
+                            data-src="\${value}"
+                            send-button-text="Ajouter le commentaire" 
+                            solid-resource=""
+                            >
+                          </solid-conversation>
+                          </template>
+                  </solid-widget>
                 `;
                 return render;
               }
@@ -513,13 +523,22 @@ import("./utils.js").then((utils) => {
                       </div>
                       <div class="segment block padding-xsmall sm-padding-xsmall sm-padding-top-normal whitespace-normal bg-color-grey wrapper-resource-comments">
                         <div class="segment full sm-full">
-                          <h3 class="text-color-heading text-semibold text-letter-spacing-large">Commentaires</h3>
-                          <solid-conversation
-                            bind-resources
-                            nested-field="conversations"
-                            send-button-text="Ajouter le commentaire" 
-                            >
-                          </solid-conversation>
+
+                        <div class="loader" id="loader-${this.route}-tzcld-exchange-conversations-feed">
+                          <div></div>
+                          <div></div>
+                          <div></div>
+                          <div></div>
+                        </div>
+                        <solid-display 
+                          fields="conversations" 
+                          class="segment block whitespace-normal" 
+                          widget-conversations="tzcld-exchanges-conversations-feed"
+                          loader-id="loader-${this.route}-tzcld-exchange-conversations-feed"
+                          bind-resources="" 
+                          solid-resource=""
+                        >
+                        </solid-display>
                         </div>
                       </div>
                       `;
@@ -884,26 +903,44 @@ import("./utils.js").then((utils) => {
                         ${this.viewMyCommunity()}
                         </div>
 
-                        <div id="${utils.TZCLD_URLS.my_territory_exchanges}" data-view="${utils.TZCLD_URLS.my_territory_exchanges}" class="community-exchanges home" hidden>
-                        ${this.viewExchanges()}
-                        </div>
+                          <div id="${utils.TZCLD_URLS.my_territory_exchanges}" data-view="${utils.TZCLD_URLS.my_territory_exchanges}" class="community-exchanges home" hidden>
+                          ${this.viewExchanges()}
+                          </div>
 
-                        <div id="${utils.TZCLD_URLS.my_territory_exchange}" data-view="${utils.TZCLD_URLS.my_territory_exchange}" class="community-exchanges one" hidden>
-                        ${this.viewExchange()}
-                        </div>
+                          <div id="${utils.TZCLD_URLS.my_territory_add_exchange}" data-view="${utils.TZCLD_URLS.my_territory_add_exchange}" class="community-exchanges add" hidden>
+                          ${this.viewAddExchange()}
+                          </div>
+
+                          <div id="${utils.TZCLD_URLS.my_territory_all_exchanges}" data-view="${utils.TZCLD_URLS.my_territory_all_exchanges}" class="community-exchanges all" hidden>
+                          ${this.viewAllExchanges()}
+                          </div>
+
+                        <div id="${utils.TZCLD_URLS.my_territory_exchange_space}" data-view="${utils.TZCLD_URLS.my_territory_exchange_space}" class="community-exchanges one" hidden>
+
+                          <solid-router default-route="my_territory_all_exchanges_empty" route-prefix="">
+                            <solid-route name="my_territory_all_exchanges_empty" use-id></solid-route>
+                            <solid-route name="${utils.TZCLD_URLS.my_territory_exchange}" use-id></solid-route>
+                            <solid-route name="${utils.TZCLD_URLS.my_territory_edit_exchange}" use-id></solid-route>
+                          </solid-router>
+
+
+                          <div id="my_territory_all_exchanges_empty" data-view="my_territory_all_exchanges_empty" class="community-exchanges one" hidden>
+                          
+                          </div>
+
+                          <div id="${utils.TZCLD_URLS.my_territory_exchange}" data-view="${utils.TZCLD_URLS.my_territory_exchange}" class="community-exchanges one" hidden>
+                          ${this.viewExchange()}
+                          </div>
+
+                          <div id="${utils.TZCLD_URLS.my_territory_edit_exchange}" data-view="${utils.TZCLD_URLS.my_territory_edit_exchange}" class="community-exchanges edit" hidden>
+                          ${this.viewEditExchange()}
+                          </div>
 
-                        <div id="${utils.TZCLD_URLS.my_territory_add_exchange}" data-view="${utils.TZCLD_URLS.my_territory_add_exchange}" class="community-exchanges add" hidden>
-                        ${this.viewAddExchange()}
-                        </div>
 
-                        <div id="${utils.TZCLD_URLS.my_territory_edit_exchange}" data-view="${utils.TZCLD_URLS.my_territory_edit_exchange}" class="community-exchanges edit" hidden>
-                        ${this.viewEditExchange()}
-                        </div>
 
-                        <div id="${utils.TZCLD_URLS.my_territory_all_exchanges}" data-view="${utils.TZCLD_URLS.my_territory_all_exchanges}" class="community-exchanges all" hidden>
-                        ${this.viewAllExchanges()}
                         </div>
 
+
                         <div id="${utils.TZCLD_URLS.my_territory_auto_eval}" data-view="${utils.TZCLD_URLS.my_territory_auto_eval}" class="community-answers" hidden>
                         ${this.viewCommunityAnswers()}
                         </div>
-- 
GitLab