Skip to content

Commit 7e806a5

Browse files
authored
feat: hide empty promise status and link (#140)
1 parent 9c1fa56 commit 7e806a5

File tree

2 files changed

+40
-34
lines changed

2 files changed

+40
-34
lines changed

src/components/Promise/Home/PromiseMovementSection.svelte

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -146,27 +146,31 @@
146146
</div>
147147
</div>
148148
<div class="flex flex-col gap-4 py-6 md:flex-row">
149-
<div class="flex md:basis-1/2">
150-
<OtherStatusCard
151-
title="คำสัญญาที่ไม่พบความเคลื่อนไหว"
152-
status="ไม่พบความเคลื่อนไหว"
153-
statusCount={notStarted?.count || 0}
154-
samples={notStarted?.samples}
155-
description="เราไม่พบข้อมูลความเคลื่อนไหวที่เกี่ยวกับคำสัญญานี้"
156-
on:buttonClick={handleClickViewAll}
157-
/>
158-
</div>
149+
{#if notStarted}
150+
<div class="flex md:basis-1/2">
151+
<OtherStatusCard
152+
title="คำสัญญาที่ไม่พบความเคลื่อนไหว"
153+
status="ไม่พบความเคลื่อนไหว"
154+
statusCount={notStarted.count}
155+
samples={notStarted.samples}
156+
description="เราไม่พบข้อมูลความเคลื่อนไหวที่เกี่ยวกับคำสัญญานี้"
157+
on:buttonClick={handleClickViewAll}
158+
/>
159+
</div>
160+
{/if}
159161

160-
<div class="flex md:basis-1/2">
161-
<OtherStatusCard
162-
title="คำสัญญาที่รอคำชี้แจงเพิ่มเติม"
163-
status="รอคำชี้แจงเพิ่มเติม"
164-
statusCount={clarifying?.count || 0}
165-
samples={clarifying?.samples}
166-
description="เราพบว่าคำสัญญานี้มีความคลุมเครือและกำลังอยู่ในระหว่างการขอคำชี้แจงเพิ่มเติม"
167-
on:buttonClick={handleClickViewAll}
168-
/>
169-
</div>
162+
{#if clarifying}
163+
<div class="flex md:basis-1/2">
164+
<OtherStatusCard
165+
title="คำสัญญาที่รอคำชี้แจงเพิ่มเติม"
166+
status="รอคำชี้แจงเพิ่มเติม"
167+
statusCount={clarifying.count}
168+
samples={clarifying.samples}
169+
description="เราพบว่าคำสัญญานี้มีความคลุมเครือและกำลังอยู่ในระหว่างการขอคำชี้แจงเพิ่มเติม"
170+
on:buttonClick={handleClickViewAll}
171+
/>
172+
</div>
173+
{/if}
170174
</div>
171175
</div>
172176

src/components/Promise/Home/PromiseStatusCard.svelte

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,21 @@
2727
style="width:{Math.round((statusCount / max) * 100)}%;"
2828
/>
2929
<p class="body-01 py-1 pt-2">{description}</p>
30-
<div class="flex flex-col gap-1 py-1">
31-
<p class="body-01 text-text-02">เช่น</p>
32-
<ul class="list-disc space-y-2 pl-6">
33-
{#each samples as s}
34-
<li>
35-
<a href="/promises/{s.id}" class="body-01 line-clamp-2 text-text-02 underline">
36-
{s.statements}
37-
</a>
38-
</li>
39-
{/each}
40-
</ul>
41-
<div class="py-1">
42-
<button class="link-01 text-blue-60 underline" on:click={handleViewAll}>ดูทั้งหมด</button>
30+
{#if statusCount}
31+
<div class="flex flex-col gap-1 py-1">
32+
<p class="body-01 text-text-02">เช่น</p>
33+
<ul class="list-disc space-y-2 pl-6">
34+
{#each samples as s}
35+
<li>
36+
<a href="/promises/{s.id}" class="body-01 line-clamp-2 text-text-02 underline">
37+
{s.statements}
38+
</a>
39+
</li>
40+
{/each}
41+
</ul>
42+
<div class="py-1">
43+
<button class="link-01 text-blue-60 underline" on:click={handleViewAll}>ดูทั้งหมด</button>
44+
</div>
4345
</div>
44-
</div>
46+
{/if}
4547
</div>

0 commit comments

Comments
 (0)