Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MM-60605] Fix the Download button being hidden on Windows/Linux #3148

Merged
merged 6 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 17 additions & 10 deletions src/renderer/components/MainPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,22 @@ class MainPage extends React.PureComponent<Props, State> {

const activeServer = this.state.servers.find((srv) => srv.id === this.state.activeServerId);

let titleBarSpacing;
if (window.process.platform !== 'darwin') {
if (this.state.fullScreen && window.process.platform !== 'linux') {
titleBarSpacing = (
<div
className={`button full-screen-button${this.props.darkMode ? ' darkMode' : ''}`}
onClick={this.handleExitFullScreen}
>
<i className='icon icon-arrow-collapse'/>
</div>
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In full-screen does the download button is shown with this case for Windows?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it shows correctly

} else {
titleBarSpacing = (<span style={{width: `${window.innerWidth - (window.navigator.windowControlsOverlay?.getTitlebarAreaRect().width ?? 0)}px`}}/>);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, does this mean that Linux doesn't need this special case for full screen?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At this point, no. I spent some time trying to work around it but full screen under Linux refuses to behave nicely. So i'm going to create a separate PR that removes full screen support from Linux.

}
}

const topRow = (
<Row
className={topBarClassName}
Expand Down Expand Up @@ -483,16 +499,7 @@ class MainPage extends React.PureComponent<Props, State> {
developerMode={this.state.developerMode}
/>
{downloadsDropdownButton}
{window.process.platform !== 'darwin' && this.state.fullScreen &&
<span className='title-bar-btns'>
<div
className='button full-screen-button'
onClick={this.handleExitFullScreen}
>
<i className='icon icon-arrow-collapse'/>
</div>
</span>
}
{titleBarSpacing}
</div>
</Row>
);
Expand Down
89 changes: 35 additions & 54 deletions src/renderer/css/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,6 @@ body {
color: rgba(243,243,243,0.7);
}

.topBar.darkMode .title-bar-btns {
color: rgba(243,243,243,0.7);
}

.topBar .app-title {
position: absolute;
top: 0;
Expand All @@ -139,58 +135,43 @@ body {
color: rgba(221,221,221,0.64);
}

.topBar .title-bar-btns {
position: relative;
line-height: 40px;
height: 40px;
z-index: 9;
color: rgba(61,60,64,0.7);
-webkit-app-region: no-drag;
display: grid;
grid-template-columns: repeat(3, 46px);
}

.topBar .title-bar-btns>.button {
grid-row: 1 / span 1;
.full-screen-button {
align-items: center;
background: transparent;
border-radius: 4px;
border: none;
cursor: pointer;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
user-select: none;
}

.topBar.darkMode .title-bar-btns>.button:hover {
background: rgba(255,255,255,0.1);
}

.topBar.darkMode .title-bar-btns>.button:active {
background: rgba(255,255,255,0.2);
}

.topBar .title-bar-btns>.button:hover {
background: rgba(0,0,0,0.1);
}

.topBar .title-bar-btns>.button:active {
background: rgba(0,0,0,0.2);
}

.topBar .title-bar-btns>.full-screen-button {
font-size: 18px;
}

.topBar .title-bar-btns img {
opacity: 0.7;
}

.topBar.darkMode .title-bar-btns img {
filter: invert(100%);
-webkit-filter: invert(100%);
}

.topBar .title-bar-btns>.close-button, .topBar .title-bar-btns>.full-screen-button {
grid-column: 3;
margin: 4px;
position: relative;
width: 32px;

i {
color: rgba(63, 67, 80, 0.56);
cursor: pointer;
font-size: 21px;
line-height: 21px;
}

&:hover, &:focus {
i {
color: rgba(63, 67, 80, 0.78);
}
}

&.darkMode {
i {
color: rgba(221, 223, 228, 0.56);
}

&:hover, &:focus {
i {
color: rgba(221, 223, 228, 0.78);
}
}
}
}

.topBar .overlay-gradient {
Expand Down
6 changes: 6 additions & 0 deletions src/types/window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,10 @@ declare global {
};
};
}

interface Navigator {
windowControlsOverlay?: {
getTitlebarAreaRect: () => DOMRect;
};
}
}
Loading