Skip to content

Commit

Permalink
chore: change setting button position in electron app
Browse files Browse the repository at this point in the history
  • Loading branch information
lcomplete committed Mar 28, 2023
1 parent 0f24c63 commit c72e4e7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
25 changes: 15 additions & 10 deletions app/client/src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ export default function Header() {
const [fullScreen, setFullScreen] = useState(false);
const [focused, setFocused] = useState(false);
const [settingModalOpen, setSettingModalOpen] = useState(false);
const inBrowser = !window.electron;
const isMac = !inBrowser && window.electron.utilsBridge.isMac;
const inElectron = !!window.electron;
const isMac = inElectron && window.electron.utilsBridge.isMac;

useEffect(() => {
if (inBrowser) {
if (!inElectron) {
return;
}
const {utilsBridge} = window.electron;
Expand Down Expand Up @@ -51,10 +51,10 @@ export default function Header() {
const openSettingModal = useCallback(() => {
setSettingModalOpen(true);
}, []);
const closeSettingModal = useCallback(()=>{

const closeSettingModal = useCallback(() => {
setSettingModalOpen(false);
},[]);
}, []);

return <header className="title_bar">
{!isMac && (
Expand All @@ -66,14 +66,19 @@ export default function Header() {

<SearchBox/>

<IconButton className={'mr-2 absolute right-0'} onClick={openSettingModal}>
<SettingsOutlinedIcon className={'text-sky-600'}/>
</IconButton>
{
(!inElectron || isMac) && <IconButton className={'mr-2 absolute right-0'} onClick={openSettingModal}>
<SettingsOutlinedIcon className={'text-sky-600'}/>
</IconButton>
}

<SettingModal open={settingModalOpen} onClose={closeSettingModal}></SettingModal>

{!isMac && !inBrowser && (
{!isMac && inElectron && (
<div className="absolute right-0">
<IconButton className={'mr-2 nodrag'} onClick={openSettingModal}>
<SettingsOutlinedIcon className={'text-sky-600'}/>
</IconButton>
<button className="btn-size-ctrl" onClick={minimize}>
{/* <HorizontalRuleIcon fontSize="small" /> */}
<svg viewBox="0 0 11 11">
Expand Down
3 changes: 3 additions & 0 deletions app/client/src/styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ a{
.search-wrapper{
-webkit-app-region: no-drag;
}
.nodrag{
-webkit-app-region: no-drag;
}

.main_window{
margin-left: 270px;
Expand Down

0 comments on commit c72e4e7

Please sign in to comment.