f270812219
Add token library/placements, keep play-time moves for the session, lock presentation interactions, and fix export/import modal layout plus freeform trap label. Co-authored-by: Cursor <cursoragent@cursor.com>
18 lines
569 B
TypeScript
18 lines
569 B
TypeScript
import { useEffect, useState } from 'react';
|
|
|
|
import { ipcChannels } from '../../../shared/ipc/contracts';
|
|
import type { AppToken } from '../../../shared/types';
|
|
import { getDndApi } from '../dndApi';
|
|
|
|
export function useAppTokens(): AppToken[] {
|
|
const api = getDndApi();
|
|
const [tokens, setTokens] = useState<AppToken[]>([]);
|
|
|
|
useEffect(() => {
|
|
void api.invoke(ipcChannels.tokens.list, {}).then(({ tokens: list }) => setTokens(list));
|
|
return api.on(ipcChannels.tokens.stateChanged, ({ tokens: list }) => setTokens(list));
|
|
}, [api]);
|
|
|
|
return tokens;
|
|
}
|