Skip to content

Commit

Permalink
Merge branch 'main' into feat/envVarInput
Browse files Browse the repository at this point in the history
  • Loading branch information
jgresham authored Sep 20, 2024
2 parents ed1d1e5 + 1e8973f commit 3f3a519
Show file tree
Hide file tree
Showing 136 changed files with 15,734 additions and 14,646 deletions.
1 change: 1 addition & 0 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ jobs:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
# os: [windows-latest, ubuntu-latest]
os: [macos-latest, windows-latest, ubuntu-latest]
Expand Down
3 changes: 3 additions & 0 deletions assets/icons/tray/status/error.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions assets/icons/tray/status/stopped.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions assets/icons/tray/status/synced.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions assets/icons/tray/status/syncing.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion assets/locales/cs/genericComponents.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@
"InitialSyncInProgress": "Probíhá počáteční synchronizace...",
"NodeSettings": "Nastavení Uzlu...",
"RemoveNode": "Odstranit Uzel...",
"RemovingNode": "Odstraňování Uzlu...",
"ErrorOccurred": "Došlo k chybě",
"DataLocation": "Umístění dat",
"AvailableDiskSpace": "{{space}}GB dostupného místa na disku",
Expand Down
1 change: 1 addition & 0 deletions assets/locales/cs/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"AddNode": "Přidat Uzel",
"StopeNodeToChangeSettings": "Uzel musí být zastaven pro provedení změn",
"RemoveNode": "Odstranit uzel",
"RemovingNode": "Odstraňování Uzlu...",
"RemoveThisNode": "Odstranit tento uzel",
"Install Docker": "Nainstalovat Docker",
"Type": "Typ",
Expand Down
7 changes: 6 additions & 1 deletion assets/locales/en/genericComponents.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"AboutSecondsRemaining": "About {{seconds}} seconds remaining",
"AboutMinutesAndSecondsRemaining": "{{minutes}} minutes and {{remainingSeconds}} seconds remaining",
"CheckForUpdates": "Check for updates...",
"Confirm": "Confirm",
"FinishingUp": "Finishing up...",
Expand Down Expand Up @@ -48,7 +49,12 @@
"Syncing": "Syncing",
"CatchingUp": "Catching up...",
"InProgress": "In progress...",
"Starting": "Starting",
"Starting...": "Starting...",
"Stopped": "Stopped",
"Stopping": "Stopping",
"Stopping...": "Stopping...",
"Removing": "Removing",
"CurrentlyOffline": "Currently offline",
"PleaseReconnect": "Please reconnect to the internet",
"PodmanIsNotInstalled": "Podman is not installed",
Expand Down Expand Up @@ -109,7 +115,6 @@
"InitialSyncInProgress": "Initial sync in progress...",
"NodeSettings": "Node Settings...",
"RemoveNode": "Remove Node...",
"RemovingNode": "Removing node...",
"ErrorOccurred": "Error occurred",
"DataLocation": "Data location",
"AvailableDiskSpace": "{{space}}GB available disk space",
Expand Down
2 changes: 2 additions & 0 deletions assets/locales/en/systemRequirements.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"macOSTitle": "MacOS version is at least {{minVersion}} to run Podman 5.0",
"macOSDescription": "MacOS version: {{version}}",
"processorCoresTitle": "Processor has {{minCores}} cores or more",
"processorCoresDescription": "Processor cores: {{cores}}",
"memorySizeTitle": "At least {{minSize}}GB of system memory (RAM)",
Expand Down
16 changes: 14 additions & 2 deletions assets/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"AddNode": "Add Node",
"StopeNodeToChangeSettings": "The node must be stopped to make changes",
"RemoveNode": "Remove node",
"RemovingNode": "Removing node...",
"RemoveThisNode": "Remove this node",
"Install Docker": "Install Docker",
"Type": "Type",
Expand All @@ -17,7 +18,6 @@
"Peers": "peers",
"created": "created",
"initializing": "initializing",
"checkingForUpdates": "checking for updates",
"download": "download",
"downloading": "downloading",
"downloaded": "downloaded",
Expand Down Expand Up @@ -144,6 +144,8 @@
"loadingDotDotDot": "loading...",
"Preferences": "Preferences",
"ShowAdvancedOptions": "Show advanced options",
"ShowOtherNodeTypes": "Show other node types",
"HideOtherNodeTypes": "Hide other node types",
"SaveChanges": "Save changes",
"Continue": "Continue",
"Back": "Back",
Expand All @@ -168,5 +170,15 @@
"CalculatingDataSize": "(calculating data size...)",
"KeepNodeData": "Keep node related chain data {{data}}",
"NoResults": "No results",
"TrySearching": "Try searching for another keyword or clear all filters"
"TrySearching": "Try searching for another keyword or clear all filters",
"RunningOutdatedPodman": "You are running an outdated version of Podman",
"CurrentPodman": "Your current Podman installation ({{currentPodmanVersion}}) is incompatible with NiceNode and requires version {{requiredPodmanVersion}} or higher for it to run.",
"PodmanIsRequiredComponent": "Podman is a required component for NiceNode to run the many client options. Podman facilitates the running of containers within a virtualised Linux environment and will operate in the background.",
"DownloadAndUpdate": "Download and update",
"PodmanUpdate": "Podman update",
"CheckingForUpdates": "Checking for updates...",
"RunningLatestVersion": "You are running the latest version",
"SuccessfullyUpdated": "Successfully updated",
"Done": "Done",
"Close": "Close"
}
103 changes: 103 additions & 0 deletions assets/trayIndex.html
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>
131 changes: 131 additions & 0 deletions assets/trayIndex.js
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
});
3 changes: 3 additions & 0 deletions FUNDING.json → funding.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@
"ethereum": {
"ownedBy": "0x9cce47E9cF12C6147c9844adBB81fE85880c4df4"
}
},
"opRetro": {
"projectId": "0xf603b0a365deb7d7130d5c6ebd2ca4f8b7661aae8dcbee822d0ff4187dbcfc76"
}
}
Loading

0 comments on commit 3f3a519

Please sign in to comment.