mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-02-24 06:03:04 +01:00
add search for space
This commit is contained in:
parent
2b8a052576
commit
f01e0ebac5
1 changed files with 20 additions and 2 deletions
|
@ -1,11 +1,29 @@
|
||||||
import React, { useRef } from 'react';
|
import React, { useRef } from 'react';
|
||||||
import { Box, Icon, Icons, Text, Scroll } from 'folds';
|
import { Box, Icon, Icons, Text, Scroll } from 'folds';
|
||||||
|
import { useAtomValue } from 'jotai';
|
||||||
import { Page, PageContent, PageContentCenter, PageHeader } from '../../../components/page';
|
import { Page, PageContent, PageContentCenter, PageHeader } from '../../../components/page';
|
||||||
import { MessageSearch } from '../../../features/message-search';
|
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() {
|
export function SpaceSearch() {
|
||||||
|
const mx = useMatrixClient();
|
||||||
const scrollRef = useRef<HTMLDivElement>(null);
|
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 (
|
return (
|
||||||
<Page>
|
<Page>
|
||||||
|
@ -22,7 +40,7 @@ export function SpaceSearch() {
|
||||||
<PageContent>
|
<PageContent>
|
||||||
<PageContentCenter>
|
<PageContentCenter>
|
||||||
<MessageSearch
|
<MessageSearch
|
||||||
defaultRoomsFilterName="Space"
|
defaultRoomsFilterName={space.name}
|
||||||
allowGlobal
|
allowGlobal
|
||||||
rooms={rooms}
|
rooms={rooms}
|
||||||
scrollRef={scrollRef}
|
scrollRef={scrollRef}
|
||||||
|
|
Loading…
Reference in a new issue