import { proxy, useSnapshot } from 'valtio' import { hideCurrentModal, showModal } from '../globalState' import Screen from './Screen' import { useIsModalActive } from './utilsApp' import Button from './Button' const state = proxy({ title: '', options: [] as string[] }) let resolve export const showOptionsModal = async (title: string, options: T[]): Promise => { showModal({ reactType: 'general-select' }) return new Promise((_resolve) => { resolve = _resolve Object.assign(state, { title, options }) }) } export default () => { const { title, options } = useSnapshot(state) const isModalActive = useIsModalActive('general-select') if (!isModalActive) return return {options.map(option => )} }