Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ui): small fixes #1505

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open

Conversation

shanimal08
Copy link
Collaborator

@shanimal08 shanimal08 commented Feb 11, 2025

Description

  • added gradient backgrounds to mining view containers to fix the harsh cut-off on ruler marks
  • the p2p stats error would show if you've just turned on p2p but hadn't restarted, because the currentStatsServerInputPort value was 0 therefore invalid, even if you haven't actually added an invalid value - so added some checks and an extra error message for no value set
  • moved the little + add button to the top of the Monerod url section & included the remove buttons always (disabled if there's only one url) for alignment

Motivation and Context

How Has This Been Tested?

locally:

issue fix
block height ruler abrupt cut off image
block height ruler abrupt cut off (with block time) image
false positive error for invalid stats port image
false positive error for invalid stats port (actual invalid port) image
lonely add button for Monerod Nodes URLs image
lonely add button for Monerod Nodes URLs (with remove enabled) image

Summary by CodeRabbit

  • New Features

    • Added localized error messages that alert users when the stats server port field is left empty.
    • Introduced a dedicated add button for node settings to streamline adding new entries.
  • Bug Fixes

    • Updated node removal behavior to prevent deletion when only one node is present, ensuring system stability.
  • Style

    • Refined button and container layouts with improved spacing and gradient effects for a cleaner, more consistent interface.
    • Enhanced styling properties for various components to improve layout and visual hierarchy.

Copy link

coderabbitai bot commented Feb 11, 2025

📝 Walkthrough

Walkthrough

This update adds a new error message key to multiple locale JSON configuration files, ensuring that the stats server port field cannot be left empty. Additionally, styling adjustments have been made to several components: the IconButton now prevents shrinking and disables pointer events in its disabled state; MonerodMarkup introduces a new AddButtonContainer for node additions and disables node removal when only one exists; and P2poolMarkup centralizes error validation and messaging. Minor styling enhancements and an i18n configuration update further refine the user interface and experience.

Changes

File(s) Change Summary
public/locales/{af,cn,de,en,fr,hi,id,ja,ko,pl,ru,tr}/settings.json Added new error message key "invalid-stats-server-port-empty": "Stats server port cannot be empty" to each locale.
src/components/elements/buttons/IconButton.tsx Added style properties: flex-shrink: 0; for fixed dimensions and pointer-events: none; for disabled state.
src/containers/floating/Settings/sections/experimental/MonerodMarkup/MonerodMarkup.styles.ts Updated styling with boxSizing, full-width container, adjusted margin, and introduced new styled component AddButtonContainer.
src/containers/floating/Settings/sections/experimental/MonerodMarkup/MonerodMarkup.tsx Moved the add-node IconButton into the new AddButtonContainer and modified node removal logic to disable removal when only one node exists.
src/containers/floating/Settings/sections/experimental/P2poolMarkup.tsx Centralized error message handling by introducing an errorMessage variable for empty/invalid stats server port inputs.
src/containers/main/Dashboard/MiningView/components/BlockTime.styles.ts Added z-index adjustments and a new pseudo-element for a background gradient effect.
src/containers/main/Dashboard/MiningView/components/Ruler.styles.ts Removed overflow: hidden; from the wrapper styled component.
src/theme/styles.ts Introduced a new pseudo-element to the DashboardContainer for a radial gradient background.
src/i18initializer.ts Added a new configuration option contextSeparator: '-' to the i18n initialization settings.

Sequence Diagram(s)

sequenceDiagram
    participant U as User
    participant M as MonerodMarkup Component
    participant NS as Node State
    participant UI as User Interface

    U->>M: Clicks "Add" button
    M->>NS: Append new node entry
    NS-->>M: Return updated nodes list
    M->>UI: Re-render component with new node
    U->>M: Attempt to remove node (button disabled if only one node)
Loading
sequenceDiagram
    participant U as User
    participant P as P2poolMarkup Component
    participant V as Validation Logic
    participant UI as User Interface

    U->>P: Enters stats server port (empty)
    P->>V: Validate input
    V-->>P: Returns error (empty input)
    P->>UI: Set and display errorMessage ("Stats server port cannot be empty")
Loading

Suggested reviewers

  • brianp
  • MCozhusheck
  • Misieq01
  • mmrrnn

Poem

Oh, I’m a rabbit leaping with glee,
Hopping through code so merrily.
New keys and styles, a garden so bright,
Each change a carrot in my sight.
With graceful hops and bug-free cheer,
I celebrate these updates, oh so dear!
🐰🌟


📜 Recent review details

Configuration used: .coderabbit.yml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9b687fa and 52bcaae.

📒 Files selected for processing (12)
  • public/locales/af/settings.json (1 hunks)
  • public/locales/cn/settings.json (1 hunks)
  • public/locales/de/settings.json (1 hunks)
  • public/locales/en/settings.json (1 hunks)
  • public/locales/fr/settings.json (1 hunks)
  • public/locales/hi/settings.json (1 hunks)
  • public/locales/id/settings.json (1 hunks)
  • public/locales/ja/settings.json (1 hunks)
  • public/locales/ko/settings.json (1 hunks)
  • public/locales/pl/settings.json (1 hunks)
  • public/locales/ru/settings.json (1 hunks)
  • public/locales/tr/settings.json (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (12)
  • public/locales/pl/settings.json
  • public/locales/fr/settings.json
  • public/locales/ru/settings.json
  • public/locales/af/settings.json
  • public/locales/hi/settings.json
  • public/locales/cn/settings.json
  • public/locales/en/settings.json
  • public/locales/id/settings.json
  • public/locales/ko/settings.json
  • public/locales/ja/settings.json
  • public/locales/de/settings.json
  • public/locales/tr/settings.json
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: tauri-build
  • GitHub Check: cargo checks (fmt, clippy, check)
  • GitHub Check: machete

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@shanimal08 shanimal08 marked this pull request as ready for review February 11, 2025 12:30
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

🧹 Nitpick comments (7)
src/containers/floating/Settings/sections/experimental/MonerodMarkup/MonerodMarkup.tsx (1)

29-29: Consider strengthening the URL validation regex.

The current regex might allow some invalid URLs. Consider using a more restrictive pattern that validates the protocol and port range.

-const node_url_regex = /^(https?:\/\/[a-zA-Z0-9.-]+(:\d{1,5})?)(\/.*)?$/;
+const node_url_regex = /^https?:\/\/[a-zA-Z0-9][-a-zA-Z0-9.]*[a-zA-Z0-9](:\d{1,5})?(?:\/[-a-zA-Z0-9._~:/?#[\]@!$&'()*+,;=]*)?$/;
src/containers/floating/Settings/sections/experimental/P2poolMarkup.tsx (1)

73-76: Consider improving the port fallback logic.

Using 0 as a fallback for currentStatsServerInputPort might mask potential issues. Consider using undefined or null to make the unset state more explicit.

-    () => (isRandomStatsServerPort ? currentStatsServerPort : editedCustomStatsServerPort) || 0,
+    () => (isRandomStatsServerPort ? currentStatsServerPort : editedCustomStatsServerPort) ?? null,
public/locales/cn/settings.json (1)

54-54: Translate the error message to Chinese.

The error message is currently in English. For consistency with other messages in the Chinese locale file, it should be translated to Chinese.

Apply this diff to translate the error message:

-  "invalid-stats-server-port-empty": "Stats server port cannot be empty",
+  "invalid-stats-server-port-empty": "统计服务器端口不能为空",
public/locales/ko/settings.json (1)

54-54: Translate the error message to Korean.

The error message is currently in English. For consistency with other messages in the Korean locale file, it should be translated to Korean.

Apply this diff to translate the error message:

-  "invalid-stats-server-port-empty": "Stats server port cannot be empty",
+  "invalid-stats-server-port-empty": "통계 서버 포트를 비워둘 수 없습니다",
public/locales/ja/settings.json (1)

54-54: Translate the error message to Japanese.

The error message is currently in English. For consistency with other messages in the Japanese locale file, it should be translated to Japanese.

Apply this diff to translate the error message:

-  "invalid-stats-server-port-empty": "Stats server port cannot be empty",
+  "invalid-stats-server-port-empty": "統計サーバーポートを空にすることはできません",
public/locales/hi/settings.json (1)

54-54: Translate the error message to Hindi.

The error message is currently in English. For consistency with other messages in the Hindi locale file, it should be translated to Hindi.

Apply this diff to translate the error message:

-  "invalid-stats-server-port-empty": "Stats server port cannot be empty",
+  "invalid-stats-server-port-empty": "सांख्यिकी सर्वर पोर्ट खाली नहीं हो सकता",
public/locales/pl/settings.json (1)

15-15: Remove redundant null entries.

The file contains two null entries that appear to be redundant or deprecated.

Apply this diff to remove the null entries:

-  "connected-to-tari-network": null,
-  "not-connected-to-tari-network": null,

Also applies to: 75-75

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ff6ea4f and a57f43f.

📒 Files selected for processing (19)
  • public/locales/af/settings.json (1 hunks)
  • public/locales/cn/settings.json (1 hunks)
  • public/locales/de/settings.json (1 hunks)
  • public/locales/en/settings.json (1 hunks)
  • public/locales/fr/settings.json (1 hunks)
  • public/locales/hi/settings.json (1 hunks)
  • public/locales/id/settings.json (1 hunks)
  • public/locales/ja/settings.json (1 hunks)
  • public/locales/ko/settings.json (1 hunks)
  • public/locales/pl/settings.json (1 hunks)
  • public/locales/ru/settings.json (1 hunks)
  • public/locales/tr/settings.json (1 hunks)
  • src/components/elements/buttons/IconButton.tsx (2 hunks)
  • src/containers/floating/Settings/sections/experimental/MonerodMarkup/MonerodMarkup.styles.ts (2 hunks)
  • src/containers/floating/Settings/sections/experimental/MonerodMarkup/MonerodMarkup.tsx (3 hunks)
  • src/containers/floating/Settings/sections/experimental/P2poolMarkup.tsx (3 hunks)
  • src/containers/main/Dashboard/MiningView/components/BlockTime.styles.ts (2 hunks)
  • src/containers/main/Dashboard/MiningView/components/Ruler.styles.ts (0 hunks)
  • src/theme/styles.ts (1 hunks)
💤 Files with no reviewable changes (1)
  • src/containers/main/Dashboard/MiningView/components/Ruler.styles.ts
🔇 Additional comments (9)
src/containers/main/Dashboard/MiningView/components/BlockTime.styles.ts (2)

10-21: LGTM! Gradient implementation effectively addresses ruler mark cut-offs.

The gradient overlay implementation in BlockTimeContainer aligns well with the PR objectives, providing a smooth transition that eliminates harsh cut-offs. The z-index layering ensures proper stacking of elements.


27-27: LGTM! Proper z-index handling for text elements.

The z-index additions to typography components ensure text remains visible above the gradient overlay.

Also applies to: 39-39

src/theme/styles.ts (1)

14-23: LGTM! Consistent gradient implementation across components.

The radial gradient implementation in DashboardContainer maintains visual consistency with the BlockTime component while providing a broader, more subtle effect appropriate for the dashboard container. The z-index layering ensures proper integration with existing visual elements.

src/components/elements/buttons/IconButton.tsx (1)

15-15: Great improvements to button behavior!

The addition of flex-shrink: 0 ensures consistent button dimensions, and pointer-events: none properly handles mouse interactions in the disabled state, enhancing the overall UX.

Also applies to: 26-26

src/containers/floating/Settings/sections/experimental/MonerodMarkup/MonerodMarkup.styles.ts (2)

6-6: Good addition of border-box sizing!

This ensures consistent input dimensions by including padding and borders in the total width/height calculation.


32-41: Verify potential text overlap with absolute positioning.

The absolute positioning of AddButtonContainer might overlap with the 'Monerod Nodes URLs' label if it becomes too long (e.g., in other locales).

❌ Verification inconclusive

🏁 Script executed:

#!/bin/bash
# Search for translations of 'Monerod Nodes URLs' to check potential text length issues
fd -e json -x jq -r 'select(."monerod-nodes-urls" != null) | ."monerod-nodes-urls"' {} \;

Length of output: 153


Action Required: Manually Verify Translations for Label Lengths

The earlier automated check produced a JSON parse error and yielded no reliable output. This leaves us without conclusive evidence regarding potentially long translations for "Monerod Nodes URLs" that might cause the absolutely positioned AddButtonContainer to overlap.

To proceed, please run the following shell scripts to search for occurrences of the label key and its literal text across translation files:

#!/bin/bash
# Search for occurrences of "monerod-nodes-urls" in all JSON files
find . -type f -name "*.json" -exec grep -H "monerod-nodes-urls" {} \;
#!/bin/bash
# Also search for the literal label "Monerod Nodes URLs" in the repository
grep -R "Monerod Nodes URLs" .

Review the resulting outputs to check for any instances where the translation might be longer than the default text. If longer translations are detected, consider adjusting the container width or positioning in src/containers/floating/Settings/sections/experimental/MonerodMarkup/MonerodMarkup.styles.ts (lines 32–41) to prevent overlap.

src/containers/floating/Settings/sections/experimental/MonerodMarkup/MonerodMarkup.tsx (1)

94-98: Good layout improvement!

Moving the add button to the top enhances visibility and usability.

src/containers/floating/Settings/sections/experimental/P2poolMarkup.tsx (1)

78-82: Good error message centralization!

Centralizing error message logic improves maintainability and consistency.

public/locales/en/settings.json (1)

53-54: LGTM! The error messages are well organized.

The new error message complements the existing invalid-stats-server-port message, providing more specific feedback when the port is empty.

@@ -51,6 +51,7 @@
"importing-wallet-copy": "Cüzdanınız içe aktarıldığında Tari Universe otomatik olarak yeniden başlayacak",
"invalid-seed-words": "Boşluklarla ayrılmış 24 kelime girin",
"invalid-stats-server-port": "Geçersiz istatistik sunucu portu",
"invalid-stats-server-port-empty": "Stats server port cannot be empty",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Translate the error message to Turkish.

The error message is currently in English while other messages in the file are in Turkish. This inconsistency affects the user experience for Turkish users.

Apply this diff to translate the message:

-  "invalid-stats-server-port-empty": "Stats server port cannot be empty",
+  "invalid-stats-server-port-empty": "İstatistik sunucu portu boş olamaz",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"invalid-stats-server-port-empty": "Stats server port cannot be empty",
"invalid-stats-server-port-empty": "İstatistik sunucu portu boş olamaz",

@@ -51,6 +51,7 @@
"importing-wallet-copy": "Tari Universe sal outomaties herbegin sodra jou beursie ingevoer is",
"invalid-seed-words": "Voer 24 woorde in, geskei deur spasies",
"invalid-stats-server-port": "Ongeldige statistieke bedienerpoort",
"invalid-stats-server-port-empty": "Stats server port cannot be empty",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Translate the error message to Afrikaans.

The error message is currently in English while other messages in the file are in Afrikaans. This inconsistency affects the user experience for Afrikaans users.

Apply this diff to translate the message:

-  "invalid-stats-server-port-empty": "Stats server port cannot be empty",
+  "invalid-stats-server-port-empty": "Statistieke bedienerpoort kan nie leeg wees nie",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"invalid-stats-server-port-empty": "Stats server port cannot be empty",
"invalid-stats-server-port-empty": "Statistieke bedienerpoort kan nie leeg wees nie",

@@ -51,6 +51,7 @@
"importing-wallet-copy": "Tari Universe akan memulai ulang secara otomatis setelah dompet Anda diimpor",
"invalid-seed-words": "Masukkan 24 kata yang dipisahkan oleh spasi",
"invalid-stats-server-port": "Port server statistik tidak valid",
"invalid-stats-server-port-empty": "Stats server port cannot be empty",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Translate the error message to Indonesian.

The error message is currently in English while other messages in the file are in Indonesian. This inconsistency affects the user experience for Indonesian users.

Apply this diff to translate the message:

-  "invalid-stats-server-port-empty": "Stats server port cannot be empty",
+  "invalid-stats-server-port-empty": "Port server statistik tidak boleh kosong",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"invalid-stats-server-port-empty": "Stats server port cannot be empty",
"invalid-stats-server-port-empty": "Port server statistik tidak boleh kosong",

@@ -51,6 +51,7 @@
"importing-wallet-copy": "Tari Universe автоматически перезапустится после импорта вашего кошелька",
"invalid-seed-words": "Введите 24 слова, разделенные пробелами",
"invalid-stats-server-port": "Неверный порт сервера статистики",
"invalid-stats-server-port-empty": "Stats server port cannot be empty",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Translate the error message to Russian.

The error message is currently in English while other messages in the file are in Russian. This inconsistency affects the user experience for Russian users.

Apply this diff to translate the message:

-  "invalid-stats-server-port-empty": "Stats server port cannot be empty",
+  "invalid-stats-server-port-empty": "Порт сервера статистики не может быть пустым",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"invalid-stats-server-port-empty": "Stats server port cannot be empty",
"invalid-stats-server-port-empty": "Порт сервера статистики не может быть пустым",

@@ -52,6 +52,7 @@
"importing-wallet-copy": "Tari Universe uruchomi się ponownie automatycznie po zaimportowaniu portfela",
"invalid-seed-words": "Wprowadź 24 słowa oddzielone spacjami",
"invalid-stats-server-port": "Nieprawidłowy port serwera statystyk",
"invalid-stats-server-port-empty": "Stats server port cannot be empty",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Translate the error message to Polish.

The error message is currently in English while other messages in the file are in Polish. This inconsistency affects the user experience for Polish users.

Apply this diff to translate the message:

-  "invalid-stats-server-port-empty": "Stats server port cannot be empty",
+  "invalid-stats-server-port-empty": "Port serwera statystyk nie może być pusty",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"invalid-stats-server-port-empty": "Stats server port cannot be empty",
"invalid-stats-server-port-empty": "Port serwera statystyk nie może być pusty",

@@ -51,6 +51,7 @@
"importing-wallet-copy": "Tari Universe wird automatisch neu starten, sobald dein Wallet importiert wurde",
"invalid-seed-words": "Geben Sie 24 Wörter ein, getrennt durch Leerzeichen",
"invalid-stats-server-port": "Ungültiger Statistik-Server-Port",
"invalid-stats-server-port-empty": "Stats server port cannot be empty",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Translate the error message to German.

The error message is in English but should be translated to German to maintain consistency with other localized strings.

Apply this diff to translate the message:

-  "invalid-stats-server-port-empty": "Stats server port cannot be empty",
+  "invalid-stats-server-port-empty": "Statistik-Server-Port darf nicht leer sein",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"invalid-stats-server-port-empty": "Stats server port cannot be empty",
"invalid-stats-server-port-empty": "Statistik-Server-Port darf nicht leer sein",

@@ -51,6 +51,7 @@
"importing-wallet-copy": "Tari Universe redémarrera automatiquement une fois que votre portefeuille aura été importé",
"invalid-seed-words": "Entrez 24 mots séparés par des espaces",
"invalid-stats-server-port": "Port du serveur de statistiques invalide",
"invalid-stats-server-port-empty": "Stats server port cannot be empty",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Translate the error message to French.

The error message is in English but should be translated to French to maintain consistency with other localized strings.

Apply this diff to translate the message:

-  "invalid-stats-server-port-empty": "Stats server port cannot be empty",
+  "invalid-stats-server-port-empty": "Le port du serveur de statistiques ne peut pas être vide",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"invalid-stats-server-port-empty": "Stats server port cannot be empty",
"invalid-stats-server-port-empty": "Le port du serveur de statistiques ne peut pas être vide",

@shanimal08 shanimal08 added a-ui javascript Pull requests that update Javascript code labels Feb 12, 2025
@@ -76,6 +75,12 @@ const P2poolMarkup = () => {
[currentStatsServerPort, editedCustomStatsServerPort, isRandomStatsServerPort]
);

const errorMessage = !currentStatsServerInputPort
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nested ternary are hard to read, what about using just i18n context for example ?

const emptyContext = hasStatsServerPortError(currentStatsServerInputPort) ?  "empty" :  "notEmpty"
const errorMessage =  !currentStatsServerInputPort ? t("invalid-stats-server-port", { context: emptyContext }) : null

Docs: https://www.i18next.com/translation-function/context

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oooh nice, thank you @Misieq01 <3

updated!
also changed the contextSeparator in i18init, to keep it consistent with our keys, but LMK if i should revert that and rather change the keys that will use context?

Copy link
Collaborator

@Misieq01 Misieq01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small comment otherwise looks great !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a-ui javascript Pull requests that update Javascript code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants