🚀 feat: Implement Auto-Refill SettingsTab for Balance #6537
+287
−23
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This pull request introduces significant changes to the new balance SettingsTab, including the addition of auto-refill settings and updates to the user interface to accommodate these new features. The most important changes are summarized below:
Backend Changes:
api/server/controllers/Balance.js
: Enhanced the balance controller to include auto-refill related fields and handle cases where the balance is not found.Frontend Changes:
client/src/components/Nav/AccountSettings.tsx
: Updated balance display logic to show token credits with two decimal places.client/src/components/Nav/Settings.tsx
: Added a new balance tab and included logic to conditionally display it based on the startup configuration. [1] [2] [3] [4] [5]client/src/components/Nav/SettingsTabs/Balance/AutoRefillSettings.tsx
: Introduced a new component to display auto-refill settings.client/src/components/Nav/SettingsTabs/Balance/Balance.tsx
: Created a new balance component to display token credits and auto-refill settings.client/src/components/Nav/SettingsTabs/Balance/TokenCreditsItem.tsx
: Added a new component to display token credits.Localization:
client/src/locales/en/translation.json
: Added new localization strings for balance and auto-refill settings. [1] [2]Data Provider:
packages/data-provider/src/config.ts
: Added a new enum value for the balance settings tab.packages/data-provider/src/data-service.ts
: Updated thegetUserBalance
function to return a detailed balance response including auto-refill settings. [1] [2]packages/data-provider/src/types.ts
: Defined a new typeTBalanceResponse
to represent the balance response structure.When Balance is

enabled: false
:When

autoRefillEnabled
is enabled on the user balance object:When

autoRefillEnabled
is disabled on the user balance object:Change Type
Testing
Please describe your test process and include instructions so that we can reproduce your test. If there are any important variables for your testing configuration, list them here.
Test Configuration:
Checklist