2
0
mirror of https://github.com/frappe/books.git synced 2024-09-19 19:19:02 +00:00

fix: period selector issue, version issue

This commit is contained in:
18alantom 2022-04-01 18:58:21 +05:30
parent 98bcbf20f9
commit 1c8a70819e
5 changed files with 26 additions and 17 deletions

View File

@ -144,7 +144,6 @@ export class Main {
}
this.mainWindow.webContents.send(IPC_CHANNELS.STORE_ON_WINDOW, {
appVersion: app.getVersion(),
isDevelopment: this.isDevelopment,
});
});

View File

@ -1,4 +1,4 @@
import { dialog, ipcMain } from 'electron';
import { app, dialog, ipcMain } from 'electron';
import { autoUpdater } from 'electron-updater';
import fs from 'fs/promises';
import path from 'path';
@ -112,4 +112,8 @@ export default function registerIpcMainActionListeners(main: Main) {
ipcMain.handle(IPC_ACTIONS.GET_CREDS, async (event) => {
return await getUrlAndTokenString();
});
ipcMain.handle(IPC_ACTIONS.GET_VERSION, (_) => {
return app.getVersion();
});
}

View File

@ -5,6 +5,7 @@ import App from './App';
import FeatherIcon from './components/FeatherIcon';
import config, { ConfigKeys } from './config';
import { getErrorHandled, handleError } from './errorHandling';
import { IPC_ACTIONS } from './messages';
import { incrementOpenCount } from './renderer/helpers';
import registerIpcRendererListeners from './renderer/registerIpcRendererListeners';
import router from './router';
@ -88,6 +89,7 @@ import { setLanguageMap, stringifyCircular } from './utils';
console.error(err, vm, info);
};
frappe.store.appVersion = await ipcRenderer.invoke(IPC_ACTIONS.GET_VERSION);
incrementOpenCount();
app.mount('body');

View File

@ -27,6 +27,7 @@ export const IPC_ACTIONS = {
CHECK_FOR_UPDATES: 'check-for-updates',
GET_FILE: 'get-file',
GET_CREDS: 'get-creds',
GET_VERSION: 'get-version',
};
// ipcMain.send(...)

View File

@ -1,11 +1,3 @@
<script setup>
const periodSelectorMap = {
'This Year': t`This Year`,
'This Quarter': t`This Quarter`,
'This Month': t`This Month`,
};
</script>
<template>
<Dropdown ref="dropdown" class="text-sm" :items="periodOptions" right>
<template
@ -36,7 +28,7 @@ const periodSelectorMap = {
@keydown.up="highlightItemUp"
@keydown.enter="selectHighlightedItem"
>
{{ periodSelectorMap[value] }}
{{ periodSelectorMap?.[value] ?? value }}
<feather-icon name="chevron-down" class="ml-1 w-3 h-3" />
</div>
</template>
@ -60,18 +52,29 @@ export default {
components: {
Dropdown,
},
mounted() {
this.periodSelectorMap = {
'This Year': t`This Year`,
'This Quarter': t`This Quarter`,
'This Month': t`This Month`,
};
this.periodOptions = this.options.map((option) => {
return {
label: this.periodSelectorMap[option] ?? option,
action: () => this.selectOption(option),
};
});
},
data() {
return {
periodOptions: this.options.map((option) => {
return {
label: this.periodSelectorMap[option],
action: () => this.selectOption(option),
};
}),
periodSelectorMap: {},
periodOptions: [],
};
},
methods: {
selectOption(value) {
console.log(value);
this.$emit('change', value);
this.$refs.dropdown.toggleDropdown(false);
},