mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-11-04 22:40:29 +03:00
Redesign space/room creation panel (#2408)
* add new create room * rename create room modal file * default restrict access for space children in room create modal * move create room kind selector to components * add radii variant to sequence card component * more more reusable create room logic to components * add create space * update address input description * add new space modal * fix add room button visible on left room in space lobby
This commit is contained in:
parent
e9798a22c3
commit
faa952295f
33 changed files with 1637 additions and 53 deletions
34
src/app/state/hooks/createRoomModal.ts
Normal file
34
src/app/state/hooks/createRoomModal.ts
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
import { useCallback } from 'react';
|
||||
import { useAtomValue, useSetAtom } from 'jotai';
|
||||
import { createRoomModalAtom, CreateRoomModalState } from '../createRoomModal';
|
||||
|
||||
export const useCreateRoomModalState = (): CreateRoomModalState | undefined => {
|
||||
const data = useAtomValue(createRoomModalAtom);
|
||||
|
||||
return data;
|
||||
};
|
||||
|
||||
type CloseCallback = () => void;
|
||||
export const useCloseCreateRoomModal = (): CloseCallback => {
|
||||
const setSettings = useSetAtom(createRoomModalAtom);
|
||||
|
||||
const close: CloseCallback = useCallback(() => {
|
||||
setSettings(undefined);
|
||||
}, [setSettings]);
|
||||
|
||||
return close;
|
||||
};
|
||||
|
||||
type OpenCallback = (space?: string) => void;
|
||||
export const useOpenCreateRoomModal = (): OpenCallback => {
|
||||
const setSettings = useSetAtom(createRoomModalAtom);
|
||||
|
||||
const open: OpenCallback = useCallback(
|
||||
(spaceId) => {
|
||||
setSettings({ spaceId });
|
||||
},
|
||||
[setSettings]
|
||||
);
|
||||
|
||||
return open;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue