WIP - new profile view

This commit is contained in:
Ajay Bura 2025-07-17 09:48:01 +05:30
parent c757b8967f
commit 275b5bb18f
12 changed files with 568 additions and 6 deletions

View file

@ -0,0 +1,40 @@
import { useCallback } from 'react';
import { useAtomValue, useSetAtom } from 'jotai';
import { RectCords } from 'folds';
import { userRoomProfileAtom, UserRoomProfileState } from '../userRoomProfile';
export const useUserRoomProfileState = (): UserRoomProfileState | undefined => {
const data = useAtomValue(userRoomProfileAtom);
return data;
};
type CloseCallback = () => void;
export const useCloseUserRoomProfile = (): CloseCallback => {
const setUserRoomProfile = useSetAtom(userRoomProfileAtom);
const close: CloseCallback = useCallback(() => {
setUserRoomProfile(undefined);
}, [setUserRoomProfile]);
return close;
};
type OpenCallback = (
roomId: string,
spaceId: string | undefined,
userId: string,
cords: RectCords
) => void;
export const useOpenUserRoomProfile = (): OpenCallback => {
const setUserRoomProfile = useSetAtom(userRoomProfileAtom);
const open: OpenCallback = useCallback(
(roomId, spaceId, userId, cords) => {
setUserRoomProfile({ roomId, spaceId, userId, cords });
},
[setUserRoomProfile]
);
return open;
};