Skip to content

Commit b1d96c6

Browse files
committed
refactor: fixed dictionary module
1 parent 4414711 commit b1d96c6

File tree

4 files changed

+65
-66
lines changed

4 files changed

+65
-66
lines changed

src/app/app.module.ts

+2
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ import { NgxElectronModule } from 'ngx-electron';
88
import { SharedModule } from '@modules/shared/shared.module';
99
import { HomeComponent } from './modules/translation';
1010
import { SettingsModule } from './modules/settings/settings.module';
11+
import { DictionaryModule } from './modules/dictionary/dictionary.module';
1112

1213
@NgModule({
1314
imports: [
1415
AppRoutingModule,
1516
BrowserModule,
1617
ClickOutsideModule,
18+
DictionaryModule,
1719
FormsModule,
1820
HttpClientModule,
1921
NgxElectronModule,

src/app/modules/dictionary/dictionary.module.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import { NgModule } from '@angular/core';
22
import { DictionaryComponent } from '.';
33
import { SharedModule } from '../shared/shared.module';
4+
import { DictionaryRoutes } from './dictionary.routing';
45

56
@NgModule({
67
imports: [
8+
DictionaryRoutes,
79
SharedModule
810
],
911
declarations: [

src/app/modules/dictionary/dictionary.routing.ts

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { Routes, RouterModule } from '@angular/router';
22
import { DictionaryComponent } from '.';
33

44
const routes: Routes = [
5-
,
65
{
76
path: 'dictionary',
87
component: DictionaryComponent

src/electron/main.js

+61-65
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@ const mb = menubar({
4949

5050
mb.on('ready', () => {
5151

52-
mb.window.setIcon(path.join(__dirname, '../assets/icon.png'));
5352

5453
if (process.env.NODE_ENV === 'dev')
5554
mb.window.openDevTools();
5655

5756
if (process.platform === 'linux') {
57+
mb.window.setIcon(path.join(__dirname, '../assets/icon.png'));
5858
mb.tray.setToolTip('Translate');
5959
mb.window.setResizable(false); // workaround for linux
6060
}
@@ -63,42 +63,42 @@ mb.on('ready', () => {
6363
const template = [{
6464
label: "Menu",
6565
submenu: [{
66-
label: "Hide",
67-
accelerator: "Esc",
68-
click: () => mb.window.hide()
69-
},
70-
{
71-
label: "Cut",
72-
accelerator: "CmdOrCtrl+X",
73-
role: "cut"
74-
},
75-
{
76-
label: "Copy",
77-
accelerator: "CmdOrCtrl+C",
78-
role: "copy"
79-
},
80-
{
81-
label: "Paste",
82-
accelerator: "CmdOrCtrl+V",
83-
role: "paste"
84-
},
85-
{
86-
label: "Select All",
87-
accelerator: "CmdOrCtrl+A",
88-
role: "selectall"
89-
},
90-
{
91-
label: 'Toggle Developer Tools',
92-
accelerator: process.platform === 'darwin' ? 'Alt+Command+I' : 'Ctrl+Shift+I',
93-
click(item, focusedWindow) {
94-
if (focusedWindow) focusedWindow.webContents.toggleDevTools()
66+
label: "Hide",
67+
accelerator: "Esc",
68+
click: () => mb.window.hide()
69+
},
70+
{
71+
label: "Cut",
72+
accelerator: "CmdOrCtrl+X",
73+
role: "cut"
74+
},
75+
{
76+
label: "Copy",
77+
accelerator: "CmdOrCtrl+C",
78+
role: "copy"
79+
},
80+
{
81+
label: "Paste",
82+
accelerator: "CmdOrCtrl+V",
83+
role: "paste"
84+
},
85+
{
86+
label: "Select All",
87+
accelerator: "CmdOrCtrl+A",
88+
role: "selectall"
89+
},
90+
{
91+
label: 'Toggle Developer Tools',
92+
accelerator: process.platform === 'darwin' ? 'Alt+Command+I' : 'Ctrl+Shift+I',
93+
click(item, focusedWindow) {
94+
if (focusedWindow) focusedWindow.webContents.toggleDevTools()
95+
}
96+
},
97+
{
98+
label: "Quit",
99+
accelerator: "Command+Q",
100+
click: () => app.quit()
95101
}
96-
},
97-
{
98-
label: "Quit",
99-
accelerator: "Command+Q",
100-
click: () => app.quit()
101-
}
102102
]
103103
}];
104104

@@ -142,36 +142,32 @@ mb.on('ready', () => {
142142
*/
143143
mb.on('after-create-window', function () {
144144
const contextMenu = Menu.buildFromTemplate([{
145-
label: 'About Oversetter',
146-
click: () => aboutWindow.showWindow()
147-
},
148-
{
149-
label: 'Open dictionary',
150-
click: () => dictionary.showWindow()
151-
},
152-
{
153-
label: 'Preferences',
154-
click: () => {
155-
mb.window.webContents.send('show-settings');
156-
showApp();
157-
}
158-
},
159-
{
160-
label: 'Restart App',
161-
click: () => {
162-
mb.app.quit();
163-
mb.app.relaunch();
164-
}
165-
}, // TODO: add check for updates option
166-
{
167-
type: 'separator'
168-
},
169-
{
170-
label: 'Quit',
171-
click: () => {
172-
mb.app.quit();
145+
label: 'Open dictionary',
146+
click: () => dictionary.showWindow()
147+
},
148+
{
149+
label: 'Preferences',
150+
click: () => {
151+
mb.window.webContents.send('show-settings');
152+
showApp();
153+
}
154+
},
155+
{
156+
label: 'Restart App',
157+
click: () => {
158+
mb.app.quit();
159+
mb.app.relaunch();
160+
}
161+
}, // TODO: add check for updates option
162+
{
163+
type: 'separator'
164+
},
165+
{
166+
label: 'Quit',
167+
click: () => {
168+
mb.app.quit();
169+
}
173170
}
174-
}
175171
]);
176172
mb.tray.on('right-click', () => {
177173
mb.tray.popUpContextMenu(contextMenu);

0 commit comments

Comments
 (0)