2
0
mirror of https://github.com/frappe/books.git synced 2024-12-23 19:39:07 +00:00

feat: add doc link (will be dyn later)

This commit is contained in:
18alantom 2022-06-17 14:20:04 +05:30
parent 9617030b8c
commit d7def35dbf
5 changed files with 37 additions and 17 deletions

View File

@ -9,8 +9,7 @@
</button> </button>
</template> </template>
<script> <script>
import { IPC_MESSAGES } from 'utils/messages'; import { openLink } from 'src/utils/ipcCalls';
import { ipcRenderer } from 'electron';
import FeatherIcon from './FeatherIcon.vue'; import FeatherIcon from './FeatherIcon.vue';
export default { export default {
@ -23,7 +22,7 @@ export default {
}, },
methods: { methods: {
openHelpLink() { openHelpLink() {
ipcRenderer.send(IPC_MESSAGES.OPEN_EXTERNAL, this.link); openLink(this.link);
}, },
}, },
components: { FeatherIcon }, components: { FeatherIcon },

View File

@ -89,11 +89,25 @@
gap-1 gap-1
items-center items-center
" "
@click="() => reportIssue()" @click="$emit('change-db-file')"
> >
<feather-icon name="flag" class="h-4 w-4" /> <feather-icon name="database" class="h-4 w-4" />
<p>{{ t`Change DB` }}</p>
</button>
<button
class="
flex
text-sm text-gray-600
hover:text-gray-800
gap-1
items-center
"
@click="openDocumentation"
>
<feather-icon name="help-circle" class="h-4 w-4" />
<p> <p>
{{ t`Report Issue` }} {{ t`Documentation` }}
</p> </p>
</button> </button>
@ -105,11 +119,14 @@
gap-1 gap-1
items-center items-center
" "
@click="$emit('change-db-file')" @click="() => reportIssue()"
> >
<feather-icon name="database" class="h-4 w-4" /> <feather-icon name="flag" class="h-4 w-4" />
<p>{{ t`Change DB` }}</p> <p>
{{ t`Report Issue` }}
</p>
</button> </button>
<p <p
v-if="fyo.store.isDevelopment" v-if="fyo.store.isDevelopment"
class="text-xs text-gray-500 select-none" class="text-xs text-gray-500 select-none"
@ -123,6 +140,7 @@
import Button from 'src/components/Button.vue'; import Button from 'src/components/Button.vue';
import { reportIssue } from 'src/errorHandling'; import { reportIssue } from 'src/errorHandling';
import { fyo } from 'src/initFyo'; import { fyo } from 'src/initFyo';
import { openLink } from 'src/utils/ipcCalls';
import { getSidebarConfig } from 'src/utils/sidebarConfig'; 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';
@ -159,6 +177,9 @@ export default {
methods: { methods: {
routeTo, routeTo,
reportIssue, reportIssue,
openDocumentation() {
openLink('https://docs.frappebooks.com/');
},
setActiveGroup() { setActiveGroup() {
const { fullPath } = this.$router.currentRoute.value; const { fullPath } = this.$router.currentRoute.value;
const fallBackGroup = this.activeGroup; const fallBackGroup = this.activeGroup;

View File

@ -70,13 +70,12 @@
</template> </template>
<script> <script>
import { ipcRenderer } from 'electron';
import Button from 'src/components/Button'; import Button from 'src/components/Button';
import Icon from 'src/components/Icon'; import Icon from 'src/components/Icon';
import PageHeader from 'src/components/PageHeader'; import PageHeader from 'src/components/PageHeader';
import { fyo } from 'src/initFyo'; import { fyo } from 'src/initFyo';
import { getGetStartedConfig } from 'src/utils/getStartedConfig'; import { getGetStartedConfig } from 'src/utils/getStartedConfig';
import { IPC_MESSAGES } from 'utils/messages'; import { openLink } from 'src/utils/ipcCalls';
import { h } from 'vue'; import { h } from 'vue';
export default { export default {
@ -102,7 +101,7 @@ export default {
methods: { methods: {
async handleDocumentation({ key, documentation }) { async handleDocumentation({ key, documentation }) {
if (documentation) { if (documentation) {
ipcRenderer.send(IPC_MESSAGES.OPEN_EXTERNAL, documentation); openLink(documentation);
} }
switch (key) { switch (key) {

View File

@ -91,15 +91,14 @@
</template> </template>
<script> <script>
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.vue'; import TwoColumnForm from 'src/components/TwoColumnForm.vue';
import { fyo } from 'src/initFyo'; import { fyo } from 'src/initFyo';
import { getErrorMessage } from 'src/utils'; import { getErrorMessage } from 'src/utils';
import { openLink } from 'src/utils/ipcCalls';
import { getSetupWizardDoc } from 'src/utils/misc'; import { getSetupWizardDoc } from 'src/utils/misc';
import { showMessageDialog } from 'src/utils/ui'; import { showMessageDialog } from 'src/utils/ui';
import { IPC_MESSAGES } from 'utils/messages';
import Slide from './Slide.vue'; import Slide from './Slide.vue';
export default { export default {
@ -141,8 +140,7 @@ export default {
return this.doc.schema?.fields.find((f) => f.fieldname === fieldname); return this.doc.schema?.fields.find((f) => f.fieldname === fieldname);
}, },
openContributingTranslations() { openContributingTranslations() {
ipcRenderer.send( openLink(
IPC_MESSAGES.OPEN_EXTERNAL,
'https://github.com/frappe/books/wiki/Contributing-Translations' 'https://github.com/frappe/books/wiki/Contributing-Translations'
); );
}, },

View File

@ -5,7 +5,6 @@ import { ipcRenderer } from 'electron';
import { t } from 'fyo'; import { t } from 'fyo';
import { IPC_ACTIONS, IPC_MESSAGES } from 'utils/messages'; import { IPC_ACTIONS, IPC_MESSAGES } from 'utils/messages';
import { setLanguageMap } from './language'; import { setLanguageMap } from './language';
import { WindowAction } from './types';
import { showToast } from './ui'; import { showToast } from './ui';
export async function checkForUpdates() { export async function checkForUpdates() {
@ -13,6 +12,10 @@ export async function checkForUpdates() {
await setLanguageMap(); await setLanguageMap();
} }
export async function openLink(link: string) {
ipcRenderer.send(IPC_MESSAGES.OPEN_EXTERNAL, link);
}
export async function deleteDb(filePath: string) { export async function deleteDb(filePath: string) {
await ipcRenderer.invoke(IPC_ACTIONS.DELETE_FILE, filePath); await ipcRenderer.invoke(IPC_ACTIONS.DELETE_FILE, filePath);
} }