Skip to content

Commit

Permalink
add search for space
Browse files Browse the repository at this point in the history
  • Loading branch information
ajbura committed Apr 4, 2024
1 parent 2b8a052 commit f01e0eb
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions src/app/pages/client/space/Search.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,29 @@
import React, { useRef } from 'react';
import { Box, Icon, Icons, Text, Scroll } from 'folds';
import { useAtomValue } from 'jotai';
import { Page, PageContent, PageContentCenter, PageHeader } from '../../../components/page';
import { MessageSearch } from '../../../features/message-search';
import { useSpace } from '../../../hooks/useSpace';
import { useSpaceChildRoomsRecursive } from '../../../state/hooks/roomList';
import { allRoomsAtom } from '../../../state/room-list/roomList';
import { mDirectAtom } from '../../../state/mDirectList';
import { roomToParentsAtom } from '../../../state/room/roomToParents';
import { useMatrixClient } from '../../../hooks/useMatrixClient';

export function SpaceSearch() {
const mx = useMatrixClient();
const scrollRef = useRef<HTMLDivElement>(null);
const rooms = [''];
const space = useSpace();

const mDirects = useAtomValue(mDirectAtom);
const roomToParents = useAtomValue(roomToParentsAtom);
const rooms = useSpaceChildRoomsRecursive(
mx,
space.roomId,
allRoomsAtom,
mDirects,
roomToParents
);

return (
<Page>
Expand All @@ -22,7 +40,7 @@ export function SpaceSearch() {
<PageContent>
<PageContentCenter>
<MessageSearch
defaultRoomsFilterName="Space"
defaultRoomsFilterName={space.name}
allowGlobal
rooms={rooms}
scrollRef={scrollRef}
Expand Down

0 comments on commit f01e0eb

Please sign in to comment.