Skip to content

Commit

Permalink
fix: renaming items name
Browse files Browse the repository at this point in the history
  • Loading branch information
ailtonloures committed Jan 11, 2025
1 parent af049b2 commit 0a1014b
Showing 1 changed file with 28 additions and 36 deletions.
64 changes: 28 additions & 36 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,7 @@ function registerAppEvents(context) {
function renderApp(context) {
const { tray, win } = context;

const dragAndDropMenuItem = {
label: 'Add by drag and drop',
type: 'normal',
click: async () => {
win.show();
win.focus();
},
};

const searchMenuItem = (label, dialogProperties) => ({
const addItemMenu = (label, dialogProperties) => ({
label,
type: 'normal',
click: async () => {
Expand All @@ -103,9 +94,7 @@ function renderApp(context) {
},
});

const separatorMenuItem = { type: 'separator' };

const bookmarkMenuItems = getBookmarks().map((bookmarkData) => ({
const bookmarkItemsMenu = getBookmarks().map((bookmarkData) => ({
label: getBasenameFromBookmarkData(bookmarkData),
submenu: [
{
Expand All @@ -126,31 +115,34 @@ function renderApp(context) {
],
}));

const openConfigMenuItem = {
label: 'Open config',
click: () => {
openIntoVsCode(store.path);
const contextMenu = createMenu([
{
label: 'Add project by drag and drop',
type: 'normal',
click: async () => {
win.show();
win.focus();
},
},
};

const exitMenuItem = {
label: 'Quit',
click: () => {
win.removeAllListeners('close');
win.close();
app.quit();
addItemMenu('Add project', ['openDirectory']),
addItemMenu('Add file', ['openFile']),
{ type: 'separator' },
...bookmarkItemsMenu,
{ type: 'separator' },
{
label: 'Settings',
click: () => {
openIntoVsCode(store.path);
},
},
{
label: 'Quit',
click: () => {
win.removeAllListeners('close');
win.close();
app.quit();
},
},
};

const contextMenu = createMenu([
dragAndDropMenuItem,
searchMenuItem('Search project', ['openDirectory']),
searchMenuItem('Search file', ['openFile']),
separatorMenuItem,
...bookmarkMenuItems,
separatorMenuItem,
openConfigMenuItem,
exitMenuItem,
]);

tray.setContextMenu(contextMenu);
Expand Down

0 comments on commit 0a1014b

Please sign in to comment.