feat: add dropdown for token details

This commit is contained in:
Zoe
2026-03-02 10:45:14 -06:00
parent d40e5a7404
commit 579f4730c8
6 changed files with 180 additions and 5 deletions
+30
View File
@@ -0,0 +1,30 @@
import type { Entity } from '@triplit/client';
import type { schema } from '#triplit/schema';
type Generation = Entity<typeof schema, 'generations'>;
export const useTokenDropdown = () => {
const isOpen = useState('token-dropdown:open', () => false);
const activeGeneration = useState<Generation | null>('token-dropdown:generation', () => null);
const triggerElement = useState<HTMLElement | null>('token-dropdown:trigger', () => null);
const open = (generation: Generation, trigger: HTMLElement) => {
console.log("open", generation, trigger);
activeGeneration.value = generation;
triggerElement.value = trigger;
isOpen.value = true;
};
const close = () => {
isOpen.value = false;
};
return {
isOpen: readonly(isOpen),
activeGeneration: readonly(activeGeneration),
triggerElement: readonly(triggerElement),
open,
close,
};
};