chore: fix vue prettier rules (max-attributes-per-line), reformat all codes
This commit is contained in:
1 parent
f225b4e54a
commit
2fb64f03ec
17 files changed
+227
-90
No files matched your search
+21
-15
@@ -12,23 +12,29 @@ export default class IPCs {
|
||||
})
|
||||
|
||||
// Open url via web browser
|
||||
ipcMain.on('msgOpenExternalLink', async (event: IpcMainEvent, url: string) => {
|
||||
await shell.openExternal(url)
|
||||
})
|
||||
ipcMain.on(
|
||||
'msgOpenExternalLink',
|
||||
async (event: IpcMainEvent, url: string) => {
|
||||
await shell.openExternal(url)
|
||||
}
|
||||
)
|
||||
|
||||
// Open file
|
||||
ipcMain.handle('msgOpenFile', async (event: IpcMainEvent, filter: string) => {
|
||||
const filters = []
|
||||
if (filter === 'text') {
|
||||
filters.push({ name: 'Text', extensions: ['txt', 'json'] })
|
||||
} else if (filter === 'zip') {
|
||||
filters.push({ name: 'Zip', extensions: ['zip'] })
|
||||
ipcMain.handle(
|
||||
'msgOpenFile',
|
||||
async (event: IpcMainEvent, filter: string) => {
|
||||
const filters = []
|
||||
if (filter === 'text') {
|
||||
filters.push({ name: 'Text', extensions: ['txt', 'json'] })
|
||||
} else if (filter === 'zip') {
|
||||
filters.push({ name: 'Zip', extensions: ['zip'] })
|
||||
}
|
||||
const dialogResult = await dialog.showOpenDialog({
|
||||
properties: ['openFile'],
|
||||
filters
|
||||
})
|
||||
return dialogResult
|
||||
}
|
||||
const dialogResult = await dialog.showOpenDialog({
|
||||
properties: ['openFile'],
|
||||
filters
|
||||
})
|
||||
return dialogResult
|
||||
})
|
||||
)
|
||||
}
|
||||
}
|
||||
+5
-1
@@ -38,7 +38,11 @@ app.on('window-all-closed', () => {
|
||||
|
||||
app.on(
|
||||
'render-process-gone',
|
||||
(event: Event, webContents: WebContents, details: RenderProcessGoneDetails) => {
|
||||
(
|
||||
event: Event,
|
||||
webContents: WebContents,
|
||||
details: RenderProcessGoneDetails
|
||||
) => {
|
||||
errorWindow = createErrorWindow(errorWindow, mainWindow, details)
|
||||
}
|
||||
)
|
||||
|
||||
+3
-1
@@ -97,7 +97,9 @@ function calculateWindowPosition(b) {
|
||||
const screenBounds = screen.getPrimaryDisplay().size
|
||||
const trayBounds = tray.getBounds()
|
||||
const bottom = trayBounds.y > screenBounds.height / 2
|
||||
const x = Math.floor(trayBounds.x - b.width / 2 - margin.x + trayBounds.width / 2)
|
||||
const x = Math.floor(
|
||||
trayBounds.x - b.width / 2 - margin.x + trayBounds.width / 2
|
||||
)
|
||||
const y = bottom
|
||||
? Math.floor(trayBounds.y - b.height - margin.y + trayBounds.height / 2)
|
||||
: Math.floor(trayBounds.y + margin.y + trayBounds.height / 2)
|
||||
|
||||
+17
-4
@@ -1,7 +1,11 @@
|
||||
import { contextBridge, ipcRenderer, IpcRendererEvent } from 'electron'
|
||||
|
||||
// Whitelist of valid channels used for IPC communication (Send message from Renderer to Main)
|
||||
const mainAvailChannels: string[] = ['msgRequestGetVersion', 'msgOpenExternalLink', 'msgOpenFile']
|
||||
const mainAvailChannels: string[] = [
|
||||
'msgRequestGetVersion',
|
||||
'msgOpenExternalLink',
|
||||
'msgOpenFile'
|
||||
]
|
||||
const rendererAvailChannels: string[] = []
|
||||
|
||||
contextBridge.exposeInMainWorld('mainApi', {
|
||||
@@ -15,21 +19,30 @@ contextBridge.exposeInMainWorld('mainApi', {
|
||||
throw new Error(`Unknown ipc channel name: ${channel}`)
|
||||
}
|
||||
},
|
||||
on: (channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void): void => {
|
||||
on: (
|
||||
channel: string,
|
||||
listener: (event: IpcRendererEvent, ...args: any[]) => void
|
||||
): void => {
|
||||
if (rendererAvailChannels.includes(channel)) {
|
||||
ipcRenderer.on(channel, listener)
|
||||
} else {
|
||||
throw new Error(`Unknown ipc channel name: ${channel}`)
|
||||
}
|
||||
},
|
||||
once: (channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void): void => {
|
||||
once: (
|
||||
channel: string,
|
||||
listener: (event: IpcRendererEvent, ...args: any[]) => void
|
||||
): void => {
|
||||
if (rendererAvailChannels.includes(channel)) {
|
||||
ipcRenderer.once(channel, listener)
|
||||
} else {
|
||||
throw new Error(`Unknown ipc channel name: ${channel}`)
|
||||
}
|
||||
},
|
||||
off: (channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void): void => {
|
||||
off: (
|
||||
channel: string,
|
||||
listener: (event: IpcRendererEvent, ...args: any[]) => void
|
||||
): void => {
|
||||
if (rendererAvailChannels.includes(channel)) {
|
||||
ipcRenderer.off(channel, listener)
|
||||
} else {
|
||||
|
||||
@@ -18,7 +18,10 @@ const isCurrentRoute = (path: string): boolean => {
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<v-app-bar color="primary" density="compact">
|
||||
<v-app-bar
|
||||
color="primary"
|
||||
density="compact"
|
||||
>
|
||||
<v-app-bar-title>{{ t(titleKey) }}</v-app-bar-title>
|
||||
<template #append>
|
||||
<v-btn
|
||||
|
||||
@@ -6,5 +6,8 @@
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
</body>
|
||||
<script type="module" src="./main"></script>
|
||||
<script
|
||||
type="module"
|
||||
src="./main"
|
||||
></script>
|
||||
</html>
|
||||
@@ -1,5 +1,17 @@
|
||||
import { createVuetify } from 'vuetify'
|
||||
import { ko, en, zhHans, zhHant, de, es, ja, fr, ru, pt, nl } from 'vuetify/locale'
|
||||
import {
|
||||
ko,
|
||||
en,
|
||||
zhHans,
|
||||
zhHant,
|
||||
de,
|
||||
es,
|
||||
ja,
|
||||
fr,
|
||||
ru,
|
||||
pt,
|
||||
nl
|
||||
} from 'vuetify/locale'
|
||||
import { aliases, mdi } from 'vuetify/iconsets/mdi-svg'
|
||||
import 'vuetify/styles'
|
||||
|
||||
|
||||
@@ -4,7 +4,13 @@ import { useTheme } from 'vuetify'
|
||||
import { openExternal, openFile } from '@/renderer/utils'
|
||||
import { useCounterStore } from '@/renderer/store/counter'
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { mdiBrightness6, mdiFileDocument, mdiFolderOpen, mdiGithub, mdiPlusCircle } from '@mdi/js'
|
||||
import {
|
||||
mdiBrightness6,
|
||||
mdiFileDocument,
|
||||
mdiFolderOpen,
|
||||
mdiGithub,
|
||||
mdiPlusCircle
|
||||
} from '@mdi/js'
|
||||
import { storeToRefs } from 'pinia'
|
||||
|
||||
const { t, locale, availableLocales } = useI18n()
|
||||
@@ -58,9 +64,15 @@ const handleOpenFile = async () => {
|
||||
|
||||
<template>
|
||||
<v-container>
|
||||
<v-row no-gutters class="text-center align-center">
|
||||
<v-col cols="12" md="5">
|
||||
<img
|
||||
<v-row
|
||||
no-gutters
|
||||
class="text-center align-center"
|
||||
>
|
||||
<v-col
|
||||
cols="12"
|
||||
md="5"
|
||||
>
|
||||
<v-img
|
||||
data-testid="main-logo"
|
||||
alt="logo"
|
||||
draggable="false"
|
||||
@@ -68,56 +80,103 @@ const handleOpenFile = async () => {
|
||||
src="/images/vutron-logo.webp"
|
||||
/>
|
||||
</v-col>
|
||||
<v-col cols="12" md="7">
|
||||
<h2 class="my-4">{{ t('desc.welcome-title') }}</h2>
|
||||
<v-col
|
||||
cols="12"
|
||||
md="7"
|
||||
>
|
||||
<h2 class="my-4">
|
||||
{{ t('desc.welcome-title') }}
|
||||
</h2>
|
||||
<p>{{ t('desc.welcome-desc') }}</p>
|
||||
<p class="my-4">
|
||||
App Version: <strong>{{ appVersion }}</strong>
|
||||
</p>
|
||||
<p v-if="selectedFile">{{
|
||||
t('desc.selected-file', {
|
||||
filePath: selectedFile
|
||||
})
|
||||
}}</p>
|
||||
<p v-if="selectedFile">
|
||||
{{
|
||||
t('desc.selected-file', {
|
||||
filePath: selectedFile
|
||||
})
|
||||
}}
|
||||
</p>
|
||||
<v-row class="my-4">
|
||||
<v-col>
|
||||
<v-btn icon color="primary" @click="handleChangeTheme">
|
||||
<v-btn
|
||||
icon
|
||||
color="primary"
|
||||
@click="handleChangeTheme"
|
||||
>
|
||||
<v-icon :icon="mdiBrightness6" />
|
||||
<v-tooltip activator="parent" location="bottom">
|
||||
<v-tooltip
|
||||
activator="parent"
|
||||
location="bottom"
|
||||
>
|
||||
{{ t('menu.change-theme') }}
|
||||
</v-tooltip>
|
||||
</v-btn>
|
||||
</v-col>
|
||||
<v-col>
|
||||
<v-badge data-testid="counter-badge" color="blue" :content="count">
|
||||
<v-btn data-testid="btn-counter" icon color="primary" @click="handleCountIncrease">
|
||||
<v-badge
|
||||
data-testid="counter-badge"
|
||||
color="blue"
|
||||
:content="count"
|
||||
>
|
||||
<v-btn
|
||||
data-testid="btn-counter"
|
||||
icon
|
||||
color="primary"
|
||||
@click="handleCountIncrease"
|
||||
>
|
||||
<v-icon :icon="mdiPlusCircle" />
|
||||
<v-tooltip activator="parent" location="bottom">
|
||||
<v-tooltip
|
||||
activator="parent"
|
||||
location="bottom"
|
||||
>
|
||||
{{ t('menu.increase-count') }}
|
||||
</v-tooltip>
|
||||
</v-btn>
|
||||
</v-badge>
|
||||
</v-col>
|
||||
<v-col>
|
||||
<v-btn icon color="primary" @click="handleOpenDocument">
|
||||
<v-btn
|
||||
icon
|
||||
color="primary"
|
||||
@click="handleOpenDocument"
|
||||
>
|
||||
<v-icon :icon="mdiFileDocument" />
|
||||
<v-tooltip activator="parent" location="bottom">
|
||||
<v-tooltip
|
||||
activator="parent"
|
||||
location="bottom"
|
||||
>
|
||||
{{ t('menu.documentation') }}
|
||||
</v-tooltip>
|
||||
</v-btn>
|
||||
</v-col>
|
||||
<v-col>
|
||||
<v-btn icon color="primary" @click="handleOpenGitHub">
|
||||
<v-btn
|
||||
icon
|
||||
color="primary"
|
||||
@click="handleOpenGitHub"
|
||||
>
|
||||
<v-icon :icon="mdiGithub" />
|
||||
<v-tooltip activator="parent" location="bottom">
|
||||
<v-tooltip
|
||||
activator="parent"
|
||||
location="bottom"
|
||||
>
|
||||
{{ t('menu.github') }}
|
||||
</v-tooltip>
|
||||
</v-btn>
|
||||
</v-col>
|
||||
<v-col>
|
||||
<v-btn icon color="primary" @click="handleOpenFile">
|
||||
<v-btn
|
||||
icon
|
||||
color="primary"
|
||||
@click="handleOpenFile"
|
||||
>
|
||||
<v-icon :icon="mdiFolderOpen" />
|
||||
<v-tooltip activator="parent" location="bottom">
|
||||
<v-tooltip
|
||||
activator="parent"
|
||||
location="bottom"
|
||||
>
|
||||
{{ t('menu.open-file') }}
|
||||
</v-tooltip>
|
||||
</v-btn>
|
||||
|
||||
@@ -7,11 +7,23 @@ const { t } = useI18n()
|
||||
|
||||
<template>
|
||||
<v-container>
|
||||
<v-row no-gutters class="text-center">
|
||||
<v-row
|
||||
no-gutters
|
||||
class="text-center"
|
||||
>
|
||||
<v-col cols="12">
|
||||
<v-icon :icon="mdiEmoticonCoolOutline" size="250" color="#009f57" />
|
||||
<v-icon
|
||||
:icon="mdiEmoticonCoolOutline"
|
||||
size="250"
|
||||
color="#009f57"
|
||||
/>
|
||||
</v-col>
|
||||
<v-col
|
||||
cols="12"
|
||||
class="my-4"
|
||||
>
|
||||
{{ t('desc.second-desc') }}
|
||||
</v-col>
|
||||
<v-col cols="12" class="my-4">{{ t('desc.second-desc') }}</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</template>
|
||||
Reference in new issue
Block a user