From c6878c6626e14563cd25aa42e013e04b413cb34c Mon Sep 17 00:00:00 2001 From: Mia Sinek Date: Tue, 10 Dec 2024 19:29:19 +0100 Subject: [PATCH] Pimp up app show page --- app/helpers/dashboard_helper.rb | 2 +- app/views/dashboard/show.html.erb | 94 +++++++++++-------- .../generated_apps/_generated_app.html.erb | 18 ++-- 3 files changed, 68 insertions(+), 46 deletions(-) diff --git a/app/helpers/dashboard_helper.rb b/app/helpers/dashboard_helper.rb index e87bd46..75a845b 100644 --- a/app/helpers/dashboard_helper.rb +++ b/app/helpers/dashboard_helper.rb @@ -15,7 +15,7 @@ def sort_link_to(name, column) status: params[:status], search: params[:search] ), - class: "group inline-flex items-center px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider", + class: "group inline-flex items-center py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider", data: { turbo_frame: "generated_apps_list" } ) do concat name diff --git a/app/views/dashboard/show.html.erb b/app/views/dashboard/show.html.erb index 0d1b77a..9e75a24 100644 --- a/app/views/dashboard/show.html.erb +++ b/app/views/dashboard/show.html.erb @@ -2,53 +2,71 @@ <%= turbo_stream_from [ :notification_badge, current_user.id ] %>
-
-

- Welcome <%= current_user.github_username %>! -

-

- What will you build today? -

-
- - <% if @generated_apps.any? %> -
-
-

My Generated Apps

- <%= form_tag dashboard_path, method: :get, data: { turbo_frame: "generated_apps_list" } do %> - <%= text_field_tag :search, params[:search], - placeholder: "Search generated apps...", - class: "rounded-lg border-gray-300", +
+
+

+ Welcome <%= current_user.github_username %>! +

+

+ What will you build today? +

+
+ <% if @generated_apps.any? %> +
+ <%= form_with url: dashboard_path, + method: :get, + data: { turbo_frame: "generated_apps_list" } do |f| %> + <%= f.text_field :search, + value: params[:search], + placeholder: "Search...", + class: "text-sm rounded-lg border-gray-300", data: { controller: "autosubmit", action: "input->autosubmit#submit", autosubmit_target: "input" } %> <% end %> -
- <%= turbo_frame_tag "generated_apps_list" do %> -
- - - - - - - - - - - <%= render @generated_apps %> - -
<%= sort_link_to "Name", :name %><%= sort_link_to "Status", :status %><%= sort_link_to "Created", :created_at %>Actions
-
- - <%# <%== pagy_nav(@pagy) if @pagy.pages > 1 %> -
- <%== pagy_nav(@pagy) %> +
+
+
+ <% end %> +
+ <% if @generated_apps.any? %> +
+ <%= turbo_frame_tag "generated_apps_list" do %> +
+
+
+ + + + + + + + + + <%= render @generated_apps %> + +
+ <%= sort_link_to "Name", :name %> + + <%= sort_link_to "Status", :status %> + + <%= sort_link_to "Created", :created_at %> +
+
+
+
<% end %>
<% else %> diff --git a/app/views/generated_apps/_generated_app.html.erb b/app/views/generated_apps/_generated_app.html.erb index ec5d2ef..eb461be 100644 --- a/app/views/generated_apps/_generated_app.html.erb +++ b/app/views/generated_apps/_generated_app.html.erb @@ -1,15 +1,19 @@ - - <%= generated_app.name %> - + + + <%= generated_app.name %> + + <%= generated_app.status %> - <%= time_ago_in_words(generated_app.created_at) %> ago - + + <%= time_ago_in_words(generated_app.created_at) %> ago + + <%= link_to generated_app_path(generated_app), - class: "text-blue-600 hover:text-blue-800", - data: { turbo_frame: "_top" } do %> + class: "text-indigo-600 hover:text-indigo-900", + data: { turbo_frame: "_top" } do %>