mirror of
https://github.com/frappe/books.git
synced 2025-01-05 16:12:21 +00:00
fix: fullscreen issue
- use native trafficlights
This commit is contained in:
parent
aab4fde327
commit
0e37f0073e
17
main.ts
17
main.ts
@ -72,20 +72,21 @@ export class Main {
|
|||||||
|
|
||||||
getOptions(): BrowserWindowConstructorOptions {
|
getOptions(): BrowserWindowConstructorOptions {
|
||||||
const options: BrowserWindowConstructorOptions = {
|
const options: BrowserWindowConstructorOptions = {
|
||||||
vibrancy: 'sidebar',
|
|
||||||
transparent: this.isMac,
|
|
||||||
backgroundColor: '#80FFFFFF',
|
|
||||||
width: this.WIDTH,
|
width: this.WIDTH,
|
||||||
height: this.HEIGHT,
|
height: this.HEIGHT,
|
||||||
|
minWidth: this.WIDTH,
|
||||||
|
minHeight: this.HEIGHT,
|
||||||
title: this.title,
|
title: this.title,
|
||||||
|
titleBarStyle: 'hidden',
|
||||||
|
trafficLightPosition: { x: 16, y: 16 },
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
contextIsolation: false, // TODO: Switch this off
|
contextIsolation: false, // TODO: Switch this off
|
||||||
nodeIntegration: process.env
|
nodeIntegration: true,
|
||||||
.ELECTRON_NODE_INTEGRATION as unknown as boolean,
|
|
||||||
},
|
},
|
||||||
frame: this.isLinux,
|
frame: this.isLinux,
|
||||||
resizable: false,
|
resizable: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (this.isDevelopment || this.isLinux) {
|
if (this.isDevelopment || this.isLinux) {
|
||||||
Object.assign(options, { icon: this.icon });
|
Object.assign(options, { icon: this.icon });
|
||||||
}
|
}
|
||||||
@ -139,10 +140,6 @@ export class Main {
|
|||||||
this.mainWindow = null;
|
this.mainWindow = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.mainWindow.on('will-resize', (e) => {
|
|
||||||
e.preventDefault();
|
|
||||||
});
|
|
||||||
|
|
||||||
this.mainWindow.webContents.on('did-finish-load', () => {
|
this.mainWindow.webContents.on('did-finish-load', () => {
|
||||||
if (this.mainWindow === null) {
|
if (this.mainWindow === null) {
|
||||||
return;
|
return;
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
class="pt-6 pb-2 px-2 h-full flex justify-between flex-col bg-gray-100"
|
class="p-2 h-full flex justify-between flex-col bg-gray-100"
|
||||||
:class="{
|
:class="{
|
||||||
'window-drag': platform !== 'Windows',
|
'window-drag': platform !== 'Windows',
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<div class="window-no-drag">
|
<div class="window-no-drag">
|
||||||
<WindowControls v-if="platform === 'Mac'" class="px-3 mb-6" />
|
|
||||||
<!-- Company name and DB Switcher -->
|
<!-- Company name and DB Switcher -->
|
||||||
<div class="px-3 flex flex-row items-center justify-between mb-6">
|
<div class="px-2 flex flex-row items-center justify-between mb-6 mt-12">
|
||||||
<h6
|
<h6
|
||||||
class="
|
class="
|
||||||
text-xl
|
text-xl
|
||||||
@ -40,11 +39,11 @@
|
|||||||
<div class="mt-1 first:mt-0" v-for="group in groups" :key="group.label">
|
<div class="mt-1 first:mt-0" v-for="group in groups" :key="group.label">
|
||||||
<div
|
<div
|
||||||
class="
|
class="
|
||||||
px-3
|
px-2
|
||||||
py-2
|
py-2
|
||||||
flex
|
flex
|
||||||
items-center
|
items-center
|
||||||
rounded-lg
|
rounded-md
|
||||||
cursor-pointer
|
cursor-pointer
|
||||||
hover:bg-white
|
hover:bg-white
|
||||||
"
|
"
|
||||||
@ -109,7 +108,6 @@ import { getSidebarConfig } from 'src/utils/sidebarConfig';
|
|||||||
import { routeTo } from 'src/utils/ui';
|
import { routeTo } from 'src/utils/ui';
|
||||||
import router from '../router';
|
import router from '../router';
|
||||||
import Icon from './Icon.vue';
|
import Icon from './Icon.vue';
|
||||||
import WindowControls from './WindowControls.vue';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: [Button],
|
components: [Button],
|
||||||
@ -127,7 +125,6 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
WindowControls,
|
|
||||||
Icon,
|
Icon,
|
||||||
},
|
},
|
||||||
async mounted() {
|
async mounted() {
|
||||||
|
@ -1,76 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="flex">
|
|
||||||
<div
|
|
||||||
@click="action('close')"
|
|
||||||
class="w-3 h-3 rounded-full"
|
|
||||||
:class="getColorClasses('close')"
|
|
||||||
></div>
|
|
||||||
<div
|
|
||||||
@click="action('minimize')"
|
|
||||||
class="ml-2 w-3 h-3 rounded-full"
|
|
||||||
:class="getColorClasses('minimize')"
|
|
||||||
></div>
|
|
||||||
<div
|
|
||||||
@click="action('maximize')"
|
|
||||||
class="ml-2 w-3 h-3 rounded-full"
|
|
||||||
:class="getColorClasses('maximize')"
|
|
||||||
></div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import { runWindowAction } from 'src/utils/ipcCalls';
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: 'WindowControls',
|
|
||||||
emits: ['close', 'minimize', 'maximize', 'unmaximize'],
|
|
||||||
props: {
|
|
||||||
buttons: {
|
|
||||||
type: Array,
|
|
||||||
default: () => ['close', 'minimize', 'maximize'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
fullscreen: false,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
async action(name) {
|
|
||||||
if (!this.buttons.includes(name)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const actionRan = await runWindowAction(name);
|
|
||||||
|
|
||||||
this.setFullscreen(actionRan);
|
|
||||||
this.$emit(actionRan);
|
|
||||||
},
|
|
||||||
setFullscreen(actionRan) {
|
|
||||||
if (actionRan === 'maximize') {
|
|
||||||
this.fullscreen = true;
|
|
||||||
} else if (actionRan === 'unmaximize') {
|
|
||||||
this.fullscreen = false;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
getColorClasses(name) {
|
|
||||||
let minimize = 'bg-yellow-500 hover:bg-yellow-700';
|
|
||||||
if (this.fullscreen) {
|
|
||||||
minimize = 'bg-gray-500';
|
|
||||||
}
|
|
||||||
|
|
||||||
let classes = {
|
|
||||||
close: 'bg-red-500 hover:bg-red-700',
|
|
||||||
minimize,
|
|
||||||
maximize: 'bg-green-500 hover:bg-green-700',
|
|
||||||
}[name];
|
|
||||||
|
|
||||||
if (this.buttons.includes(name)) {
|
|
||||||
return classes;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 'bg-gray-500';
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
</script>
|
|
@ -6,7 +6,6 @@
|
|||||||
'window-drag': platform !== 'Windows',
|
'window-drag': platform !== 'Windows',
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<WindowControls v-if="platform === 'Mac'" class="absolute top-6 left-5" />
|
|
||||||
<div
|
<div
|
||||||
class="w-full w-600 shadow rounded-lg border relative"
|
class="w-full w-600 shadow rounded-lg border relative"
|
||||||
style="height: 700px"
|
style="height: 700px"
|
||||||
@ -173,7 +172,6 @@ import { DateTime } from 'luxon';
|
|||||||
import LanguageSelector from 'src/components/Controls/LanguageSelector.vue';
|
import LanguageSelector from 'src/components/Controls/LanguageSelector.vue';
|
||||||
import FeatherIcon from 'src/components/FeatherIcon.vue';
|
import FeatherIcon from 'src/components/FeatherIcon.vue';
|
||||||
import Loading from 'src/components/Loading.vue';
|
import Loading from 'src/components/Loading.vue';
|
||||||
import WindowControls from 'src/components/WindowControls.vue';
|
|
||||||
import { fyo } from 'src/initFyo';
|
import { fyo } from 'src/initFyo';
|
||||||
import { deleteDb, getSavePath } from 'src/utils/ipcCalls';
|
import { deleteDb, getSavePath } from 'src/utils/ipcCalls';
|
||||||
import { showMessageDialog } from 'src/utils/ui';
|
import { showMessageDialog } from 'src/utils/ui';
|
||||||
@ -308,7 +306,6 @@ export default {
|
|||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
LanguageSelector,
|
LanguageSelector,
|
||||||
WindowControls,
|
|
||||||
Loading,
|
Loading,
|
||||||
FeatherIcon,
|
FeatherIcon,
|
||||||
},
|
},
|
||||||
|
@ -50,7 +50,6 @@ import Icon from 'src/components/Icon.vue';
|
|||||||
import PageHeader from 'src/components/PageHeader.vue';
|
import PageHeader from 'src/components/PageHeader.vue';
|
||||||
import Row from 'src/components/Row.vue';
|
import Row from 'src/components/Row.vue';
|
||||||
import StatusBadge from 'src/components/StatusBadge.vue';
|
import StatusBadge from 'src/components/StatusBadge.vue';
|
||||||
import WindowControls from 'src/components/WindowControls.vue';
|
|
||||||
import { showToast } from 'src/utils/ui';
|
import { showToast } from 'src/utils/ui';
|
||||||
import { IPC_MESSAGES } from 'utils/messages';
|
import { IPC_MESSAGES } from 'utils/messages';
|
||||||
import { h, markRaw } from 'vue';
|
import { h, markRaw } from 'vue';
|
||||||
@ -62,7 +61,6 @@ export default {
|
|||||||
name: 'Settings',
|
name: 'Settings',
|
||||||
components: {
|
components: {
|
||||||
PageHeader,
|
PageHeader,
|
||||||
WindowControls,
|
|
||||||
StatusBadge,
|
StatusBadge,
|
||||||
Button,
|
Button,
|
||||||
Row,
|
Row,
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
<div
|
<div
|
||||||
class="py-10 flex-1 bg-white flex justify-center items-center window-drag"
|
class="py-10 flex-1 bg-white flex justify-center items-center window-drag"
|
||||||
>
|
>
|
||||||
<WindowControls v-if="platform === 'Mac'" class="absolute top-6 left-5" />
|
|
||||||
|
|
||||||
<!-- 0: Language Selection Slide -->
|
<!-- 0: Language Selection Slide -->
|
||||||
<Slide
|
<Slide
|
||||||
@ -97,7 +96,6 @@ import { ipcRenderer } from 'electron';
|
|||||||
import FormControl from 'src/components/Controls/FormControl.vue';
|
import FormControl from 'src/components/Controls/FormControl.vue';
|
||||||
import LanguageSelector from 'src/components/Controls/LanguageSelector.vue';
|
import LanguageSelector from 'src/components/Controls/LanguageSelector.vue';
|
||||||
import TwoColumnForm from 'src/components/TwoColumnForm';
|
import TwoColumnForm from 'src/components/TwoColumnForm';
|
||||||
import WindowControls from 'src/components/WindowControls.vue';
|
|
||||||
import { fyo } from 'src/initFyo';
|
import { fyo } from 'src/initFyo';
|
||||||
import { getErrorMessage } from 'src/utils';
|
import { getErrorMessage } from 'src/utils';
|
||||||
import { getSetupWizardDoc } from 'src/utils/misc';
|
import { getSetupWizardDoc } from 'src/utils/misc';
|
||||||
@ -128,7 +126,6 @@ export default {
|
|||||||
FormControl,
|
FormControl,
|
||||||
Slide,
|
Slide,
|
||||||
LanguageSelector,
|
LanguageSelector,
|
||||||
WindowControls,
|
|
||||||
},
|
},
|
||||||
async mounted() {
|
async mounted() {
|
||||||
if (fyo.config.get('language') !== undefined) {
|
if (fyo.config.get('language') !== undefined) {
|
||||||
|
Loading…
Reference in New Issue
Block a user