WIP Profile settings page
Show the user's user address, and provide a button for copying it to the clipboard
This commit is contained in:
		
							parent
							
								
									94ca0f3764
								
							
						
					
					
						commit
						6ad02e69a2
					
				@ -11,7 +11,11 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  .btn-sm {
 | 
					  .btn-sm {
 | 
				
			||||||
    @apply btn;
 | 
					    @apply btn;
 | 
				
			||||||
    @apply py-1 px-2 text-sm shadow-sm;
 | 
					    @apply py-1 px-2 text-sm;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  .btn-icon {
 | 
				
			||||||
 | 
					    @apply px-3;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  .btn-gray {
 | 
					  .btn-gray {
 | 
				
			||||||
@ -28,4 +32,8 @@
 | 
				
			|||||||
    @apply bg-red-600 hover:bg-red-700 text-white
 | 
					    @apply bg-red-600 hover:bg-red-700 text-white
 | 
				
			||||||
           focus:ring-red-500 focus:ring-opacity-75;
 | 
					           focus:ring-red-500 focus:ring-opacity-75;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  input[type=text]:disabled {
 | 
				
			||||||
 | 
					    @apply text-gray-700;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,6 +1,11 @@
 | 
				
			|||||||
class Settings::ProfileController < SettingsController
 | 
					class Settings::ProfileController < SettingsController
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def index
 | 
					  def index
 | 
				
			||||||
 | 
					    @user = current_user
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  def update
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
				
			|||||||
@ -1 +1 @@
 | 
				
			|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-copy"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg>
 | 
					<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-copy <%= custom_class %>"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg>
 | 
				
			||||||
 | 
				
			|||||||
| 
		 Before Width: | Height: | Size: 351 B After Width: | Height: | Size: 372 B  | 
@ -3,7 +3,30 @@
 | 
				
			|||||||
<%= render MainWithSidenavComponent.new(sidenav_partial: 'shared/sidenav_settings') do %>
 | 
					<%= render MainWithSidenavComponent.new(sidenav_partial: 'shared/sidenav_settings') do %>
 | 
				
			||||||
  <section>
 | 
					  <section>
 | 
				
			||||||
    <h3>Profile</h3>
 | 
					    <h3>Profile</h3>
 | 
				
			||||||
    <p class="mb-12">
 | 
					    <p class="mb-1">
 | 
				
			||||||
 | 
					      <%= label :user_address, 'User address', class: 'font-bold' %>
 | 
				
			||||||
    </p>
 | 
					    </p>
 | 
				
			||||||
 | 
					    <p class="flex gap-1 mb-2 sm:block">
 | 
				
			||||||
 | 
					      <input type="text" id="user_address" class="flex-1 sm:w-3/5"
 | 
				
			||||||
 | 
					             value=<%= @user.address %> disabled="disabled" />
 | 
				
			||||||
 | 
					      <button id="copy-user-address" class="btn-md btn-icon btn-blue flex-none w-auto"
 | 
				
			||||||
 | 
					              title="Copy to clipboard">
 | 
				
			||||||
 | 
					        <span class="icon-initial">
 | 
				
			||||||
 | 
					          <%= render partial: "icons/copy", locals: { custom_class: "text-white h-4 w-4 inline" } %>
 | 
				
			||||||
 | 
					        </span>
 | 
				
			||||||
 | 
					        <span class="icon-active hidden">
 | 
				
			||||||
 | 
					          <%= render partial: "icons/check", locals: { custom_class: "text-white h-4 w-4 inline" } %>
 | 
				
			||||||
 | 
					        </span>
 | 
				
			||||||
 | 
					      </button>
 | 
				
			||||||
 | 
					    </p>
 | 
				
			||||||
 | 
					    <p class="text-sm text-gray-500">
 | 
				
			||||||
 | 
					      Your user address for Chat and Lightning Network.
 | 
				
			||||||
 | 
					    </p>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <%# <%= form_for(@user, as: "profile", url: settings_profile_path) do |f| %>
 | 
				
			||||||
 | 
					    <%#   <p class="mt-8">
 | 
				
			||||||
 | 
					    <%#     <%= f.submit "Save changes", class: 'btn-md btn-blue w-full sm:w-auto' %>
 | 
				
			||||||
 | 
					    <%#   </p>
 | 
				
			||||||
 | 
					    <%# <% end %>
 | 
				
			||||||
  </section>
 | 
					  </section>
 | 
				
			||||||
<% end %>
 | 
					<% end %>
 | 
				
			||||||
 | 
				
			|||||||
@ -12,6 +12,7 @@ Rails.application.routes.draw do
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  namespace :settings do
 | 
					  namespace :settings do
 | 
				
			||||||
    get 'profile', to: 'profile#index'
 | 
					    get 'profile', to: 'profile#index'
 | 
				
			||||||
 | 
					    post 'profile', to: 'profile#update'
 | 
				
			||||||
    get 'account', to: 'account#index'
 | 
					    get 'account', to: 'account#index'
 | 
				
			||||||
    post 'reset_password', to: 'account#reset_password'
 | 
					    post 'reset_password', to: 'account#reset_password'
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user