-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
110 changed files
with
9,610 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export const MOCK = 0; | ||
export const REAL = 1; | ||
export const SERVICETYPE = ; // Change this to change the source | ||
export const api = 'http://localhost:8000'; | ||
export const apiR = 'https://api.dev.tumbler.social/api'; | ||
export const apiREAL = 'https://api.dev.tumbler.social/api'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export const MOCK = 0; | ||
export const REAL = 1; | ||
export const SERVICETYPE = MOCK; // Change this to change the source | ||
export const api = 'http://localhost:8000'; | ||
export const apiR = 'https://api.dev.tumbler.social/api'; | ||
export const apiREAL = 'https://api.dev.tumbler.social/api'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export const MOCK = 0; | ||
export const REAL = 1; | ||
export const SERVICETYPE = ; // Change this to change the source | ||
export const api = 'http://localhost:8000'; | ||
export const apiR = 'https://api.dev.tumbler.social/api'; | ||
export const apiREAL = 'https://api.dev.tumbler.social/api'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export const MOCK = 0; | ||
export const REAL = 1; | ||
export const SERVICETYPE = ; // Change this to change the source | ||
export const api = 'http://localhost:8000'; | ||
export const apiR = 'https://api.dev.tumbler.social/api'; | ||
export const apiREAL = 'https://api.dev.tumbler.social/api'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export const MOCK = 0; | ||
export const REAL = 1; | ||
export const SERVICETYPE = REAL; // Change this to change the source | ||
export const api = 'http://localhost:8000'; | ||
export const apiR = 'https://api.dev.tumbler.social/api'; | ||
export const apiREAL = 'https://api.dev.tumbler.social/api'; |
104 changes: 104 additions & 0 deletions
104
...replica/.history/src/components/ChatSearchBar/subcomponents/SearchList_20211231160648.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
/* eslint-disable operator-linebreak */ | ||
import React from 'react'; | ||
import { useSelector, useDispatch } from 'react-redux'; | ||
import { | ||
ListItemAvatar, | ||
Avatar, | ||
} from '@material-ui/core'; | ||
import { Box } from '@mui/system'; | ||
import { ListItemButton } from '@mui/material'; | ||
import PropTypes from 'prop-types'; | ||
import { | ||
getChatRoomId, | ||
} from '../../../slices/chatmodule/chatmoduleAPI'; | ||
import { | ||
removeAvaterID, | ||
} from '../../../slices/chatmodule/chatmoduleSlice'; | ||
import { selectUser } from '../../../states/User/UserSlice'; | ||
import '../../ChatListResp/css/ChatListResp.css'; | ||
|
||
/** | ||
* This function is for the ChatList component this component is used | ||
* to disply the friends that the user can chat with or search for them for chatting | ||
* @method | ||
* @param {array} chats chats is an array for the chat participants's info | ||
* @returns {*} ChatList componenet | ||
*/ | ||
function SearchList({ chats }) { | ||
console.log(chats); | ||
const User = useSelector(selectUser); | ||
const dispatch = useDispatch(); | ||
const newMessagePress1 = useSelector((state) => state.Chat.newmessagepress); | ||
const chatBox = useSelector((state) => state.Chat.chatbox); | ||
const avatars = useSelector((state) => state.Chat.avatars); | ||
return ( | ||
chats.map((chat) => ( | ||
<div key={chat.id}> | ||
<ListItemButton | ||
sx={{ bgcolor: 'background.paper' }} | ||
onClick={() => { | ||
const newavatars = avatars.filter((el) => chat.friend_id === el.elem.friend_id); | ||
if (newavatars.length) { | ||
dispatch(removeAvaterID(newavatars[0])); | ||
} else | ||
if ((chatBox.length | ||
&& chatBox[0].elem.friend_id !== chat.friend_id) || chatBox.length === 0) { | ||
|
||
dispatch(getChatRoomId({ | ||
blogsID: { | ||
from_blog_id: User.primaryBlogId, | ||
to_blog_id: newMessagePress1 ? chat.friend_id : chat.friend_id, | ||
}, | ||
User, | ||
elem: chat, | ||
})); | ||
} | ||
}} | ||
> | ||
<ListItemAvatar> | ||
<Avatar src={newMessagePress1 ? chat.friend_avatar : chat.friend_avatar} style={{ margin: '5px' }} /> | ||
</ListItemAvatar> | ||
{ | ||
newMessagePress1 ? ( | ||
<Box> | ||
<p className="chat-par-name"> | ||
{chat.friend_username} | ||
</p> | ||
<p className="lastmessage"> | ||
{`${chat.friend_title}`} | ||
</p> | ||
</Box> | ||
) : ( | ||
<Box> | ||
<p className="chat-par-name"> | ||
{chat.friend_username} | ||
</p> | ||
{chat.text ? ( | ||
<p className="lastmessage"> | ||
{`${chat.blog_username}:${chat.text}`} | ||
</p> | ||
) : null} | ||
{chat.photo ? ( | ||
<p className="lastmessage"> | ||
{`${chat.blog_username}:sent a post`} | ||
</p> | ||
) : null} | ||
{chat.gif ? ( | ||
<p className="lastmessage"> | ||
{`${chat.blog_username}:sent a post`} | ||
</p> | ||
) : null} | ||
</Box> | ||
) | ||
} | ||
</ListItemButton> | ||
</div> | ||
)) | ||
); | ||
} | ||
|
||
SearchList.propTypes = { | ||
chats: PropTypes.arrayOf(Object).isRequired, | ||
}; | ||
|
||
export default SearchList; |
104 changes: 104 additions & 0 deletions
104
...replica/.history/src/components/ChatSearchBar/subcomponents/SearchList_20211231160655.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
/* eslint-disable operator-linebreak */ | ||
import React from 'react'; | ||
import { useSelector, useDispatch } from 'react-redux'; | ||
import { | ||
ListItemAvatar, | ||
Avatar, | ||
} from '@material-ui/core'; | ||
import { Box } from '@mui/system'; | ||
import { ListItemButton } from '@mui/material'; | ||
import PropTypes from 'prop-types'; | ||
import { | ||
getChatRoomId, | ||
} from '../../../slices/chatmodule/chatmoduleAPI'; | ||
import { | ||
removeAvaterID, | ||
} from '../../../slices/chatmodule/chatmoduleSlice'; | ||
import { selectUser } from '../../../states/User/UserSlice'; | ||
import '../../ChatListResp/css/ChatListResp.css'; | ||
|
||
/** | ||
* This function is for the ChatList component this component is used | ||
* to disply the friends that the user can chat with or search for them for chatting | ||
* @method | ||
* @param {array} chats chats is an array for the chat participants's info | ||
* @returns {*} ChatList componenet | ||
*/ | ||
function SearchList({ chats }) { | ||
console.log(chats); | ||
const User = useSelector(selectUser); | ||
const dispatch = useDispatch(); | ||
const newMessagePress1 = useSelector((state) => state.Chat.newmessagepress); | ||
const chatBox = useSelector((state) => state.Chat.chatbox); | ||
const avatars = useSelector((state) => state.Chat.avatars); | ||
return ( | ||
chats.map((chat) => ( | ||
<div key={chat.id}> | ||
<ListItemButton | ||
sx={{ bgcolor: 'background.paper' }} | ||
onClick={() => { | ||
const newavatars = avatars.filter((el) => chat.friend_id === el.elem.friend_id); | ||
if (newavatars.length) { | ||
dispatch(removeAvaterID(newavatars[0])); | ||
} else | ||
if ((chatBox.length | ||
&& chatBox[0].elem.friend_id !== chat.friend_id) || chatBox.length === 0) { | ||
console.log() | ||
dispatch(getChatRoomId({ | ||
blogsID: { | ||
from_blog_id: User.primaryBlogId, | ||
to_blog_id: newMessagePress1 ? chat.friend_id : chat.friend_id, | ||
}, | ||
User, | ||
elem: chat, | ||
})); | ||
} | ||
}} | ||
> | ||
<ListItemAvatar> | ||
<Avatar src={newMessagePress1 ? chat.friend_avatar : chat.friend_avatar} style={{ margin: '5px' }} /> | ||
</ListItemAvatar> | ||
{ | ||
newMessagePress1 ? ( | ||
<Box> | ||
<p className="chat-par-name"> | ||
{chat.friend_username} | ||
</p> | ||
<p className="lastmessage"> | ||
{`${chat.friend_title}`} | ||
</p> | ||
</Box> | ||
) : ( | ||
<Box> | ||
<p className="chat-par-name"> | ||
{chat.friend_username} | ||
</p> | ||
{chat.text ? ( | ||
<p className="lastmessage"> | ||
{`${chat.blog_username}:${chat.text}`} | ||
</p> | ||
) : null} | ||
{chat.photo ? ( | ||
<p className="lastmessage"> | ||
{`${chat.blog_username}:sent a post`} | ||
</p> | ||
) : null} | ||
{chat.gif ? ( | ||
<p className="lastmessage"> | ||
{`${chat.blog_username}:sent a post`} | ||
</p> | ||
) : null} | ||
</Box> | ||
) | ||
} | ||
</ListItemButton> | ||
</div> | ||
)) | ||
); | ||
} | ||
|
||
SearchList.propTypes = { | ||
chats: PropTypes.arrayOf(Object).isRequired, | ||
}; | ||
|
||
export default SearchList; |
103 changes: 103 additions & 0 deletions
103
...replica/.history/src/components/ChatSearchBar/subcomponents/SearchList_20211231160714.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
/* eslint-disable operator-linebreak */ | ||
import React from 'react'; | ||
import { useSelector, useDispatch } from 'react-redux'; | ||
import { | ||
ListItemAvatar, | ||
Avatar, | ||
} from '@material-ui/core'; | ||
import { Box } from '@mui/system'; | ||
import { ListItemButton } from '@mui/material'; | ||
import PropTypes from 'prop-types'; | ||
import { | ||
getChatRoomId, | ||
} from '../../../slices/chatmodule/chatmoduleAPI'; | ||
import { | ||
removeAvaterID, | ||
} from '../../../slices/chatmodule/chatmoduleSlice'; | ||
import { selectUser } from '../../../states/User/UserSlice'; | ||
import '../../ChatListResp/css/ChatListResp.css'; | ||
|
||
/** | ||
* This function is for the ChatList component this component is used | ||
* to disply the friends that the user can chat with or search for them for chatting | ||
* @method | ||
* @param {array} chats chats is an array for the chat participants's info | ||
* @returns {*} ChatList componenet | ||
*/ | ||
function SearchList({ chats }) { | ||
console.log(chats); | ||
const User = useSelector(selectUser); | ||
const dispatch = useDispatch(); | ||
const newMessagePress1 = useSelector((state) => state.Chat.newmessagepress); | ||
const chatBox = useSelector((state) => state.Chat.chatbox); | ||
const avatars = useSelector((state) => state.Chat.avatars); | ||
return ( | ||
chats.map((chat) => ( | ||
<div key={chat.id}> | ||
<ListItemButton | ||
sx={{ bgcolor: 'background.paper' }} | ||
onClick={() => { | ||
const newavatars = avatars.filter((el) => chat.friend_id === el.elem.friend_id); | ||
if (newavatars.length) { | ||
dispatch(removeAvaterID(newavatars[0])); | ||
} else | ||
if ((chatBox.length | ||
&& chatBox[0].elem.friend_id !== chat.friend_id) || chatBox.length === 0) { | ||
dispatch(getChatRoomId({ | ||
blogsID: { | ||
from_blog_id: User.primaryBlogId, | ||
to_blog_id: newMessagePress1 ? chat.friend_id : chat.friend_id, | ||
}, | ||
User, | ||
elem: chat, | ||
})); | ||
} | ||
}} | ||
> | ||
<ListItemAvatar> | ||
<Avatar src={newMessagePress1 ? chat.friend_avatar : chat.friend_avatar} style={{ margin: '5px' }} /> | ||
</ListItemAvatar> | ||
{ | ||
newMessagePress1 ? ( | ||
<Box> | ||
<p className="chat-par-name"> | ||
{chat.friend_username} | ||
</p> | ||
<p className="lastmessage"> | ||
{`${chat.friend_title}`} | ||
</p> | ||
</Box> | ||
) : ( | ||
<Box> | ||
<p className="chat-par-name"> | ||
{chat.friend_username} | ||
</p> | ||
{chat.text ? ( | ||
<p className="lastmessage"> | ||
{`${chat.blog_username}:${chat.text}`} | ||
</p> | ||
) : null} | ||
{chat.photo ? ( | ||
<p className="lastmessage"> | ||
{`${chat.blog_username}:sent a post`} | ||
</p> | ||
) : null} | ||
{chat.gif ? ( | ||
<p className="lastmessage"> | ||
{`${chat.blog_username}:sent a post`} | ||
</p> | ||
) : null} | ||
</Box> | ||
) | ||
} | ||
</ListItemButton> | ||
</div> | ||
)) | ||
); | ||
} | ||
|
||
SearchList.propTypes = { | ||
chats: PropTypes.arrayOf(Object).isRequired, | ||
}; | ||
|
||
export default SearchList; |
Oops, something went wrong.