Skip to content

Commit

Permalink
minimize maxomize
Browse files Browse the repository at this point in the history
  • Loading branch information
Tzikas committed Jul 20, 2021
1 parent 821bb63 commit c3b703f
Show file tree
Hide file tree
Showing 5 changed files with 192 additions and 27 deletions.
72 changes: 69 additions & 3 deletions frontend/src/CowBell.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,12 @@ import io from 'socket.io-client'
//Make connection to server just once on page load.
import baseURL from './api/config'

const remote = require('electron').remote;


const win = remote.getCurrentWindow();
console.log(remote, win)



// TODO: Convert this into a reusable useSocket or something
Expand Down Expand Up @@ -209,8 +213,9 @@ const CowBell = ({ children }) => {
return
}

// console.log('post:', post, ' kiwi')

console.log('post:', post, ' kiwi')
const [yourBrowserWindow] = remote.BrowserWindow.getAllWindows();
console.log(yourBrowserWindow.isFocused(), ' in focused');

_setPosts(function (posts) {
let newPosts = { ...posts }
Expand All @@ -232,7 +237,11 @@ const CowBell = ({ children }) => {
// console.log(pathname, last?.postId, 'pathname', pathname.split('/')[2], pathname.split('/')[2] === last?.postId, window.location)

//You're in that chat room so don't notify
if (window.location.hash.split('/').pop() === last?.postId) {



if (window.location.hash.split('/').pop() === last?.postId && yourBrowserWindow.isFocused()) {
console.log('YOURE IN THE CHAT ROOM')
return
}
// console.log(post.event, 'event')
Expand Down Expand Up @@ -554,6 +563,63 @@ const CowBell = ({ children }) => {

return user ? (
<TheContext.Provider value={context}>
<header id="titlebar">

<div className="buttons">
<div className="close">
<a onClick={() => {
console.log(process.platform)
process.platform === "darwin" ? win.hide() : win.minimize()
}} className="closebutton" href="#"><span><strong>x</strong></span></a>

</div>
<div className="minimize">
<a onClick={() => {
win.minimize()
}} className="minimizebutton" href="#"><span><strong>&ndash;</strong></span></a>

</div>
<div className="zoom">
<a onClick={() => {
console.log(win.fullScreen)
win.setFullScreen(!win.fullScreen)
}} className="zoombutton" href="#"><span><strong>+</strong></span></a>

</div>
</div>


{/*
<button onClick={() => {
console.log(win);
// win.setPosition(0, 0, true)
win.hide()
}}>
Hidee </button>
<button onClick={() => {
console.log(win);
// win.setPosition(0, 0, true)
win.minimize()
}}>
Minimize </button>
<button onClick={() => {
console.log(win);
// win.setPosition(0, 0, true)
win.setFullScreen(true);
}}>
Max </button>
<button onClick={() => {
console.log(win);
// win.setPosition(0, 0, true)
win.setFullScreen(false);
}}>
Back </button> */}
</header>
<SideBar isInRoomRoute={isInRoomRoute} littleVideo={littleVideo} video={!isInRoomRoute && video} />
<div style={style.container} className="container">
<NavBar history={history} user={user} />
Expand Down
23 changes: 2 additions & 21 deletions frontend/src/components/NavBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,8 @@ import Search from './Search'
import TheContext from '../TheContext'
import SideBar from './SideBar'
import { version } from '../../../package.json'
console.log(version, ' version number: ');
const remote = require('electron').remote;
console.log(version, ' version number: ', process);


const win = remote.getCurrentWindow();
console.log(remote, win)
// sound.play(path.join(__dirname, "resources/cowbell.wav"))


Expand Down Expand Up @@ -51,22 +47,7 @@ export function NavBar({ user }) {
// console.log('chat room ==> ', pathname.split('/').pop() === lobby_id ? 'lobby' : pathname)

return (<>
<header id="titlebar">
<button onClick={() => {
console.log(win);
// win.setPosition(0, 0, true)
win.hide()
}}>
Hidee </button>


<button onClick={() => {
console.log(win);
// win.setPosition(0, 0, true)
win.minimize()
}}>
Minimize </button>
</header>

<nav className="top-nav">


Expand Down
120 changes: 119 additions & 1 deletion frontend/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -1745,6 +1745,7 @@ i.icon{
}
.ui.inverted.vertical.labeled.icon.ui.overlay.left.visible.sidebar.style-3.menu{
overflow-x:hidden;
top: 28px;
}

.scrollathon{
Expand All @@ -1761,7 +1762,7 @@ i.icon{

.open {

height:calc(100vh - 195px) !important;
height:calc(100vh - 225px) !important;

}

Expand Down Expand Up @@ -2028,4 +2029,121 @@ ul.showPosts {
display: block;
display: inline;
height: 200px;
}



header#titlebar{
display:flex;
background: #171717;
position: fixed;
width: 100%;
}


.button a:hover{
}

.button a {
color:black;
}
.button a strong{
color:black;
}
.buttons a{
outline:none;
}
.buttons {
display: flex;
width: 8rem;
justify-content: space-evenly;
align-items: center;
padding: .5rem .1rem;
}

.buttons:hover a {
visibility: visible;
}

.close {
background: #ff5c5c;
border: 1px solid #e33e41;
border-radius: 50%;
line-height: 11px;

display: inline-block;
}

.close:active {
background: #c14645;
border: 1px solid #b03537;
}

.close:active .closebutton {
color: #4e0002;
}

.closebutton {
color: #820005;
visibility: hidden;
cursor: default;
}

.minimize {
background: #ffbd4c;

line-height: 11px;

border: 1px solid #e09e3e;
border-radius: 50%;
display: inline-block;
}

.minimize:active {
background: #c08e38;
border: 1px solid #af7c33;
}

.minimize:active .minimizebutton {
color: #5a2607;
}

.minimizebutton {
color: #9a5518;
visibility: hidden;
cursor: default;
}

.zoom {
background: #00ca56;

line-height: 11px;

border: 1px solid #14ae46;
border-radius: 50%;
display: inline-block;
}

.zoom:active {
background: #029740;
border: 1px solid #128435;
}

.zoom:active .zoombutton {
color: #003107;
}

.zoombutton {
color: #006519;
visibility: hidden;
cursor: default;
}

.minimize, .close, .zoom {
display: flex;
justify-content: center;
align-items: flex-start;
width: 14px;
height: 14px;
font-size: 9pt;
}
2 changes: 1 addition & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ function createJitsiMeetWindow() {
webSecurity: true,
preload: path.resolve(basePath, './build/preload.js')
},
// frame: false
frame: false
};

mainWindow = new BrowserWindow(options);
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.8.1",
"version": "1.8.2",
"description": "Electron application for Cowbell Club",
"main": "./build/main.js",
"productName": "CowbellClub",
Expand Down

0 comments on commit c3b703f

Please sign in to comment.