From d20601dc475034d51a7617ba9ceedb84fdbacabf Mon Sep 17 00:00:00 2001 From: rdavis Date: Thu, 4 Jul 2024 13:53:28 +0000 Subject: [PATCH 1/7] feat: Add custom Collapsible component for collapsible content --- src/lib/components/common/Collapsible.svelte | 37 ++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/lib/components/common/Collapsible.svelte diff --git a/src/lib/components/common/Collapsible.svelte b/src/lib/components/common/Collapsible.svelte new file mode 100644 index 000000000..c87ffe8ba --- /dev/null +++ b/src/lib/components/common/Collapsible.svelte @@ -0,0 +1,37 @@ + + + + +
+ +
+ +
+
\ No newline at end of file From 2389c36a70d55ee6da4164b9e085a322e488a194 Mon Sep 17 00:00:00 2001 From: rdavis Date: Thu, 4 Jul 2024 13:55:37 +0000 Subject: [PATCH 2/7] refactor: Update WebSearchResults.svelte to use new CollapsibleComponent --- .../ResponseMessage/WebSearchResults.svelte | 146 +++++++++--------- 1 file changed, 73 insertions(+), 73 deletions(-) diff --git a/src/lib/components/chat/Messages/ResponseMessage/WebSearchResults.svelte b/src/lib/components/chat/Messages/ResponseMessage/WebSearchResults.svelte index 528108036..25001730e 100644 --- a/src/lib/components/chat/Messages/ResponseMessage/WebSearchResults.svelte +++ b/src/lib/components/chat/Messages/ResponseMessage/WebSearchResults.svelte @@ -2,17 +2,18 @@ import ChevronDown from '$lib/components/icons/ChevronDown.svelte'; import ChevronUp from '$lib/components/icons/ChevronUp.svelte'; import MagnifyingGlass from '$lib/components/icons/MagnifyingGlass.svelte'; - import { Collapsible } from 'bits-ui'; - import { slide } from 'svelte/transition'; + import Collapsible from '$lib/components/common/Collapsible.svelte'; + export let status = { urls: [], query: '' }; let state = false; - - +
+
@@ -22,76 +23,75 @@ {/if}
- - - - {#if status?.query} - -
- - -
- {status.query} + - -
- - - - -
-
- {/if} - - {#each status.urls as url, urlIdx} - -
- {url} -
- -
+ + + +
+
+ {/if} + + {#each status.urls as url, urlIdx} + - - + {url} +
+ +
- - -
-
- {/each} - - + + + + +
+ + {/each} +
+ + \ No newline at end of file From d5c0876a0b180cfc413a7dfb55ae4fe34f2f5d52 Mon Sep 17 00:00:00 2001 From: rdavis Date: Thu, 4 Jul 2024 14:02:26 +0000 Subject: [PATCH 3/7] refactor: fixed new Collapsible Component to allow passed in classes chore: format --- .../ResponseMessage/WebSearchResults.svelte | 160 +++++++++--------- src/lib/components/common/Collapsible.svelte | 31 ++-- 2 files changed, 92 insertions(+), 99 deletions(-) diff --git a/src/lib/components/chat/Messages/ResponseMessage/WebSearchResults.svelte b/src/lib/components/chat/Messages/ResponseMessage/WebSearchResults.svelte index 25001730e..4523c8482 100644 --- a/src/lib/components/chat/Messages/ResponseMessage/WebSearchResults.svelte +++ b/src/lib/components/chat/Messages/ResponseMessage/WebSearchResults.svelte @@ -4,94 +4,88 @@ import MagnifyingGlass from '$lib/components/icons/MagnifyingGlass.svelte'; import Collapsible from '$lib/components/common/Collapsible.svelte'; - export let status = { urls: [], query: '' }; let state = false; -
- -
- + +
+ + + {#if state} + + {:else} + + {/if} +
+
+ {#if status?.query} + +
+ - {#if state} - - {:else} - - {/if} -
-
\ No newline at end of file + + +
+ + {/if} + + {#each status.urls as url, urlIdx} + +
+ {url} +
+ +
+ + + + +
+
+ {/each} +
+
diff --git a/src/lib/components/common/Collapsible.svelte b/src/lib/components/common/Collapsible.svelte index c87ffe8ba..b681143a6 100644 --- a/src/lib/components/common/Collapsible.svelte +++ b/src/lib/components/common/Collapsible.svelte @@ -2,11 +2,11 @@ import { afterUpdate } from 'svelte'; export let open = false; - + export let className = ''; // Manage the max-height of the collapsible content for snappy transitions let contentElement: HTMLElement; - let maxHeight = '0px'; // Initial max-height + let maxHeight = '0px'; // Initial max-height // After any state update, adjust the max-height for the transition afterUpdate(() => { if (open) { @@ -15,23 +15,22 @@ } else { maxHeight = '0px'; } - }); - + }); +
+ +
+ +
+
+ - -
- -
- -
-
\ No newline at end of file From db58bb5f0f51521fa5c52e1b4e8107e6275904ad Mon Sep 17 00:00:00 2001 From: rdavis Date: Thu, 4 Jul 2024 14:15:16 +0000 Subject: [PATCH 4/7] refactor: Removed dependency --- src/lib/components/common/Collapsible.svelte | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/lib/components/common/Collapsible.svelte b/src/lib/components/common/Collapsible.svelte index b681143a6..0a140d9dd 100644 --- a/src/lib/components/common/Collapsible.svelte +++ b/src/lib/components/common/Collapsible.svelte @@ -1,21 +1,19 @@
From 78ba18a680f9cce4c895279282ecf60fc581f382 Mon Sep 17 00:00:00 2001 From: rdavis Date: Thu, 4 Jul 2024 14:55:48 +0000 Subject: [PATCH 5/7] refactor: Update Collapsible component to include dynamic margin for open state --- src/lib/components/common/Collapsible.svelte | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/components/common/Collapsible.svelte b/src/lib/components/common/Collapsible.svelte index 0a140d9dd..14e5785a4 100644 --- a/src/lib/components/common/Collapsible.svelte +++ b/src/lib/components/common/Collapsible.svelte @@ -20,7 +20,7 @@ -
+
@@ -28,7 +28,7 @@ From ca3f8e6cb52231a21f7c157fd1e38504665b1793 Mon Sep 17 00:00:00 2001 From: rdavis Date: Thu, 4 Jul 2024 15:18:21 +0000 Subject: [PATCH 6/7] chore: format --- src/lib/components/common/Collapsible.svelte | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lib/components/common/Collapsible.svelte b/src/lib/components/common/Collapsible.svelte index 14e5785a4..8a3ef9690 100644 --- a/src/lib/components/common/Collapsible.svelte +++ b/src/lib/components/common/Collapsible.svelte @@ -20,7 +20,11 @@ -
+
From 73899e1c0d09981d6897ec2e321c5fa0aa535b77 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Fri, 5 Jul 2024 21:37:29 -0700 Subject: [PATCH 7/7] refac --- .../ResponseMessage/WebSearchResults.svelte | 1 - src/lib/components/common/Collapsible.svelte | 38 +++++-------------- 2 files changed, 9 insertions(+), 30 deletions(-) diff --git a/src/lib/components/chat/Messages/ResponseMessage/WebSearchResults.svelte b/src/lib/components/chat/Messages/ResponseMessage/WebSearchResults.svelte index 4523c8482..d4416014a 100644 --- a/src/lib/components/chat/Messages/ResponseMessage/WebSearchResults.svelte +++ b/src/lib/components/chat/Messages/ResponseMessage/WebSearchResults.svelte @@ -11,7 +11,6 @@
diff --git a/src/lib/components/common/Collapsible.svelte b/src/lib/components/common/Collapsible.svelte index 8a3ef9690..c7497d835 100644 --- a/src/lib/components/common/Collapsible.svelte +++ b/src/lib/components/common/Collapsible.svelte @@ -1,38 +1,18 @@
-
- -
-
- + {#if open} +
+ +
+ {/if} +