mirror of
https://github.com/aljazceru/rabbit.git
synced 2025-12-17 05:54:19 +01:00
25 lines
680 B
TypeScript
25 lines
680 B
TypeScript
import { createSignal } from 'solid-js';
|
|
|
|
type ModalState =
|
|
| { type: 'Profile'; pubkey: string }
|
|
| { type: 'ProfileEdit' }
|
|
| { type: 'UserTimeline'; pubkey: string }
|
|
| { type: 'Closed' };
|
|
|
|
const [modalState, setModalState] = createSignal<ModalState>({ type: 'Closed' });
|
|
|
|
const useModalState = () => {
|
|
const showProfile = (pubkey: string) => {
|
|
setModalState({ type: 'Profile', pubkey });
|
|
};
|
|
const showProfileEdit = () => {
|
|
setModalState({ type: 'ProfileEdit' });
|
|
};
|
|
const closeModal = () => {
|
|
setModalState({ type: 'Closed' });
|
|
};
|
|
return { modalState, setModalState, showProfile, showProfileEdit, closeModal };
|
|
};
|
|
|
|
export default useModalState;
|