diff --git a/.gitignore b/.gitignore index 3c2a792f..a10f493f 100644 --- a/.gitignore +++ b/.gitignore @@ -48,3 +48,4 @@ node_modules !/app/assets/builds/.keep /vendor/bundle +/data/* \ No newline at end of file diff --git a/app/views/dashboard/_address_search.html.erb b/app/views/dashboard/_address_search.html.erb index 7fe93869..49667bf3 100644 --- a/app/views/dashboard/_address_search.html.erb +++ b/app/views/dashboard/_address_search.html.erb @@ -1,44 +1,24 @@ -
- -
-
-
-
- <%= form_with url: dashboard_panel_path('address_search'), method: :post, data: { turbo_frame: 'main-panel' }, html: { class: "space-y-4" } do |form| %> -
- <%= form.label :address, "Enter your address", class: "block text-sm font-medium text-gray-700 mb-1" %> - <%= form.text_field :address, placeholder: "e.g., 123 Main St, City, State, Zip Code", class: "w-full py-3 px-4 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500", autocomplete: "off" %> -
-
- <%= form.submit "Find My Representatives", class: "w-full sm:w-auto bg-blue-500 hover:bg-blue-700 text-white font-bold py-3 px-6 border border-blue-700 rounded-lg text-lg" %> -
- <% end %> - - <%# Support both locals and instance variables for Turbo and non-Turbo renders %> - <% reps = (defined?(representatives) ? representatives : @representatives) %> - <% did_search = (defined?(searched) ? searched : @searched) %> - <% if did_search %> -
- <%= render partial: 'representatives_table', locals: { representatives: reps } %> -
- <% end %> +
+
+ <%= form_with url: dashboard_panel_path('address_search'), method: :post, data: { turbo_frame: 'main-panel' }, html: { class: "space-y-4" } do |form| %> +
+ <%= form.label :address, "Enter your address", class: "block text-sm font-medium text-gray-700 mb-1" %> + <%= form.text_field :address, placeholder: "e.g., 123 Main St, City, State, Zip Code", class: "w-full py-3 px-4 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500", autocomplete: "off" %> +
+
+ <%= form.submit "Find My Representatives", class: "inline-flex items-center bg-blue-500 hover:bg-blue-700 text-white font-semibold py-3 px-4 border border-blue-700 rounded-lg text-base sm:text-lg" %>
- + <% end %>
-
diff --git a/app/views/dashboard/_home.html.erb b/app/views/dashboard/_home.html.erb index a8d56575..539f7ff5 100644 --- a/app/views/dashboard/_home.html.erb +++ b/app/views/dashboard/_home.html.erb @@ -1,20 +1,20 @@ -
-
-

+
+
+

CivicPatch is an open-source, distributed data collection framework aimed at collecting contact information for local representatives.

-
+
Where is the data stored?
-
diff --git a/app/views/dashboard/_progress_map.html.erb b/app/views/dashboard/_progress_map.html.erb index 2f87a008..2f04930f 100644 --- a/app/views/dashboard/_progress_map.html.erb +++ b/app/views/dashboard/_progress_map.html.erb @@ -1,32 +1,32 @@
-
-

CivicPatch Municipal Data Collection Progress

+
+

CivicPatch Municipal Data Collection Progress

- -
+ +
-
- Completion Rate: -
+
+ Completion Rate: +
70%+
-
+
50-69%
-
+
30-49%
-
+
10-29%
-
+
0-9%
@@ -36,8 +36,8 @@
- -
+ +
@@ -69,10 +69,10 @@ if (progress >= 10) return '#d4a574'; if (progress > 0) return '#8b4513'; return '#e5e5e5'; - } - // Check if D3 is available - if (typeof d3 === 'undefined') { + +
+ Summary: 7 states tracked  702 of 1,639 municipalities scraped  42.8% average completion console.log('D3 not available, showing static visualization only'); document.getElementById('us-map-container').innerHTML = '

Interactive map requires D3.js. See detailed progress below.

'; diff --git a/app/views/dashboard/index.html.erb b/app/views/dashboard/index.html.erb index 055af2ed..b94f2eb9 100644 --- a/app/views/dashboard/index.html.erb +++ b/app/views/dashboard/index.html.erb @@ -1,14 +1,14 @@ -
-
-
+
+
+
<%= render 'dashboard/home' %>
-
+
<%= render 'dashboard/progress_map' %>
-
+
<%= render 'dashboard/address_search' %>
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index f42f9e17..1487414d 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -14,19 +14,21 @@ <%= yield :head %> - <%# Enable PWA manifest for installable apps (make sure to enable in config/routes.rb too!) %> - <%#= tag.link rel: "manifest", href: pwa_manifest_path(format: :json) %> - - + <%= tag.link rel: "manifest", href: "/manifest.json" %> - <%# Includes all stylesheet files in app/assets/stylesheets %> - <%= stylesheet_link_tag :app, "data-turbo-track": "reload" %> - - <%= stylesheet_link_tag "https://unpkg.com/leaflet@1.9.4/dist/leaflet.css", integrity: "sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=", crossorigin: "" %> - <%= javascript_importmap_tags 'application' %> + <%= stylesheet_link_tag "tailwind", "data-turbo-track": "reload" %> + <%= tag.link rel: "stylesheet", href: "https://unpkg.com/leaflet@1.9.4/dist/leaflet.css", integrity: "sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=", crossorigin: "anonymous" %> + <%= javascript_importmap_tags %> + @@ -39,8 +41,9 @@
-
+
<%= yield %> -
+
- + + diff --git a/app/views/representatives/_representatives_table.html.erb b/app/views/representatives/_representatives_table.html.erb index 16eb0eb0..4f541a7a 100644 --- a/app/views/representatives/_representatives_table.html.erb +++ b/app/views/representatives/_representatives_table.html.erb @@ -1,57 +1,57 @@ <%# app/views/pages/_representatives_table.html.erb %> <% if representatives.present? %>
- - +
+ - - - - - + + + + + <% representatives.each do |rep_obj| %> <% rep = rep_obj.is_a?(Hash) ? rep_obj : rep_obj.respond_to?(:data) ? rep_obj.data : {} %> <% initials = rep["name"].to_s.split.size >= 2 ? rep["name"].to_s.split.first[0] + rep["name"].to_s.split.last[0] : rep["name"].to_s[0,2] rescue '??' %> - - + - - - -
+
<% if rep["image"] %> -
- " alt="<%= rep["name"] || 'Representative' %>" class="h-40 w-40 md:h-24 md:w-24 rounded-lg object-cover" onerror="this.style.display='none';this.nextElementSibling.style.display='flex';"> - +
+ " alt="<%= rep["name"] || 'Representative' %>" class="h-28 w-28 sm:h-32 sm:w-32 md:h-24 md:w-24 rounded-lg object-cover" onerror="this.style.display='none';this.nextElementSibling.style.display='flex';"> +
<% else %> -
<%= initials %>
+
<%= initials %>
<% end %>
+
<%= rep["name"].presence || '-' %>
+ <% office_text = rep["office"].presence || rep["title"].presence || rep["level"].presence || rep["position"].presence || rep["role"].presence %> <% if rep["other_names"].present? && rep["other_names"].is_a?(Array) %> <% names = rep["other_names"].map { |n| n.is_a?(Hash) ? n["name"] : n.to_s }.reject(&:blank?) %> <% if names.size > 0 %> -
+
<%= office_text %>
<%= names.join(", ") %>
<% else %> -
<%= office_text %>
+
<%= office_text %>
<% end %> <% else %> -
<%= office_text %>
+
<%= office_text %>
<% end %>
+ <% email = (rep["contact_details"]&.find { |c| c["type"] == 'email' }&.dig("value") rescue nil) || rep["email"] || rep["contact_email"] %> <% phone = (rep["contact_details"]&.find { |c| c["type"] == 'phone' }&.dig("value") rescue nil) || rep["phone"] || rep["contact_phone"] %> <% if email.present? || phone.present? %> - + <% all_links = [] %> <% website = rep["website"] || rep["url"] || rep["official_website"] %> <% if website.present? %> @@ -102,7 +102,7 @@
-
+
↑ Scroll up to search for a different address
<% else %>