Thomas G. Lopes commited on
Commit
f77d645
·
1 Parent(s): 2d80f1b

add tooltip to actions

Browse files
src/lib/components/inference-playground/project-select.svelte CHANGED
@@ -8,6 +8,7 @@
8
  import IconSave from "~icons/carbon/save";
9
  import IconDelete from "~icons/carbon/trash-can";
10
  import { prompt } from "../prompts.svelte";
 
11
 
12
  interface Props {
13
  class?: string;
@@ -47,14 +48,29 @@
47
  <IconCaret />
48
  </div>
49
  </button>
 
50
  {#if isDefault}
51
- <button class="btn size-[32px] p-0" onclick={saveProject}>
52
- <IconSave />
53
- </button>
 
 
 
 
 
54
  {:else}
55
- <button class="btn size-[32px] p-0" onclick={() => (session.$.activeProjectId = "default")}>
56
- <IconCross />
57
- </button>
 
 
 
 
 
 
 
 
 
58
  {/if}
59
  </div>
60
 
 
8
  import IconSave from "~icons/carbon/save";
9
  import IconDelete from "~icons/carbon/trash-can";
10
  import { prompt } from "../prompts.svelte";
11
+ import Tooltip from "../tooltip.svelte";
12
 
13
  interface Props {
14
  class?: string;
 
48
  <IconCaret />
49
  </div>
50
  </button>
51
+
52
  {#if isDefault}
53
+ <Tooltip>
54
+ {#snippet trigger(tooltip)}
55
+ <button class="btn size-[32px] p-0" {...tooltip.trigger} onclick={saveProject}>
56
+ <IconSave />
57
+ </button>
58
+ {/snippet}
59
+ Save to Project
60
+ </Tooltip>
61
  {:else}
62
+ <Tooltip>
63
+ {#snippet trigger(tooltip)}
64
+ <button
65
+ class="btn size-[32px] p-0"
66
+ {...tooltip.trigger}
67
+ onclick={() => (session.$.activeProjectId = "default")}
68
+ >
69
+ <IconCross />
70
+ </button>
71
+ {/snippet}
72
+ Close project
73
+ </Tooltip>
74
  {/if}
75
  </div>
76
 
src/lib/components/tooltip.svelte CHANGED
@@ -9,7 +9,7 @@
9
  placement?: NonNullable<Extracted<TooltipProps["computePositionOptions"]>>["placement"];
10
  openDelay?: ComponentProps<TooltipProps>["openDelay"];
11
  }
12
- const { children, trigger, placement = "top", openDelay }: Props = $props();
13
 
14
  const tooltip = new Tooltip({
15
  forceVisible: true,
 
9
  placement?: NonNullable<Extracted<TooltipProps["computePositionOptions"]>>["placement"];
10
  openDelay?: ComponentProps<TooltipProps>["openDelay"];
11
  }
12
+ const { children, trigger, placement = "top", openDelay = 500 }: Props = $props();
13
 
14
  const tooltip = new Tooltip({
15
  forceVisible: true,