fa50a45e84
CI / Build & Quality Checks (push) Failing after 5m12s
Prettier: auto-formatted 103 files to fix baseline. Prettier check in CI is now a hard gate (removed continue-on-error). Brotli: installed libnginx-mod-http-brotli-filter/static. Enabled in nginx with brotli_static on for pre-compressed assets and comp_level 6. Sentry releases: deploy script now exports VITE_APP_VERSION=<git-short-sha> before building so each Sentry release maps to an exact commit. CI also passes github.sha as VITE_APP_VERSION. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
98 lines
2.9 KiB
TypeScript
98 lines
2.9 KiB
TypeScript
import React from 'react';
|
|
import {
|
|
Box,
|
|
config,
|
|
Header,
|
|
Icon,
|
|
IconButton,
|
|
Icons,
|
|
Modal,
|
|
Overlay,
|
|
OverlayBackdrop,
|
|
OverlayCenter,
|
|
Scroll,
|
|
Text,
|
|
} from 'folds';
|
|
import FocusTrap from 'focus-trap-react';
|
|
import { useAllJoinedRoomsSet, useGetRoom } from '../../hooks/useGetRoom';
|
|
import { SpaceProvider } from '../../hooks/useSpace';
|
|
import { CreateSpaceForm } from './CreateSpace';
|
|
import {
|
|
useCloseCreateSpaceModal,
|
|
useCreateSpaceModalState,
|
|
} from '../../state/hooks/createSpaceModal';
|
|
import { CreateSpaceModalState } from '../../state/createSpaceModal';
|
|
import { stopPropagation } from '../../utils/keyboard';
|
|
|
|
type CreateSpaceModalProps = {
|
|
state: CreateSpaceModalState;
|
|
};
|
|
function CreateSpaceModal({ state }: CreateSpaceModalProps) {
|
|
const { spaceId } = state;
|
|
const closeDialog = useCloseCreateSpaceModal();
|
|
|
|
const allJoinedRooms = useAllJoinedRoomsSet();
|
|
const getRoom = useGetRoom(allJoinedRooms);
|
|
const space = spaceId ? getRoom(spaceId) : undefined;
|
|
|
|
return (
|
|
<SpaceProvider value={space ?? null}>
|
|
<Overlay open backdrop={<OverlayBackdrop />}>
|
|
<OverlayCenter>
|
|
<FocusTrap
|
|
focusTrapOptions={{
|
|
initialFocus: false,
|
|
clickOutsideDeactivates: true,
|
|
onDeactivate: closeDialog,
|
|
escapeDeactivates: stopPropagation,
|
|
}}
|
|
>
|
|
<Modal size="300" flexHeight>
|
|
<Box direction="Column">
|
|
<Header
|
|
size="500"
|
|
style={{
|
|
padding: config.space.S200,
|
|
paddingLeft: config.space.S400,
|
|
borderBottomWidth: config.borderWidth.B300,
|
|
}}
|
|
>
|
|
<Box grow="Yes">
|
|
<Text as="h2" size="H4">
|
|
New Space
|
|
</Text>
|
|
</Box>
|
|
<Box shrink="No">
|
|
<IconButton size="300" radii="300" onClick={closeDialog} aria-label="Close">
|
|
<Icon src={Icons.Cross} />
|
|
</IconButton>
|
|
</Box>
|
|
</Header>
|
|
<Scroll size="300" hideTrack>
|
|
<Box
|
|
style={{
|
|
padding: config.space.S400,
|
|
paddingRight: config.space.S200,
|
|
}}
|
|
direction="Column"
|
|
gap="500"
|
|
>
|
|
<CreateSpaceForm space={space} onCreate={closeDialog} />
|
|
</Box>
|
|
</Scroll>
|
|
</Box>
|
|
</Modal>
|
|
</FocusTrap>
|
|
</OverlayCenter>
|
|
</Overlay>
|
|
</SpaceProvider>
|
|
);
|
|
}
|
|
|
|
export function CreateSpaceModalRenderer() {
|
|
const state = useCreateSpaceModalState();
|
|
|
|
if (!state) return null;
|
|
return <CreateSpaceModal state={state} />;
|
|
}
|