Spaces:
Sleeping
Sleeping
fix(front): add better responsive design to tools & assistants (#1473)
Browse files* fix(tool): responsive design for tool page
* fix(assistants): add responsive design to assistant page
src/lib/components/ToolLogo.svelte
CHANGED
@@ -82,7 +82,7 @@
|
|
82 |
})();
|
83 |
</script>
|
84 |
|
85 |
-
<div class="flex {sizeClass} items-center justify-center">
|
86 |
<svg xmlns="http://www.w3.org/2000/svg" class="absolute {sizeClass} h-full" viewBox="0 0 52 58">
|
87 |
<defs>
|
88 |
<linearGradient id="gradient-{gradientColor}" gradientTransform="rotate(90)">
|
|
|
82 |
})();
|
83 |
</script>
|
84 |
|
85 |
+
<div class="flex {sizeClass} relative items-center justify-center">
|
86 |
<svg xmlns="http://www.w3.org/2000/svg" class="absolute {sizeClass} h-full" viewBox="0 0 52 58">
|
87 |
<defs>
|
88 |
<linearGradient id="gradient-{gradientColor}" gradientTransform="rotate(90)">
|
src/routes/settings/(nav)/assistants/[assistantId]/+page.svelte
CHANGED
@@ -47,25 +47,26 @@
|
|
47 |
<ReportModal on:close={() => (displayReportModal = false)} />
|
48 |
{/if}
|
49 |
<div class="flex h-full flex-col gap-2">
|
50 |
-
<div class="flex gap-6">
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
|
|
65 |
|
66 |
<div class="flex-1">
|
67 |
-
<div class="
|
68 |
-
<h1 class="
|
69 |
{assistant?.name}
|
70 |
</h1>
|
71 |
|
@@ -77,7 +78,7 @@
|
|
77 |
<IconInternet classNames="text-sm text-blue-600" />
|
78 |
</span>
|
79 |
{/if}
|
80 |
-
<span class="
|
81 |
>public</span
|
82 |
>
|
83 |
</div>
|
@@ -96,21 +97,23 @@
|
|
96 |
</a>
|
97 |
</p>
|
98 |
<div
|
99 |
-
class="flex items-center gap-4 whitespace-nowrap text-sm text-gray-500 hover:*:text-gray-800"
|
100 |
>
|
101 |
-
<
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
|
|
|
|
114 |
{#if assistant?.createdByMe}
|
115 |
<a href="{base}/settings/assistants/{assistant?._id}/edit" class="underline"
|
116 |
><CarbonPen class="mr-1.5 inline text-xs" />Edit
|
|
|
47 |
<ReportModal on:close={() => (displayReportModal = false)} />
|
48 |
{/if}
|
49 |
<div class="flex h-full flex-col gap-2">
|
50 |
+
<div class="flex flex-col sm:flex-row sm:gap-6">
|
51 |
+
<div class="mb-4 flex justify-center sm:mb-0">
|
52 |
+
{#if assistant?.avatar}
|
53 |
+
<img
|
54 |
+
src={`${base}/settings/assistants/${assistant?._id}/avatar.jpg?hash=${assistant?.avatar}`}
|
55 |
+
alt="Avatar"
|
56 |
+
class="size-16 flex-none rounded-full object-cover sm:size-24"
|
57 |
+
/>
|
58 |
+
{:else}
|
59 |
+
<div
|
60 |
+
class="flex size-16 flex-none items-center justify-center rounded-full bg-gray-300 text-4xl font-semibold uppercase text-gray-500 sm:size-24"
|
61 |
+
>
|
62 |
+
{assistant?.name[0]}
|
63 |
+
</div>
|
64 |
+
{/if}
|
65 |
+
</div>
|
66 |
|
67 |
<div class="flex-1">
|
68 |
+
<div class="flex flex-wrap items-center gap-2">
|
69 |
+
<h1 class="break-words text-xl font-semibold">
|
70 |
{assistant?.name}
|
71 |
</h1>
|
72 |
|
|
|
78 |
<IconInternet classNames="text-sm text-blue-600" />
|
79 |
</span>
|
80 |
{/if}
|
81 |
+
<span class="rounded-full border px-2 py-0.5 text-sm leading-none text-gray-500"
|
82 |
>public</span
|
83 |
>
|
84 |
</div>
|
|
|
97 |
</a>
|
98 |
</p>
|
99 |
<div
|
100 |
+
class="flex flex-wrap items-center gap-x-4 gap-y-2 whitespace-nowrap text-sm text-gray-500 hover:*:text-gray-800 max-sm:justify-center"
|
101 |
>
|
102 |
+
<div class="w-full sm:w-auto">
|
103 |
+
<button
|
104 |
+
class="mx-auto my-2 flex w-full w-min items-center justify-center rounded-full bg-black px-3 py-1 text-base !text-white"
|
105 |
+
name="Activate model"
|
106 |
+
on:click|stopPropagation={() => {
|
107 |
+
settings.instantSet({
|
108 |
+
activeModel: $page.params.assistantId,
|
109 |
+
});
|
110 |
+
goto(`${base}/`);
|
111 |
+
}}
|
112 |
+
>
|
113 |
+
<CarbonChat class="mr-1.5 text-sm" />
|
114 |
+
New chat
|
115 |
+
</button>
|
116 |
+
</div>
|
117 |
{#if assistant?.createdByMe}
|
118 |
<a href="{base}/settings/assistants/{assistant?._id}/edit" class="underline"
|
119 |
><CarbonPen class="mr-1.5 inline text-xs" />Edit
|
src/routes/tools/[toolId]/+page.svelte
CHANGED
@@ -46,29 +46,31 @@
|
|
46 |
<Modal on:close={() => goto(previousPage)} width="min-w-xl">
|
47 |
<div class="w-full min-w-64 p-8">
|
48 |
<div class="flex h-full flex-col gap-2">
|
49 |
-
<div class="flex gap-6">
|
50 |
-
<
|
|
|
|
|
51 |
|
52 |
<div class="flex-1">
|
53 |
-
<div>
|
54 |
-
<h1 class="
|
55 |
{data.tool.displayName}
|
56 |
</h1>
|
57 |
-
<span class="
|
58 |
>public</span
|
59 |
>
|
60 |
</div>
|
61 |
|
62 |
{#if data.tool?.baseUrl}
|
63 |
{#if data.tool.baseUrl.startsWith("https://")}
|
64 |
-
<p class="mb-2
|
65 |
{data.tool.baseUrl}
|
66 |
</p>
|
67 |
{:else}
|
68 |
<a
|
69 |
href="https://huggingface.co/spaces/{data.tool.baseUrl}"
|
70 |
target="_blank"
|
71 |
-
class="mb-2
|
72 |
>
|
73 |
{data.tool.baseUrl}
|
74 |
</a>
|
@@ -91,27 +93,29 @@
|
|
91 |
{/if}
|
92 |
|
93 |
<div
|
94 |
-
class="flex items-center gap-4 whitespace-nowrap text-sm text-gray-500 hover:*:text-gray-800"
|
95 |
>
|
96 |
-
<
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
|
|
|
|
115 |
{#if data.tool?.createdByMe}
|
116 |
<a href="{base}/tools/{data.tool?._id}/edit" class="underline"
|
117 |
><CarbonPen class="mr-1.5 inline text-xs" />Edit
|
@@ -182,8 +186,7 @@
|
|
182 |
</div>
|
183 |
</div>
|
184 |
</div>
|
185 |
-
|
186 |
-
<p class="text-sm">
|
187 |
Tools are applications that the model can choose to call while you are chatting with it.
|
188 |
</p>
|
189 |
{#if data.tool.description}
|
@@ -197,19 +200,22 @@
|
|
197 |
<h2 class="text-lg font-semibold">Direct URL</h2>
|
198 |
|
199 |
<p class="pb-2 text-sm text-gray-500">Share this link with people to use your tool.</p>
|
200 |
-
|
201 |
<div
|
202 |
-
class="flex flex-row gap-2 rounded-lg border-2 border-gray-200 bg-gray-100 py-2 pl-3 pr-1.5"
|
203 |
>
|
204 |
-
<
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
|
|
|
|
|
|
|
|
211 |
</div>
|
212 |
-
</
|
213 |
</div>
|
214 |
</div>
|
215 |
</div>
|
|
|
46 |
<Modal on:close={() => goto(previousPage)} width="min-w-xl">
|
47 |
<div class="w-full min-w-64 p-8">
|
48 |
<div class="flex h-full flex-col gap-2">
|
49 |
+
<div class="flex flex-col sm:flex-row sm:gap-6">
|
50 |
+
<div class="mb-4 flex justify-center sm:mb-0">
|
51 |
+
<ToolLogo color={data.tool.color} icon={data.tool.icon} size="lg" />
|
52 |
+
</div>
|
53 |
|
54 |
<div class="flex-1">
|
55 |
+
<div class="flex flex-wrap items-center gap-2">
|
56 |
+
<h1 class="break-words text-xl font-semibold">
|
57 |
{data.tool.displayName}
|
58 |
</h1>
|
59 |
+
<span class="inline rounded-full border px-2 py-0.5 text-sm leading-none text-gray-500"
|
60 |
>public</span
|
61 |
>
|
62 |
</div>
|
63 |
|
64 |
{#if data.tool?.baseUrl}
|
65 |
{#if data.tool.baseUrl.startsWith("https://")}
|
66 |
+
<p class="mb-2 break-words font-mono text-gray-500">
|
67 |
{data.tool.baseUrl}
|
68 |
</p>
|
69 |
{:else}
|
70 |
<a
|
71 |
href="https://huggingface.co/spaces/{data.tool.baseUrl}"
|
72 |
target="_blank"
|
73 |
+
class="mb-2 break-words font-mono text-gray-500 hover:underline"
|
74 |
>
|
75 |
{data.tool.baseUrl}
|
76 |
</a>
|
|
|
93 |
{/if}
|
94 |
|
95 |
<div
|
96 |
+
class="flex flex-wrap items-center justify-center gap-x-4 gap-y-2 whitespace-nowrap text-sm text-gray-500 hover:*:text-gray-800"
|
97 |
>
|
98 |
+
<div class="w-full sm:w-auto">
|
99 |
+
<button
|
100 |
+
class="{isActive
|
101 |
+
? 'bg-gray-100 text-gray-800'
|
102 |
+
: 'bg-black !text-white'} mx-auto my-2 flex w-full w-min items-center justify-center rounded-full px-3 py-1 text-base"
|
103 |
+
name="Activate model"
|
104 |
+
on:click|stopPropagation={() => {
|
105 |
+
if (isActive) {
|
106 |
+
settings.instantSet({
|
107 |
+
tools: ($settings?.tools ?? []).filter((t) => t !== data.tool._id),
|
108 |
+
});
|
109 |
+
} else {
|
110 |
+
settings.instantSet({
|
111 |
+
tools: [...($settings?.tools ?? []), data.tool._id],
|
112 |
+
});
|
113 |
+
}
|
114 |
+
}}
|
115 |
+
>
|
116 |
+
{isActive ? "Deactivate" : "Activate"}
|
117 |
+
</button>
|
118 |
+
</div>
|
119 |
{#if data.tool?.createdByMe}
|
120 |
<a href="{base}/tools/{data.tool?._id}/edit" class="underline"
|
121 |
><CarbonPen class="mr-1.5 inline text-xs" />Edit
|
|
|
186 |
</div>
|
187 |
</div>
|
188 |
</div>
|
189 |
+
<p class="text-sm max-sm:hidden">
|
|
|
190 |
Tools are applications that the model can choose to call while you are chatting with it.
|
191 |
</p>
|
192 |
{#if data.tool.description}
|
|
|
200 |
<h2 class="text-lg font-semibold">Direct URL</h2>
|
201 |
|
202 |
<p class="pb-2 text-sm text-gray-500">Share this link with people to use your tool.</p>
|
|
|
203 |
<div
|
204 |
+
class="flex flex-row items-center gap-2 rounded-lg border-2 border-gray-200 bg-gray-100 py-2 pl-3 pr-1.5"
|
205 |
>
|
206 |
+
<div class="relative flex-1 overflow-hidden">
|
207 |
+
<input disabled class="w-full truncate bg-inherit pr-16" value={shareUrl} />
|
208 |
+
<div class="absolute right-0 top-1/2 -translate-y-1/2">
|
209 |
+
<CopyToClipBoardBtn
|
210 |
+
value={shareUrl}
|
211 |
+
classNames="!border-none !shadow-none !py-0 !px-1 !rounded-md"
|
212 |
+
>
|
213 |
+
<div class="flex items-center gap-1.5 text-gray-500 hover:underline">
|
214 |
+
<CarbonLink />Copy
|
215 |
+
</div>
|
216 |
+
</CopyToClipBoardBtn>
|
217 |
</div>
|
218 |
+
</div>
|
219 |
</div>
|
220 |
</div>
|
221 |
</div>
|