User count update (#970)
Browse files* add more range
* display on assitant page too
src/lib/components/chat/AssistantIntroduction.svelte
CHANGED
@@ -3,9 +3,11 @@
|
|
3 |
import IconGear from "~icons/bi/gear-fill";
|
4 |
import { base } from "$app/paths";
|
5 |
import type { Assistant } from "$lib/types/Assistant";
|
|
|
6 |
import IconInternet from "../icons/IconInternet.svelte";
|
7 |
import CarbonExport from "~icons/carbon/export";
|
8 |
import CarbonCheckmark from "~icons/carbon/checkmark";
|
|
|
9 |
|
10 |
import { share } from "$lib/utils/share";
|
11 |
import { PUBLIC_ORIGIN, PUBLIC_SHARE_PREFIX } from "$env/static/public";
|
@@ -22,6 +24,7 @@
|
|
22 |
| "exampleInputs"
|
23 |
| "_id"
|
24 |
| "description"
|
|
|
25 |
>;
|
26 |
|
27 |
const dispatch = createEventDispatcher<{ message: string }>();
|
@@ -44,7 +47,7 @@
|
|
44 |
class="relative mt-auto rounded-2xl bg-gray-100 text-gray-600 dark:border-gray-800 dark:bg-gray-800/60 dark:text-gray-300"
|
45 |
>
|
46 |
<div
|
47 |
-
class="mt-3 flex min-w-[80dvw] items-center gap-4 p-4 pr-1 sm:min-w-[440px] md:p-8
|
48 |
>
|
49 |
{#if assistant.avatar}
|
50 |
<img
|
@@ -83,13 +86,20 @@
|
|
83 |
{/if}
|
84 |
|
85 |
{#if assistant.createdByName}
|
86 |
-
<p class="pt-
|
87 |
-
Created by
|
88 |
-
|
89 |
-
href="{base}/assistants?user={assistant.createdByName}"
|
90 |
-
>
|
91 |
{assistant.createdByName}
|
92 |
</a>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
</p>
|
94 |
{/if}
|
95 |
</div>
|
|
|
3 |
import IconGear from "~icons/bi/gear-fill";
|
4 |
import { base } from "$app/paths";
|
5 |
import type { Assistant } from "$lib/types/Assistant";
|
6 |
+
import { formatUserCount } from "$lib/utils/formatUserCount";
|
7 |
import IconInternet from "../icons/IconInternet.svelte";
|
8 |
import CarbonExport from "~icons/carbon/export";
|
9 |
import CarbonCheckmark from "~icons/carbon/checkmark";
|
10 |
+
import CarbonUserMultiple from "~icons/carbon/user-multiple";
|
11 |
|
12 |
import { share } from "$lib/utils/share";
|
13 |
import { PUBLIC_ORIGIN, PUBLIC_SHARE_PREFIX } from "$env/static/public";
|
|
|
24 |
| "exampleInputs"
|
25 |
| "_id"
|
26 |
| "description"
|
27 |
+
| "userCount"
|
28 |
>;
|
29 |
|
30 |
const dispatch = createEventDispatcher<{ message: string }>();
|
|
|
47 |
class="relative mt-auto rounded-2xl bg-gray-100 text-gray-600 dark:border-gray-800 dark:bg-gray-800/60 dark:text-gray-300"
|
48 |
>
|
49 |
<div
|
50 |
+
class="mt-3 flex min-w-[80dvw] items-center gap-4 p-4 pr-1 sm:min-w-[440px] md:p-8 xl:gap-8"
|
51 |
>
|
52 |
{#if assistant.avatar}
|
53 |
<img
|
|
|
86 |
{/if}
|
87 |
|
88 |
{#if assistant.createdByName}
|
89 |
+
<p class="pt-1 text-sm text-gray-400 dark:text-gray-500">
|
90 |
+
Created by
|
91 |
+
<a class="hover:underline" href="{base}/assistants?user={assistant.createdByName}">
|
|
|
|
|
92 |
{assistant.createdByName}
|
93 |
</a>
|
94 |
+
{#if assistant.userCount && assistant.userCount > 1}
|
95 |
+
<span class="mx-1">路</span>
|
96 |
+
<div
|
97 |
+
class="inline-flex items-baseline gap-1 text-sm text-gray-400 dark:text-gray-500"
|
98 |
+
title="Number of users"
|
99 |
+
>
|
100 |
+
<CarbonUserMultiple class="text-xxs" />{formatUserCount(assistant.userCount)} users
|
101 |
+
</div>
|
102 |
+
{/if}
|
103 |
</p>
|
104 |
{/if}
|
105 |
</div>
|
src/lib/utils/formatUserCount.ts
CHANGED
@@ -10,7 +10,11 @@ export function formatUserCount(userCount: number): string {
|
|
10 |
{ min: 1_000, max: 2_999, label: "1k+" },
|
11 |
{ min: 3_000, max: 4_999, label: "3k+" },
|
12 |
{ min: 5_000, max: 9_999, label: "5k+" },
|
13 |
-
{ min: 10_000, max:
|
|
|
|
|
|
|
|
|
14 |
];
|
15 |
|
16 |
const range = userCountRanges.find(({ min, max }) => userCount >= min && userCount <= max);
|
|
|
10 |
{ min: 1_000, max: 2_999, label: "1k+" },
|
11 |
{ min: 3_000, max: 4_999, label: "3k+" },
|
12 |
{ min: 5_000, max: 9_999, label: "5k+" },
|
13 |
+
{ min: 10_000, max: 19_999, label: "10k+" },
|
14 |
+
{ min: 20_000, max: 29_999, label: "20k+" },
|
15 |
+
{ min: 30_000, max: 39_999, label: "30k+" },
|
16 |
+
{ min: 40_000, max: 49_999, label: "40k+" },
|
17 |
+
{ min: 50_000, max: Infinity, label: "50k+" },
|
18 |
];
|
19 |
|
20 |
const range = userCountRanges.find(({ min, max }) => userCount >= min && userCount <= max);
|