<%= render DS::Dialog.new(variant: "modal", width: "md") do |dialog| %> <% dialog.with_body do %>

<% if @api_key_present %> <%= t("reports.google_sheets_instructions.title_with_key") %> <% else %> <%= t("reports.google_sheets_instructions.title_no_key") %> <% end %>

<%= icon("x", as_button: true, data: { action: "DS--dialog#close" }, class: "text-subdued hover:text-primary") %>
<% if @api_key_present %>

<%= t("reports.google_sheets_instructions.ready") %>

<%= t("reports.google_sheets_instructions.steps") %>

=IMPORTDATA("<%= @csv_url %>")

<%= icon("alert-triangle", class: "w-4 h-4 inline") %> <%= t("reports.google_sheets_instructions.security_warning") %>

<% else %>

<%= t("reports.google_sheets_instructions.need_key") %>

  1. <%= t("reports.google_sheets_instructions.step1") %>
  2. <%= t("reports.google_sheets_instructions.step2") %>
  3. <%= t("reports.google_sheets_instructions.step3") %>
  4. <%= t("reports.google_sheets_instructions.step4") %>

<%= t("reports.google_sheets_instructions.example") %>:

<%= @csv_url %>&api_key=YOUR_API_KEY_HERE

<%= t("reports.google_sheets_instructions.then_use") %>

<% end %>
<% if @api_key_present %> <%= render DS::Button.new( text: t("reports.google_sheets_instructions.open_sheets"), variant: "primary", full_width: true, href: "https://sheets.google.com/create", target: "_blank", data: { action: "click->DS--dialog#close" } ) %> <% else %> <%= render DS::Button.new( text: t("reports.google_sheets_instructions.go_to_api_keys"), variant: "primary", full_width: true, href: settings_api_key_path, frame: "_top" ) %> <% end %> <%= render DS::Button.new( text: t("reports.google_sheets_instructions.close"), variant: "outline", full_width: true, data: { action: "DS--dialog#close" } ) %>
<% end %> <% end %>