Skip to content

Commit

Permalink
feat: add dev tools (#407)
Browse files Browse the repository at this point in the history
  • Loading branch information
antonreshetov committed Sep 29, 2023
1 parent 8be7ae7 commit eea5900
Show file tree
Hide file tree
Showing 42 changed files with 1,563 additions and 110 deletions.
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"axios": "^0.26.1",
"codemirror": "^5.65.7",
"codemirror-textmate": "^1.1.0",
"crypto-js": "^4.1.1",
"date-fns": "^2.28.0",
"dom-to-image": "^2.6.0",
"electron-store": "^8.0.1",
Expand All @@ -70,8 +71,11 @@
"prettier-plugin-java": "^1.6.1",
"prettier-plugin-sh": "0.8.2",
"prettier-plugin-toml": "^0.3.1",
"query-string": "^8.1.0",
"sanitize-html": "^2.7.0",
"slash": "^3.0.0",
"slugify": "^1.6.6",
"uuid": "^9.0.1",
"vercel-toast": "^1.5.5",
"vue": "^3.2.33",
"vue-router": "^4.0.14",
Expand All @@ -82,6 +86,7 @@
"@commitlint/config-conventional": "^15.0.0",
"@tsconfig/node14": "^1.0.1",
"@types/codemirror": "^5.60.5",
"@types/crypto-js": "^4.1.2",
"@types/dom-to-image": "^2.6.4",
"@types/estree": "^0.0.51",
"@types/i18next-fs-backend": "^1.1.2",
Expand All @@ -91,6 +96,7 @@
"@types/node": "^17.0.4",
"@types/prettier": "^2.6.0",
"@types/sanitize-html": "^2.6.2",
"@types/uuid": "^9.0.4",
"@types/webpack": "^5.28.0",
"@typescript-eslint/eslint-plugin": "^5.8.0",
"@typescript-eslint/parser": "^5.8.0",
Expand Down
70 changes: 69 additions & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 14 additions & 1 deletion src/main/menu/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const aboutApp = () => {
}

const appMenuCommon: Record<
'preferences' | 'quit' | 'update',
'preferences' | 'quit' | 'update' | 'devtools',
MenuItemConstructorOptions
> = {
preferences: {
Expand All @@ -41,6 +41,13 @@ MenuItemConstructorOptions
)
}
},
devtools: {
label: i18n.t('menu:devtools.label') + '...',
accelerator: 'CommandOrControl+.',
click: () => {
BrowserWindow.getFocusedWindow()?.webContents.send('main-menu:devtools')
}
},
update: {
label: i18n.t('menu:app.update.label'),
click: async () => {
Expand Down Expand Up @@ -96,6 +103,12 @@ const appMenuMac: MenuItemConstructorOptions[] = [
{
type: 'separator'
},
{
...appMenuCommon.devtools
},
{
type: 'separator'
},
{
label: i18n.t('menu:app.hide'),
role: 'hide'
Expand Down
2 changes: 1 addition & 1 deletion src/main/services/i18n/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ i18next.use(Backend).init({
fallbackLng: 'en',
lng,
debug: false,
ns: ['common', 'dialog', 'preferences', 'special', 'menu'],
ns: ['common', 'dialog', 'preferences', 'special', 'menu', 'devtools'],
defaultNS: 'common',
initImmediate: false,
preload: readdirSync(join(__dirname, './locales')).filter(fileName => {
Expand Down
7 changes: 6 additions & 1 deletion src/main/services/i18n/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@
"confirm": "Confirm",
"cancel": "Cancel",
"update": ["Go to GitHub", "OK"],
"ok": "OK"
"ok": "OK",
"clear": "Clear",
"copy": "Copy",
"sort": "Sort",
"revers": "Revers",
"generate": "Generate"
},
"newFolder": "New Folder",
"newSnippet": "New Snippet",
Expand Down
40 changes: 40 additions & 0 deletions src/main/services/i18n/locales/en/devtools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"form": {
"inputString": "Input String",
"outputString": "Output String",
"inputUrl": "Input URL",
"outputUrl": "Output URL",
"parsedUrl": "Parsed URL",
"splitQueryString": "Split Query String",
"key": "Key",
"value": "Value",
"component": "Component",
"result": "Result",
"secretKey": "Secret Key",
"algorithm": "Algorithm",
"version": "Version",
"amount": "Amount",
"type": "Type",
"length": "Length",
"options": "Options"
},
"textTools": {
"label": "Text Tools",
"caseConverter": "Case Converter",
"urlParser": "URL Parser",
"slugGenerator": "Slug Generator",
"sortLines": "Sort Lines"
},
"crypto": {
"label": "Cryptography / Security",
"hashGenerator": "Hash Generator",
"hmacGenerator": "HMAC Generator",
"passGenerator": "Password Generator",
"uuidGenerator": "UUID Generator"
},
"encodeDecode": {
"label": "Encoders / Decoders",
"url": "URL Encoder / Decoder",
"base64": "Base64 Encoder / Decoder"
}
}
3 changes: 3 additions & 0 deletions src/main/services/i18n/locales/en/menu.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,8 @@
"label": "History",
"back": "Back",
"forward": "Forward"
},
"devtools": {
"label": "Developer Tools"
}
}
7 changes: 6 additions & 1 deletion src/main/services/i18n/locales/ru/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@
"fromSnippetsLab": "Из SnippetsLab",
"confirm": "Подтвердить",
"cancel": "Отмена",
"ok": "Хорошо"
"ok": "Хорошо",
"clear": "Очистить",
"copy": "Копировать",
"sort": "Сортировать",
"revers": "Реверс",
"generate": "Генерировать"
},
"newFolder": "Новая папка",
"newSnippet": "Новый сниппет",
Expand Down
40 changes: 40 additions & 0 deletions src/main/services/i18n/locales/ru/devtools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"form": {
"inputString": "Входная строка",
"outputString": "Выходная строка",
"inputUrl": "Входной URL",
"outputUrl": "Выходной URL",
"parsedUrl": "Разобранный URL",
"splitQueryString": "Разбивка строки запроса",
"key": "Ключ",
"value": "Значение",
"component": "Компонент",
"result": "Результат",
"secretKey": "Секретный ключ",
"algorithm": "Алгоритм",
"version": "Версия",
"amount": "Количество",
"type": "Тип",
"length": "Длина",
"options": "Опции"
},
"textTools": {
"label": "Инструменты для текста",
"caseConverter": "Конвертер регистра",
"urlParser": "Парсер URL",
"slugGenerator": "Slug генератор",
"sortLines": "Сортировка строк"
},
"crypto": {
"label": "Криптография / Безопасность",
"hashGenerator": "Hash генератор",
"hmacGenerator": "HMAC генератор",
"passGenerator": "Генератор паролей",
"uuidGenerator": "UUID генератор"
},
"encodeDecode": {
"label": "Энкодеры / Декодеры",
"url": "URL Энкодер / Декодер",
"base64": "Base64 Энкодер / Декодер"
}
}
4 changes: 4 additions & 0 deletions src/renderer/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,10 @@ ipc.on('main-menu:preferences', () => {
router.push('/preferences')
})
ipc.on('main-menu:devtools', () => {
router.push('/devtools')
})
ipc.on('main-menu:new-folder', async () => {
await onAddNewFolder()
})
Expand Down

0 comments on commit eea5900

Please sign in to comment.