-
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/envVarInput
- Loading branch information
Showing
136 changed files
with
15,734 additions
and
14,646 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Tray Menu</title> | ||
<style> | ||
body { | ||
margin: 0; | ||
padding: 6px; | ||
font-size: 12.5px; | ||
font-family: Arial, sans-serif; | ||
/* background: #2b2b2b; */ | ||
color: black; | ||
} | ||
|
||
body.dark { | ||
color: white; /* Color for dark theme */ | ||
} | ||
|
||
body.light { | ||
color: black; /* Color for light theme */ | ||
} | ||
|
||
.menu-item { | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
padding: 4px 10px; | ||
} | ||
|
||
.light .menu-item.stopped { | ||
color: rgba(0, 0, 0, 0.25); | ||
} | ||
|
||
.dark .menu-item.stopped { | ||
color: rgba(255,255,255,0.25); | ||
} | ||
|
||
.menu-item:hover { | ||
border-radius: 4px; | ||
color: white; | ||
background: rgba(0, 122, 255, 0.8); | ||
} | ||
|
||
.menu-item.stopped:hover { | ||
background: none; | ||
} | ||
|
||
.dark .separator { | ||
border-bottom: 1px solid rgba(255, 255, 255, 0.1) | ||
} | ||
|
||
.light .separator { | ||
border-bottom: 1px solid rgba(0, 0, 0, 0.1); | ||
} | ||
|
||
.separator { | ||
margin: 3px 0; | ||
} | ||
|
||
.menu-status-container { | ||
display: flex; | ||
align-items: center; | ||
} | ||
|
||
.light .menu-status-container { | ||
color: rgba(0, 0, 0, 0.5); | ||
} | ||
|
||
.light .menu-item.stopped .menu-status-container { | ||
color: rgba(0, 0, 0, 0.25); | ||
} | ||
|
||
.dark .menu-status-container { | ||
color: rgba(255,255,255,0.5); | ||
} | ||
|
||
.dark .menu-item.stopped .menu-status-container { | ||
color: rgba(255,255,255,0.25); | ||
} | ||
|
||
.menu-status { | ||
text-transform: capitalize; | ||
} | ||
|
||
.menu-status-icon { | ||
display: flex; | ||
align-items: center; | ||
margin-right: 5px; | ||
} | ||
|
||
.status-icon { | ||
width: 12px; /* Adjust size as needed */ | ||
height: 12px; /* Adjust size as needed */ | ||
vertical-align: middle; /* Align icon with text */ | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div id="menu-container"></div> | ||
<script src="trayIndex.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
const { ipcRenderer } = require('electron'); | ||
|
||
const getIconKey = (status) => { | ||
switch (status) { | ||
case 'running': | ||
case 'starting': | ||
return 'syncing'; | ||
//TODO: consider camelcased strings | ||
case 'error running': | ||
case 'error starting': | ||
case 'error stopping': | ||
case 'notInstalled': | ||
case 'notRunning': | ||
case 'isOutdated': | ||
return 'error'; | ||
default: | ||
return status; | ||
} | ||
}; | ||
|
||
const getStatusText = (status) => { | ||
switch (status) { | ||
case 'notInstalled': | ||
return 'Not Installed'; | ||
case 'notRunning': | ||
return 'Not Running'; | ||
case 'isOutdated': | ||
return 'Update Now'; | ||
default: | ||
return status; | ||
} | ||
}; | ||
|
||
ipcRenderer.on( | ||
'update-menu', | ||
(event, { nodePackageTrayMenu, podmanMenuItem, statusIcons }) => { | ||
const menuItems = [ | ||
...nodePackageTrayMenu.map((item) => ({ | ||
name: item.name, | ||
status: item.status, | ||
action: () => ipcRenderer.send('node-package-click', item.id), | ||
})), | ||
...(nodePackageTrayMenu.length >= 1 ? [{ separator: true }] : []), | ||
...(podmanMenuItem.status !== 'isRunning' | ||
? [ | ||
{ | ||
name: 'Podman', | ||
status: podmanMenuItem.status, | ||
action: () => ipcRenderer.send('podman-click'), | ||
}, | ||
{ separator: true }, | ||
] | ||
: []), | ||
{ | ||
name: 'Open NiceNode', | ||
action: () => ipcRenderer.send('show-main-window'), | ||
}, | ||
{ name: 'Quit', action: () => ipcRenderer.send('quit-app') }, | ||
]; | ||
|
||
const container = document.getElementById('menu-container'); | ||
container.innerHTML = ''; // Clear existing items | ||
|
||
menuItems.forEach((item) => { | ||
if (item.separator) { | ||
const separator = document.createElement('div'); | ||
separator.className = 'separator'; | ||
container.appendChild(separator); | ||
} else { | ||
const menuItem = document.createElement('div'); | ||
menuItem.className = 'menu-item'; | ||
|
||
if (item.status === 'stopped') { | ||
menuItem.classList.add('stopped'); | ||
} | ||
|
||
const nameSpan = document.createElement('span'); | ||
nameSpan.textContent = item.name; | ||
menuItem.appendChild(nameSpan); | ||
|
||
if (item.status) { | ||
const statusContainer = document.createElement('div'); | ||
statusContainer.className = 'menu-status-container'; | ||
|
||
const statusIconContainer = document.createElement('div'); | ||
statusIconContainer.className = 'menu-status-icon'; | ||
|
||
const statusIcon = document.createElement('div'); | ||
statusIcon.innerHTML = | ||
statusIcons[getIconKey(item.status)] || statusIcons.default; | ||
statusIcon.className = 'status-icon'; | ||
|
||
const statusText = document.createElement('div'); | ||
statusText.className = 'menu-status'; | ||
statusText.textContent = getStatusText(item.status); | ||
|
||
statusIconContainer.appendChild(statusIcon); | ||
statusContainer.appendChild(statusIconContainer); | ||
statusContainer.appendChild(statusText); | ||
menuItem.appendChild(statusContainer); | ||
} | ||
|
||
menuItem.addEventListener('click', item.action); | ||
|
||
container.appendChild(menuItem); | ||
} | ||
}); | ||
ipcRenderer.send('adjust-height', document.body.scrollHeight); | ||
}, | ||
); | ||
|
||
ipcRenderer.on('set-theme', (event, theme) => { | ||
applyTheme(theme); | ||
}); | ||
|
||
// Apply theme-based styles | ||
const applyTheme = (theme) => { | ||
const body = document.body; | ||
const menuItems = document.querySelectorAll('.menu-item'); | ||
if (theme === 'dark') { | ||
body.classList.add('dark'); | ||
body.classList.remove('light'); | ||
} else { | ||
body.classList.add('light'); | ||
body.classList.remove('dark'); | ||
} | ||
}; | ||
|
||
ipcRenderer.on('update-menu', (event, updatedItems) => { | ||
// Update menu items if necessary | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.