nsarrazin HF Staff commited on
Commit
72fed8b
·
1 Parent(s): fb9fe6d

feat: add indicator to show active model in `/models`

Browse files
src/routes/models/+page.svelte CHANGED
@@ -10,7 +10,10 @@
10
  import CarbonHelpFilled from "~icons/carbon/help-filled";
11
  import CarbonTools from "~icons/carbon/tools";
12
  import CarbonImage from "~icons/carbon/image";
 
13
  export let data: PageData;
 
 
14
  </script>
15
 
16
  <svelte:head>
@@ -45,6 +48,7 @@
45
  aria-label="Model card"
46
  role="region"
47
  class="relative flex flex-col gap-2 overflow-hidden rounded-xl border bg-gray-50/50 px-6 py-5 shadow hover:bg-gray-50 hover:shadow-inner dark:border-gray-800/70 dark:bg-gray-950/20 dark:hover:bg-gray-950/40"
 
48
  >
49
  <a
50
  href="{base}/models/{model.id}"
@@ -84,7 +88,13 @@
84
  <CarbonImage class="text-xxs text-blue-700 dark:text-blue-500" />
85
  </span>
86
  {/if}
87
- {#if index === 0}
 
 
 
 
 
 
88
  <span
89
  class="rounded-full border border-gray-300 px-2 py-0.5 text-xs text-gray-500 dark:border-gray-500 dark:text-gray-400"
90
  >
@@ -103,3 +113,9 @@
103
  </div>
104
  </div>
105
  </div>
 
 
 
 
 
 
 
10
  import CarbonHelpFilled from "~icons/carbon/help-filled";
11
  import CarbonTools from "~icons/carbon/tools";
12
  import CarbonImage from "~icons/carbon/image";
13
+ import { useSettingsStore } from "$lib/stores/settings";
14
  export let data: PageData;
15
+
16
+ const settings = useSettingsStore();
17
  </script>
18
 
19
  <svelte:head>
 
48
  aria-label="Model card"
49
  role="region"
50
  class="relative flex flex-col gap-2 overflow-hidden rounded-xl border bg-gray-50/50 px-6 py-5 shadow hover:bg-gray-50 hover:shadow-inner dark:border-gray-800/70 dark:bg-gray-950/20 dark:hover:bg-gray-950/40"
51
+ class:active-model={model.id === $settings.activeModel}
52
  >
53
  <a
54
  href="{base}/models/{model.id}"
 
88
  <CarbonImage class="text-xxs text-blue-700 dark:text-blue-500" />
89
  </span>
90
  {/if}
91
+ {#if model.id === $settings.activeModel}
92
+ <span
93
+ class="rounded-full border border-blue-500 bg-blue-500/5 px-2 py-0.5 text-xs text-blue-500 dark:border-blue-500 dark:bg-blue-500/10"
94
+ >
95
+ Active
96
+ </span>
97
+ {:else if index === 0}
98
  <span
99
  class="rounded-full border border-gray-300 px-2 py-0.5 text-xs text-gray-500 dark:border-gray-500 dark:text-gray-400"
100
  >
 
113
  </div>
114
  </div>
115
  </div>
116
+
117
+ <style lang="postcss">
118
+ .active-model {
119
+ @apply border-blue-500 bg-blue-500/5 hover:bg-blue-500/10;
120
+ }
121
+ </style>
src/routes/models/[...model]/+page.svelte CHANGED
@@ -60,6 +60,8 @@
60
  onMount(async () => {
61
  const query = $page.url.searchParams.get("q");
62
  if (query) createConversation(query);
 
 
63
  });
64
  </script>
65
 
 
60
  onMount(async () => {
61
  const query = $page.url.searchParams.get("q");
62
  if (query) createConversation(query);
63
+
64
+ settings.instantSet({ activeModel: modelId });
65
  });
66
  </script>
67