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

Synth error handling #1502

Merged
merged 3 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/models/family.rb
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,10 @@ def synth_usage
self.class.synth_provider&.usage
end

def synth_overage?
self.class.synth_provider && self.class.synth_provider.usage.utilization >= 1
end

def subscribed?
stripe_subscription_status == "active"
end
Expand Down
5 changes: 5 additions & 0 deletions app/views/pages/dashboard.html.erb
Original file line number Diff line number Diff line change
@@ -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>
Expand Down