Skip to content

Commit

Permalink
modified five console.logs
Browse files Browse the repository at this point in the history
  • Loading branch information
nadeenay committed Dec 31, 2021
1 parent fdf7142 commit bafb6c5
Show file tree
Hide file tree
Showing 110 changed files with 9,610 additions and 1 deletion.
6 changes: 6 additions & 0 deletions tumblr-replica/.history/src/apis/globalAPI_20211230231839.js
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';
6 changes: 6 additions & 0 deletions tumblr-replica/.history/src/apis/globalAPI_20211230231842.js
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';
6 changes: 6 additions & 0 deletions tumblr-replica/.history/src/apis/globalAPI_20211231101249.js
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';
6 changes: 6 additions & 0 deletions tumblr-replica/.history/src/apis/globalAPI_20211231101252.js
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';
6 changes: 6 additions & 0 deletions tumblr-replica/.history/src/apis/globalAPI_20211231101253.js
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';
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;
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;
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;
Loading

0 comments on commit bafb6c5

Please sign in to comment.