Radish alpha
r
Radicle desktop app
Radicle
Git (anonymous pull)
Log in to clone via SSH
Clean up section collapsing logic
Rūdolfs Ošiņš committed 1 year ago
commit 53d49e0bbfff320a0b5924ab3001423ba42f83fd
parent 023b2f050395b0dad0cbdeb26a7297e982189d0b
1 file changed +8 -8
modified src/components/Revision.svelte
@@ -61,7 +61,9 @@
  let hideDiscussion = $state(
    revision.discussion === undefined || revision.discussion.length === 0,
  );
-
  let hideReviews = $state(false);
+
  let hideReviews = $state(
+
    revision.reviews === undefined || revision.reviews.length === 0,
+
  );
  let topLevelReplyOpen = $state(false);
  let filesExpanded = $state(true);

@@ -89,7 +91,8 @@
    // eslint-disable-next-line @typescript-eslint/no-unused-expressions
    patchId;

-
    hideReviews = false;
+
    hideReviews =
+
      revision.reviews === undefined || revision.reviews.length === 0;
    hideDiscussion =
      revision.discussion === undefined || revision.discussion.length === 0;
    focusReply = false;
@@ -359,16 +362,13 @@
  </CommentComponent>
</div>

-
<div style:margin={hideReviews ? "1.5rem 0 1.5rem 0" : "1.5rem 0 2.5rem 0"}>
+
<div style:margin={hideReviews ? "1.5rem 0" : "1.5rem 0 2.5rem 0"}>
  <div class="global-flex">
    <NakedButton
-
      disabled={revision.reviews?.length === 0}
+
      disabled={revision.reviews === undefined || revision.reviews.length === 0}
      variant="ghost"
      onclick={() => (hideReviews = !hideReviews)}>
-
      <Icon
-
        name={hideReviews || revision.reviews?.length === 0
-
          ? "chevron-right"
-
          : "chevron-down"} />
+
      <Icon name={hideReviews ? "chevron-right" : "chevron-down"} />
      <div class="txt-semibold global-flex txt-regular">
        Reviews <span style:font-weight="var(--font-weight-regular)">
          {revision.reviews?.length ?? 0}