mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-05 06:28:51 +00:00
Make Camera app use router (#69)
* Make Camera app use router * Remove unused hooks * Fucking communicate messages with camera with router * Improved sharing in messages flow * Fix clipboard * Removeunused imports * improve routing helpers * Fix bug :D * Fix stupid thing * Add docs to useQueryParams hook
This commit is contained in:
1 parent
447c51a07e
commit
40f9555b39
34 files changed
+481
-294
No files matched your search
@@ -1,19 +1,22 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { List } from '@material-ui/core';
|
||||
|
||||
import qs from 'qs';
|
||||
import { MessageGroup } from '../../../../common/typings/messages';
|
||||
import Nui from '../../../../os/nui-events/utils/Nui';
|
||||
import useMessages from '../../hooks/useMessages';
|
||||
import useModals from '../../hooks/useModals';
|
||||
import MessageSearch from './MessageSearch';
|
||||
import MessageGroupItem from './MessageGroupItem';
|
||||
import useStyles from './list.styles';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
import NewMessageGroupButton from '../buttons/NewMessageGroupButton';
|
||||
|
||||
const MessagesList = (): any => {
|
||||
const classes = useStyles();
|
||||
const [searchValue, setSearchValue] = useState('');
|
||||
const history = useHistory();
|
||||
|
||||
const { messageGroups } = useMessages();
|
||||
const { setActiveMessageGroup } = useModals();
|
||||
|
||||
const [searchValue, setSearchValue] = useState('');
|
||||
|
||||
useEffect(() => {
|
||||
Nui.send('phone:fetchMessageGroups');
|
||||
@@ -22,8 +25,12 @@ const MessagesList = (): any => {
|
||||
if (!messageGroups) return null;
|
||||
|
||||
const handleClick = (messageGroup: MessageGroup) => () => {
|
||||
setActiveMessageGroup(messageGroup);
|
||||
Nui.send('phone:fetchMessages', { groupId: messageGroup.groupId });
|
||||
history.push(
|
||||
`/messages/conversations/${messageGroup.groupId}/?${qs.stringify(
|
||||
messageGroup
|
||||
)}`
|
||||
);
|
||||
};
|
||||
|
||||
const formattedSearch = searchValue.toLowerCase().trim();
|
||||
@@ -54,6 +61,7 @@ const MessagesList = (): any => {
|
||||
/>
|
||||
))}
|
||||
</List>
|
||||
<NewMessageGroupButton onClick={() => history.push('/messages/new')} />
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user