Skip to content

Commit

Permalink
Merge branch 'main' into l10n_main
Browse files Browse the repository at this point in the history
  • Loading branch information
jgresham authored Aug 1, 2024
2 parents 74f3eab + 01415f1 commit b40e36d
Show file tree
Hide file tree
Showing 55 changed files with 1,025 additions and 382 deletions.
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
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"
}
}
12 changes: 6 additions & 6 deletions package-lock.json

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

12 changes: 9 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nice-node",
"version": "6.1.4-alpha",
"version": "6.3.0-alpha",
"description": "Run a node at home, the easy way.",
"homepage": "https://nicenode.xyz",
"productName": "NiceNode",
Expand Down Expand Up @@ -65,7 +65,7 @@
"@wdio/mocha-framework": "^8.36.1",
"@wdio/spec-reporter": "^8.36.1",
"cross-env": "^7.0.3",
"electron": "^30.0.1",
"electron": "^31.3.1",
"electron-devtools-installer": "^3.2.0",
"electron-extension-installer": "^1.2.0",
"electron-mock-ipc": "^0.3.12",
Expand Down Expand Up @@ -125,7 +125,13 @@
"url": "http://nicenode.xyz"
},
"license": "MIT",
"keywords": ["ethereum", "node", "blockchain", "web3", "local"],
"keywords": [
"ethereum",
"node",
"blockchain",
"web3",
"local"
],
"devEngines": {
"node": ">=20.x",
"npm": ">=9.x"
Expand Down
2 changes: 1 addition & 1 deletion src/common/NodeSpecs/base/base-v1.0.0.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
"documentation": "https://docs.base.org/network-information/"
}
},
"iconUrl": "https://ethereum.png",
"iconUrl": "https://pub-9f2dc808c3d748eabde036c3d3465ee6.r2.dev/base.png",
"addNodeDescription": "Decentralization and collaboration are critical for the longer-term success of Base and scaling Ethereum. That’s why we are working with OP Labs and the Optimism Collective on a plan to scale Ethereum in a decentralized way.",
"description": "Base is a secure, low-cost, developer-friendly Ethereum L2 built to bring the next billion users onchain. It's built on Optimism’s open-source OP Stack.",
"documentation": {
Expand Down
2 changes: 1 addition & 1 deletion src/common/NodeSpecs/besu/besu-v1.0.0.json
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@
"docker": "https://besu.hyperledger.org/en/stable/HowTo/Get-Started/Installation-Options/Run-Docker-Image/",
"releaseNotesUrl": "https://github.com/hyperledger/besu/releases"
},
"iconUrl": "https://clientdiversity.org/assets/img/execution-clients/besu-text-logo.png",
"iconUrl": "https://pub-9f2dc808c3d748eabde036c3d3465ee6.r2.dev/besu.png",
"resources": [
{
"label": "Twitter",
Expand Down
2 changes: 1 addition & 1 deletion src/common/NodeSpecs/prysm/prysm-v1.0.0.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
},
"quicPort": {
"displayName": "QUIC port",
"cliConfigPrefix": ["p2p-quic-port="],
"cliConfigPrefix": ["--p2p-quic-port="],
"uiControl": {
"type": "text"
},
Expand Down
2 changes: 1 addition & 1 deletion src/main/menu.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import path from 'node:path';
import {
type BrowserWindow,
Menu,
Expand All @@ -10,7 +11,6 @@ import {
getSetHasSeenAlphaModal,
getSetHasSeenSplashscreen,
} from './state/settings';
import path from 'node:path';

import { runBenchmark } from './benchbuddy/runBenchmark';
import { getDebugInfoString, getGithubIssueProblemURL } from './debug';
Expand Down
2 changes: 2 additions & 0 deletions src/main/messenger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ export const CHANNELS = {
nodeLogs: 'nodeLogs',
podman: 'podman',
podmanInstall: 'podmanInstall',
openPodmanModal: 'openPodmanModal',
openNodePackageScreen: 'openNodePackageScreen',
theme: 'theme',
notifications: 'notifications',
reportEvent: 'reportEvent',
Expand Down
Loading

0 comments on commit b40e36d

Please sign in to comment.