Skip to content

Commit

Permalink
mrs doubtfire
Browse files Browse the repository at this point in the history
  • Loading branch information
Tzikas committed Jun 18, 2021
1 parent 09a7ef8 commit 34bf349
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 61 deletions.
8 changes: 4 additions & 4 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ DEV_ELECTRON_WEBPACK_APP_JITSI_URL=https://jitsi.local.cowbell.club:8443
#ELECTRON_WEBPACK_APP_API_URL=https://local.plshelp.live:5001
#ELECTRON_WEBPACK_APP_JITSI_URL=https://jitsi.local.plshelp.live:8443

ELECTRON_WEBPACK_APP_API_URL=https://local.cowbell.club:5001
ELECTRON_WEBPACK_APP_JITSI_URL=https://jitsi.local.cowbell.club:8443
#ELECTRON_WEBPACK_APP_API_URL=https://local.cowbell.club:5001
#ELECTRON_WEBPACK_APP_JITSI_URL=https://jitsi.local.cowbell.club:8443

#ELECTRON_WEBPACK_APP_API_URL=https://cowbell.club
#ELECTRON_WEBPACK_APP_JITSI_URL=https://jitsi.cowbell.club
ELECTRON_WEBPACK_APP_API_URL=https://cowbell.club
ELECTRON_WEBPACK_APP_JITSI_URL=https://jitsi.cowbell.club

ELECTRON_WEBPACK_APP_VAPID_PUBLICKEY=BG2QxzujwzP60oqKoT0ZxArqtcI-d1k6CWjhFrfdd2HWh7SLQDAyYjavm7cfvVrkzd_2pMRBcOuPVDpWaB_vKYk
7 changes: 3 additions & 4 deletions frontend/src/components/Chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,10 @@ function Chat(props) {


const showActiveUsers = () => {
// console.log("does this happen?", posts, channel)
for (let id in posts) {
if (id == channel._id) {
console.log(posts[id], 'our dude')
return posts[id].activeUsers.map(member => <span key={member._id}> <Image onClick={() => history.push(`/chat/${member?.postId}`)} avatar src={member?.avatar} style={{ background: 'white' }} /> <span>{member.name}</span></span>)

return posts[id].activeUsers.map(member => <span key={member?._id}> <Image onClick={() => history.push(`/chat/${member?.postId}`)} avatar src={member?.avatar} style={{ background: 'white' }} /> <span>{member?.name}</span></span>)
}
}
return (
Expand All @@ -97,7 +96,7 @@ function Chat(props) {

const showMembers = () => {
if (channel && channel?.members) {
return channel?.members.map(member => <span key={member._id}> <Image onClick={() => history.push(`/chat/${member?.postId}`)} avatar src={member?.avatar} style={{ background: 'white' }} /> <span>{member.name}</span></span>)
return channel?.members.map(member => <span key={member?._id}> <Image onClick={() => history.push(`/chat/${member?.postId}`)} avatar src={member?.avatar} style={{ background: 'white' }} /> <span>{member?.name}</span></span>)
}
}

Expand Down
4 changes: 1 addition & 3 deletions frontend/src/components/Profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,7 @@ function Profile(props) {
})

}}>Log Out</button>
{/* <button onClick={() => {
window.jitsiNodeAPI.ipc.send('set-counter', { count: 20 })
}}>Set Counter</button> */}

</Container>


Expand Down
65 changes: 23 additions & 42 deletions frontend/src/components/SideBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,21 +178,6 @@ export default function SideBar({ video }) {
const { user, activeRooms, room, gotoRoom, posts, liveUsers, setStyle, style, query, className, setClassName, showSlider, setShowSlider, open, setOpen } = useContext(TheContext)



// console.log("gottabe", posts)

// const sortedRooms = Object.values(posts)
// .filter(
// (x) =>
// ((x && x?.message.toLowerCase().includes(query.toLowerCase())) || //&& x.active && x.activeUsers.length) ||
// x?.id == 'lobby' ||
// x?.isLobby) && !x?.userChannel && !x?.dmChannel
// // (x) => (x.active && x.activeUsers.length) || x.id == 'lobby' || x.isLobby
// ).sort((a, b) => a?.active ? -1 : 1).slice(0, limit)

console.log("rerender???")


const sortedRooms = Object.values(posts)
.filter((x) => ((x && x?.message.toLowerCase().includes(query.toLowerCase()))) && !x?.userChannel && !x?.dmChannel
).sort((a, b) => a?.active ? -1 : 1).slice(0, limit)
Expand All @@ -208,37 +193,29 @@ export default function SideBar({ video }) {
}, 0)
return acc + eachCount
}, 0)
// console.log(sortedCount)


// const userChannels = []

// for (let channel of Object.values(posts)) {
// if (
// channel?.userChannel &&
// !userChannels.some(c => c?._id == channel?._id) &&
// channel?.message.toLowerCase().includes(query.toLowerCase()) &&
// channel.user?._id !== user?._id
// ) { //Unique user channels
// userChannels.push(channel)
// }
// }
const userChannels = []

for (let channel of Object.values(posts)) {
if (
channel?.userChannel &&
!userChannels.some(c => c?._id == channel?._id) &&
channel?.message.toLowerCase().includes(query.toLowerCase()) &&
channel.user?._id !== user?._id
) { //Unique user channels
console.log("with a girl", channel)
if (channel?.userChannel) { //Unique user channels
userChannels.push(channel)
// console.log(channel.message, 'lol', channel)
}
}


// let userChannelCount = userChannels.reduce((acc, rm) => {
// console.log('-=-=-', rm.message, rm, acc);
// let eachCount = rm.messageIds.reduce((acc, eachMg) => {
// console.log(eachMg)
// if (!eachMg.read.includes(user._id)) {
// return acc + 1
// } else {
// return acc + 0
// }
// }, 0)
// return acc + eachCount
// }, 0)

const dmChannels = []

for (let channel of Object.values(posts)) {
Expand Down Expand Up @@ -291,7 +268,7 @@ export default function SideBar({ video }) {
<div id="rooms" className={open === 'rooms' ? `open` : 'closed'} onClick={() => setOpen('rooms')}>
<h5 className="panelHeader">
<span className="emojis">🏡</span>
<span>Public Channels</span>
<span>Public Chats</span>
<span className="badges">
<span className="messageCount">
{sortedCount}
Expand Down Expand Up @@ -332,7 +309,7 @@ export default function SideBar({ video }) {
{dmChannels.length}
</span> */}
<span className="emojis">💬</span>
<span>Private Channels</span>
<span>Private Chats</span>

<span className="badges">
<span className="messageCount">
Expand Down Expand Up @@ -379,10 +356,14 @@ export default function SideBar({ video }) {

{/* <h5 className="panelHeader"> <span className="emojis ">🤯</span> {userChannels.length} Total Users | {liveUsers.length} Live </h5> */}
<ul className="scrollathon">

{userChannels.length > 0 ? userChannels.map((room) => <Room room={room} key={room.id} />).slice(0, limit) : <h3>No Users Found</h3>}
{/* {limit < 99 ?
< Menu.Item onClick={() => setLimit(100)}>Show More ({userChannels?.length - limit})</Menu.Item>
: null} */}


{console.log(liveUsers, ' float on', userChannels)}
{/* {liveUsers.length > 0 ? liveUsers.map((room) => <Room room={room} key={room.id} />).slice(0, limit) : <h3>No Users Found</h3>} */}


</ul>
</div>

Expand Down
5 changes: 3 additions & 2 deletions frontend/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -1665,8 +1665,9 @@ span.badges{
/* span.activeRooms{ */
span.badges span{

width: 15px;
height: 15px;
width: 17px;
height: 17px;
font-family: "MilkyNice";
color: black;

border-radius: 100%;
Expand Down
10 changes: 5 additions & 5 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,12 +275,12 @@ function createJitsiMeetWindow() {
// if (!isMounted) {
// return
// }
console.log(mainWindow, post, ' respect')
console.log(' i love u')

if (mainWindow) { //Only run if app is "closed"
return
}
console.log(app, app.getBadgeCount(), ' count????')
console.log(app.getBadgeCount(), ' count????')
app.setBadgeCount(app.getBadgeCount() + 1)
//New Room
if (post.messageIds.length === 0) {
Expand All @@ -293,14 +293,14 @@ function createJitsiMeetWindow() {
// sound: true,
// wait: true
}, (err, response, metadata) => {
console.log("callback", post._id, err, response, metadata, response.activationType, metadata.activationType)
// console.log("callback", post._id, err, response, metadata, response.activationType, metadata.activationType)
//history.push(`/chat/${post._id}`)
}
);
} else if (post && post.members) { //Not New Room
let icon = post.userChannel ? `🧐` : post.dmChannel ? `💬` : `🏡`
const last = post.messageIds[post.messageIds.length - 1]
console.log(last, 'samruai')
//console.log(last, 'samruai')

// path.join(__dirname, 'coulson.jpg')
//last.userId.avatar.replace('svg', 'png'),
Expand Down Expand Up @@ -618,7 +618,7 @@ ipcMain.on('gauth-rq', () => {


ipcMain.on('set-counter', function (count, data) {
console.log('bullwinkle', count, data, ' do i have to restart', this, mainWindow, ' lets go')
console.log('bullwinkle', data.count, ' lets go')
app.setBadgeCount(data.count)
})

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "CowBellClub",
"version": "1.3.9",
"version": "1.4.0",
"description": "Electron application for Cowbell Club",
"main": "./build/main.js",
"productName": "CowbellClub",
Expand Down

0 comments on commit 34bf349

Please sign in to comment.