Skip to content

make deposit button env configurabliable#1171

Merged
lodewiges merged 2 commits intostagingfrom
feature/make-deposit-button-env
Dec 18, 2025
Merged

make deposit button env configurabliable#1171
lodewiges merged 2 commits intostagingfrom
feature/make-deposit-button-env

Conversation

@lodewiges
Copy link
Copy Markdown
Contributor

@lodewiges lodewiges commented Dec 11, 2025

Makes the "geld inleggen" button on the order screen configerable through a env variable

Summary by CodeRabbit

  • New Features

    • Added a toggle to control visibility of the "Geld inleggen" (deposit) button on the order screen, allowing it to be enabled or disabled via configuration.
  • Bug Fixes

    • Fixed which configuration key is used to determine how roles information is displayed on the user page.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Dec 11, 2025

Walkthrough

This change introduces a DEPOSIT_BUTTON_ENABLED flag that flows from environment → Rails config → view data attributes → frontend JS → Vue component to conditionally render the "Geld inleggen" button on the order screen.

Changes

Cohort / File(s) Summary
Configuration
\.env.example, config/application.rb
Added DEPOSIT_BUTTON_ENABLED to .env.example and exposed it as config.x.deposit_button_enabled (ENV default 'true' → boolean).
View Layer
app/views/activities/order_screen.html.erb
Added deposit_button_enabled to the data payload and passed deposit-button-enabled prop to the user-selection component.
JavaScript Initialization
app/javascript/order_screen.js
Reads dataset.depositButtonEnabled, converts it to boolean, and exposes it in the Vue instance data.
Vue Component
app/javascript/components/orderscreen/UserSelection.vue
New depositButtonEnabled prop (Boolean, default true); the "Geld inleggen" button is now rendered conditionally with v-if="depositButtonEnabled".
Minor config key change
app/views/users/show.html.erb
Switched conditional from Rails.application.config.x.amber_api_url.present? to Rails.application.config.x.amber_api_host.present?.

Sequence Diagram(s)

mermaid
sequenceDiagram
participant Env as Environment
participant Rails as Rails app
participant View as ERB view
participant Browser as Browser (JS)
participant Vue as Vue component
Env->>Rails: DEPOSIT_BUTTON_ENABLED
Rails->>View: config.x.deposit_button_enabled → embed in data-attributes
View->>Browser: HTML with data-deposit-button-enabled
Browser->>Vue: order_screen.js reads dataset → sets Vue data depositButtonEnabled
Vue->>UserSelection: passes prop depositButtonEnabled
UserSelection-->>Vue: v-if decides whether to render "Geld inleggen" button

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

  • Verify ENV boolean parsing in config/application.rb matches expected truthy values.
  • Confirm data-deposit-button-enabled is serialized correctly in the ERB and parsed reliably in order_screen.js.
  • Check the prop name casing/serialization between dataset and Vue prop to avoid mismatches.

Poem

🐰
I hopped from ENV to view and script,
A tiny flag, a gentle flip—
The button sleeps or springs to play,
A rabbit cheers: "Toggle away!" 🥕

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Description check ❓ Inconclusive The pull request description is minimal and does not follow the repository's template structure, lacking checklist items, detailed summary, and screenshots. Complete the description template by adding the migration checklist, detailed summary of UI changes, and any related issue references (e.g., 'fixes #xyz').
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title contains a typo ('configurabliable' instead of 'configurable') but accurately summarizes the main change: making the deposit button configurable via environment variable.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/make-deposit-button-env

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 11, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.68%. Comparing base (4b5a0f5) to head (e38d81e).
⚠️ Report is 3 commits behind head on staging.

Additional details and impacted files
@@           Coverage Diff            @@
##           staging    #1171   +/-   ##
========================================
  Coverage    77.68%   77.68%           
========================================
  Files           54       54           
  Lines         1340     1340           
========================================
  Hits          1041     1041           
  Misses         299      299           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@lodewiges lodewiges marked this pull request as ready for review December 18, 2025 14:37
Copilot AI review requested due to automatic review settings December 18, 2025 14:37
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR makes the deposit button ("Geld inleggen") on the order screen configurable through the DEPOSIT_BUTTON_ENABLED environment variable. This allows deployments to disable the deposit functionality if needed.

Key changes:

  • Added DEPOSIT_BUTTON_ENABLED environment variable configuration that defaults to true
  • Passed the configuration through the Rails view layer to the Vue.js component
  • Made the deposit button conditionally render based on the configuration

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
config/application.rb Added deposit_button_enabled configuration that reads from DEPOSIT_BUTTON_ENABLED env var
app/views/activities/order_screen.html.erb Passed deposit_button_enabled config to the order screen Vue component via data attributes
app/javascript/order_screen.js Parsed the depositButtonEnabled data attribute and added it to Vue component data
app/javascript/components/orderscreen/UserSelection.vue Added depositButtonEnabled prop with default value true and made button render conditionally with v-if
.env.example Added example DEPOSIT_BUTTON_ENABLED=true environment variable
app/views/users/show.html.erb Changed condition from amber_api_url to amber_api_host (unrelated bug fix)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@lodewiges
Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Dec 18, 2025

✅ Actions performed

Full review triggered.

@lodewiges lodewiges merged commit c24e5dd into staging Dec 18, 2025
12 of 13 checks passed
@lodewiges lodewiges deleted the feature/make-deposit-button-env branch December 18, 2025 14:55
Copy link
Copy Markdown

@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: 0

🧹 Nitpick comments (1)
.env.example (1)

52-52: Consider reordering for consistency.

The static analysis tool suggests placing DEPOSIT_BUTTON_ENABLED before MIN_PAYMENT_AMOUNT to maintain alphabetical ordering. While not critical, consistent ordering improves maintainability.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4b5a0f5 and e38d81e.

📒 Files selected for processing (6)
  • .env.example (1 hunks)
  • app/javascript/components/orderscreen/UserSelection.vue (2 hunks)
  • app/javascript/order_screen.js (2 hunks)
  • app/views/activities/order_screen.html.erb (2 hunks)
  • app/views/users/show.html.erb (1 hunks)
  • config/application.rb (1 hunks)
🧰 Additional context used
🪛 dotenv-linter (4.0.0)
.env.example

[warning] 52-52: [UnorderedKey] The DEPOSIT_BUTTON_ENABLED key should go before the MIN_PAYMENT_AMOUNT key

(UnorderedKey)

🔇 Additional comments (8)
app/views/users/show.html.erb (1)

155-155: Verify this change is intentional and related to the PR scope.

This line changes the config key from amber_api_url.present? to amber_api_host.present?. While both checks should be functionally equivalent (since both are derived from the same credentials source), this change appears unrelated to making the deposit button configurable.

Is this an intentional refactor, or should it be part of a separate PR?

config/application.rb (1)

78-78: LGTM!

The configuration is correctly implemented with a sensible default of true, maintaining backward compatibility. The string-to-boolean conversion pattern is appropriate and consistent with Rails conventions.

app/javascript/order_screen.js (2)

22-22: LGTM!

The dataset attribute is correctly read and converted to a boolean. This follows the existing pattern used for other data attributes in this file.


46-46: LGTM!

The depositButtonEnabled flag is correctly added to the Vue instance data and will be accessible to all child components.

app/javascript/components/orderscreen/UserSelection.vue (2)

107-110: LGTM!

The prop is correctly declared with appropriate type and default value. The default of true ensures backward compatibility if the prop is not provided.


26-29: LGTM!

The "Geld inleggen" button is now conditionally rendered based on the depositButtonEnabled prop. This correctly implements the feature requirement to make the deposit button configurable.

app/views/activities/order_screen.html.erb (2)

6-6: LGTM!

The deposit_button_enabled config value is correctly added to the data attributes, enabling the frontend to access this configuration.


59-59: LGTM!

The depositButtonEnabled prop is correctly passed to the user-selection component, completing the data flow from Rails config to Vue component. The kebab-case attribute name correctly maps to the camelCase prop in the Vue component.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants