Skip to content

Commit d644838

Browse files
authored
Settings UI update (#638)
* add description * modal size * copy link to model * layout * use copy component
1 parent ad481ce commit d644838

File tree

3 files changed

+35
-15
lines changed

3 files changed

+35
-15
lines changed

src/lib/components/CopyToClipBoardBtn.svelte

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,17 @@
3535
</script>
3636

3737
<button
38-
class="btn rounded-lg border border-gray-200 px-2 py-2 text-sm shadow-sm transition-all hover:border-gray-300 active:shadow-inner dark:border-gray-600 dark:hover:border-gray-400 {classNames}
39-
{!isSuccess && 'text-gray-200 dark:text-gray-200'}
40-
{isSuccess && 'text-green-500'}
41-
"
38+
class="btn rounded-lg border border-gray-200 px-2 py-2 text-sm shadow-sm transition-all hover:border-gray-300 active:shadow-inner dark:border-gray-700 dark:hover:border-gray-500 {classNames}"
4239
title={"Copy to clipboard"}
4340
type="button"
4441
on:click
4542
on:click={handleClick}
4643
>
47-
<span class="relative">
48-
<IconCopy />
44+
<div class="relative">
45+
<slot>
46+
<IconCopy />
47+
</slot>
48+
4949
<Tooltip classNames={isSuccess ? "opacity-100" : "opacity-0"} />
50-
</span>
50+
</div>
5151
</button>

src/routes/settings/+layout.svelte

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
if (browser) window;
3232
goto(previousPage);
3333
}}
34-
class="z-10 grid h-[95dvh] w-[90dvw] grid-cols-1 content-start gap-x-10 gap-y-6 overflow-hidden rounded-2xl bg-white p-4 shadow-2xl outline-none sm:h-[80dvh] md:grid-cols-3 md:grid-rows-[auto,1fr] md:p-8 xl:w-[1100px]"
34+
class="xl: z-10 grid h-[95dvh] w-[90dvw] grid-cols-1 content-start gap-x-10 gap-y-6 overflow-hidden rounded-2xl bg-white p-4 shadow-2xl outline-none sm:h-[80dvh] md:grid-cols-3 md:grid-rows-[auto,1fr] md:p-8 xl:w-[1200px] 2xl:h-[70dvh]"
3535
>
3636
<div class="col-span-1 flex items-center justify-between md:col-span-3">
3737
<h2 class="text-xl font-bold">Settings</h2>
@@ -46,7 +46,7 @@
4646
</button>
4747
</div>
4848
<div
49-
class="col-span-1 flex flex-col overflow-y-auto whitespace-nowrap max-md:-mx-4 max-md:h-[160px] max-md:border md:pr-6"
49+
class="col-span-1 flex flex-col overflow-y-auto whitespace-nowrap max-md:-mx-4 max-md:h-[245px] max-md:border md:pr-6"
5050
>
5151
{#each data.models.filter((el) => !el.unlisted) as model}
5252
<a
@@ -82,8 +82,10 @@
8282
</div>
8383

8484
{#if $settings.recentlySaved}
85-
<div class="absolute bottom-0 right-0 m-2 inline p-2 text-gray-400">
86-
<CarbonCheckmark class="inline text-lg" />
85+
<div
86+
class="absolute bottom-4 right-4 m-2 flex items-center gap-1.5 rounded-full border border-gray-300 bg-gray-200 px-3 py-1 text-black"
87+
>
88+
<CarbonCheckmark />
8789
Saved
8890
</div>
8991
{/if}

src/routes/settings/[...model]/+page.svelte

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
import { page } from "$app/stores";
33
import type { BackendModel } from "$lib/server/models";
44
import { useSettingsStore } from "$lib/stores/settings";
5+
import CopyToClipBoardBtn from "$lib/components/CopyToClipBoardBtn.svelte";
56
import CarbonArrowUpRight from "~icons/carbon/arrow-up-right";
7+
import CarbonLink from "~icons/carbon/link";
68
79
const settings = useSettingsStore();
810
@@ -24,11 +26,19 @@
2426
</script>
2527

2628
<div class="flex flex-col items-start">
27-
<h2 class="mb-2.5 text-xl font-semibold">
28-
{$page.params.model}
29-
</h2>
29+
<div class="mb-5 flex flex-col gap-1.5">
30+
<h2 class="text-lg font-semibold md:text-xl">
31+
{$page.params.model}
32+
</h2>
3033

31-
<div class="flex items-center gap-4">
34+
{#if model.description}
35+
<p class=" text-gray-600">
36+
{model.description}
37+
</p>
38+
{/if}
39+
</div>
40+
41+
<div class="flex flex-wrap items-center gap-2 md:gap-4">
3242
<a
3343
href={model.modelUrl || "https://huggingface.co/" + model.name}
3444
target="_blank"
@@ -62,6 +72,14 @@
6272
Model website
6373
</a>
6474
{/if}
75+
<CopyToClipBoardBtn
76+
value="{$page.url.origin}/?model={model.id}"
77+
classNames="!border-none !shadow-none !py-0 !px-1 !rounded-md"
78+
>
79+
<div class="flex items-center gap-1.5">
80+
<CarbonLink />Copy direct link to model
81+
</div>
82+
</CopyToClipBoardBtn>
6583
</div>
6684

6785
<button

0 commit comments

Comments
 (0)