mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-11-05 06:50:28 +03:00
Merge branch 'dev' into improve-space
This commit is contained in:
commit
b9ce2519db
356 changed files with 7632 additions and 9883 deletions
|
|
@ -33,10 +33,12 @@ import { AsyncStatus, useAsyncCallback } from '../../hooks/useAsyncCallback';
|
|||
import * as css from './SpaceItem.css';
|
||||
import * as styleCss from './style.css';
|
||||
import { useDraggableItem } from './DnD';
|
||||
import { openCreateRoom, openSpaceAddExisting } from '../../../client/action/navigation';
|
||||
import { stopPropagation } from '../../utils/keyboard';
|
||||
import { mxcUrlToHttp } from '../../utils/matrix';
|
||||
import { useMediaAuthentication } from '../../hooks/useMediaAuthentication';
|
||||
import { useOpenCreateRoomModal } from '../../state/hooks/createRoomModal';
|
||||
import { useOpenCreateSpaceModal } from '../../state/hooks/createSpaceModal';
|
||||
import { AddExistingModal } from '../add-existing';
|
||||
|
||||
function SpaceProfileLoading() {
|
||||
return (
|
||||
|
|
@ -243,18 +245,20 @@ function RootSpaceProfile({ closed, categoryId, handleClose }: RootSpaceProfileP
|
|||
|
||||
function AddRoomButton({ item }: { item: HierarchyItem }) {
|
||||
const [cords, setCords] = useState<RectCords>();
|
||||
const openCreateRoomModal = useOpenCreateRoomModal();
|
||||
const [addExisting, setAddExisting] = useState(false);
|
||||
|
||||
const handleAddRoom: MouseEventHandler<HTMLButtonElement> = (evt) => {
|
||||
setCords(evt.currentTarget.getBoundingClientRect());
|
||||
};
|
||||
|
||||
const handleCreateRoom = () => {
|
||||
openCreateRoom(false, item.roomId as any);
|
||||
openCreateRoomModal(item.roomId);
|
||||
setCords(undefined);
|
||||
};
|
||||
|
||||
const handleAddExisting = () => {
|
||||
openSpaceAddExisting(item.roomId);
|
||||
setAddExisting(true);
|
||||
setCords(undefined);
|
||||
};
|
||||
|
||||
|
|
@ -274,7 +278,7 @@ function AddRoomButton({ item }: { item: HierarchyItem }) {
|
|||
escapeDeactivates: stopPropagation,
|
||||
}}
|
||||
>
|
||||
<Menu style={{ padding: config.space.S200 }}>
|
||||
<Menu style={{ padding: config.space.S100 }}>
|
||||
<MenuItem
|
||||
size="300"
|
||||
radii="300"
|
||||
|
|
@ -300,24 +304,29 @@ function AddRoomButton({ item }: { item: HierarchyItem }) {
|
|||
>
|
||||
<Text size="B300">Add Room</Text>
|
||||
</Chip>
|
||||
{addExisting && (
|
||||
<AddExistingModal parentId={item.roomId} requestClose={() => setAddExisting(false)} />
|
||||
)}
|
||||
</PopOut>
|
||||
);
|
||||
}
|
||||
|
||||
function AddSpaceButton({ item }: { item: HierarchyItem }) {
|
||||
const [cords, setCords] = useState<RectCords>();
|
||||
const openCreateSpaceModal = useOpenCreateSpaceModal();
|
||||
const [addExisting, setAddExisting] = useState(false);
|
||||
|
||||
const handleAddSpace: MouseEventHandler<HTMLButtonElement> = (evt) => {
|
||||
setCords(evt.currentTarget.getBoundingClientRect());
|
||||
};
|
||||
|
||||
const handleCreateSpace = () => {
|
||||
openCreateRoom(true, item.roomId as any);
|
||||
openCreateSpaceModal(item.roomId as any);
|
||||
setCords(undefined);
|
||||
};
|
||||
|
||||
const handleAddExisting = () => {
|
||||
openSpaceAddExisting(item.roomId, true);
|
||||
setAddExisting(true);
|
||||
setCords(undefined);
|
||||
};
|
||||
return (
|
||||
|
|
@ -336,7 +345,7 @@ function AddSpaceButton({ item }: { item: HierarchyItem }) {
|
|||
escapeDeactivates: stopPropagation,
|
||||
}}
|
||||
>
|
||||
<Menu style={{ padding: config.space.S200 }}>
|
||||
<Menu style={{ padding: config.space.S100 }}>
|
||||
<MenuItem
|
||||
size="300"
|
||||
radii="300"
|
||||
|
|
@ -353,6 +362,7 @@ function AddSpaceButton({ item }: { item: HierarchyItem }) {
|
|||
</FocusTrap>
|
||||
}
|
||||
>
|
||||
|
||||
{item.parentId === undefined ? (
|
||||
<Chip
|
||||
variant="SurfaceVariant"
|
||||
|
|
@ -363,6 +373,9 @@ function AddSpaceButton({ item }: { item: HierarchyItem }) {
|
|||
>
|
||||
<Text size="B300">Add Space</Text>
|
||||
</Chip>
|
||||
{addExisting && (
|
||||
<AddExistingModal space parentId={item.roomId} requestClose={() => setAddExisting(false)} />
|
||||
)}
|
||||
) : (
|
||||
<TooltipProvider
|
||||
position="Bottom"
|
||||
|
|
@ -500,7 +513,7 @@ export const SpaceItemCard = as<'div', SpaceItemCardProps>(
|
|||
</>
|
||||
)}
|
||||
</Box>
|
||||
{canEditChild && (
|
||||
{space && canEditChild && (
|
||||
<Box shrink="No" alignItems="Inherit" gap="200">
|
||||
<AddRoomButton item={item} />
|
||||
<AddSpaceButton item={item} />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue