The personal finance app for everyone
Synth error handling (#1502)
Josh Pigforda9b61a655b79
diff --git a/app/models/family.rb b/app/models/family.rbindex 1f8cc561..b4bb2d4c 100644--- a/app/models/family.rb+++ b/app/models/family.rb@@ -153,6 +153,10 @@ class Family < ApplicationRecordself.class.synth_provider&.usageend+ def synth_overage?+ self.class.synth_provider && self.class.synth_provider.usage.utilization >= 1+ end+def subscribed?stripe_subscription_status == "active"enddiff --git a/app/views/pages/dashboard.html.erb b/app/views/pages/dashboard.html.erbindex 666cf509..a2e5c66b 100644--- a/app/views/pages/dashboard.html.erb+++ b/app/views/pages/dashboard.html.erb@@ -1,4 +1,9 @@<div class="space-y-4">+ <% if self_hosted? && Current.family&.synth_overage? %>+ <div class="bg-yellow-100 border border-yellow-400 text-yellow-700 px-4 py-3 rounded relative" role="alert">+ Your Synth API credit limit has been exceeded. Please visit your <a href="https://dashboard.synthfinance.com/settings" class="font-medium underline hover:text-yellow-900">Synth billing settings</a> to upgrade your plan or wait for your credits to reset.+ </div>+ <% end %><header class="flex items-center justify-between"><div><h1 class="sr-only"><%= t(".title") %></h1>