Skip to content

Commit

Permalink
chore: format
Browse files Browse the repository at this point in the history
  • Loading branch information
AfonsoMartins26 committed Sep 10, 2024
1 parent 60544c3 commit 4fd7220
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 26 deletions.
2 changes: 1 addition & 1 deletion lib/atomic/accounts/user.ex
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ defmodule Atomic.Accounts.User do
field :confirmed_at, :naive_datetime
field :phone_number, :string
field :profile_picture, Uploaders.ProfilePicture.Type
field :cover_image , Uploaders.ProfilePicture.Type
field :cover_image, Uploaders.ProfilePicture.Type

belongs_to :course, Course
belongs_to :current_organization, Organization
Expand Down
4 changes: 2 additions & 2 deletions lib/atomic_web/live/home_live/index.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
</div>
</div>
<!-- Tabs -->
<div x-data="{ option: 'all' }" class="sticky top-10 lg:top-0 z-10 bg-white block">
<.tabs class="max-w-5xl mx-auto pt-1 px-4 sm:px-6 lg:px-8">
<div x-data="{ option: 'all' }" class="sticky top-10 z-10 block bg-white lg:top-0">
<.tabs class="mx-auto max-w-5xl px-4 pt-1 sm:px-6 lg:px-8">
<.tab id="tab-all" active={@current_tab == "all"} phx-click="load-all" phx-hook="ScrollToTop">
<%= gettext("All") %>
</.tab>
Expand Down
4 changes: 4 additions & 0 deletions lib/atomic_web/live/profile_live/form_component.ex
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ defmodule AtomicWeb.ProfileLive.FormComponent do
case socials_changeset.valid? do
true ->
:ok

false ->
{:noreply, assign(socket, :changeset, socials_changeset)}
end
Expand Down Expand Up @@ -88,6 +89,7 @@ defmodule AtomicWeb.ProfileLive.FormComponent do
defp consume_image_data(socket, user) do
consume_uploaded_entries(socket, :picture, fn %{path: path}, entry ->
resized_path = resize_image(path, 200, 200)

Accounts.update_user(user, %{
"picture" => %Plug.Upload{
content_type: entry.client_type,
Expand All @@ -99,6 +101,7 @@ defmodule AtomicWeb.ProfileLive.FormComponent do

consume_uploaded_entries(socket, :cover_image, fn %{path: path}, entry ->
resized_path = resize_image(path, 800, 250)

Accounts.update_user(user, %{
"cover_image" => %Plug.Upload{
content_type: entry.client_type,
Expand All @@ -123,6 +126,7 @@ defmodule AtomicWeb.ProfileLive.FormComponent do
case System.cmd(command, args) do
{_, 0} ->
{:ok, path}

{error_msg, _} ->
{:error, error_msg}
end
Expand Down
15 changes: 7 additions & 8 deletions lib/atomic_web/live/profile_live/form_component.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<%= label(f, :cover_image, "Cover Image", class: "mt-3 mb-1 text-sm font-medium text-gray-700") %>
<.live_file_input upload={@uploads.cover_image} class="hidden" />
<a onclick={"document.getElementById('#{@uploads.cover_image.ref}').click()"}>
<div class="w-full h-[250px] group relative z-0 bg-zinc-400 hover:bg-tertiary">
<div class="h-[250px] group relative z-0 w-full bg-zinc-400 hover:bg-tertiary">
<div class="absolute flex h-full w-full items-center justify-center">
<.icon name={:photo} class="mx-auto h-8 w-8 text-white group-hover:text-opacity-70 sm:h-12 sm:w-12" />
</div>
Expand All @@ -18,32 +18,31 @@
<.icon name={:camera} class="mx-auto h-8 w-8 text-white text-opacity-0 group-hover:text-opacity-100 sm:h-12 sm:w-12" />
</div>
<figure class="flex h-full w-full items-center justify-center">
<.live_img_preview entry={entry} class="h-full w-full object-cover max-h-[250px]" />
<.live_img_preview entry={entry} class="max-h-[250px] h-full w-full object-cover" />
</figure>
</article>
<% end %>
</section>
</div>
</a>
</div>

<!-- Seção para a imagem de perfil -->
<div class="flex flex-col items-center flex-shrink-0">
<div class="flex flex-shrink-0 flex-col items-center">
<%= label(f, :name, "Profile Picture", class: "mt-3 mb-1 text-sm font-medium text-gray-700") %>
<.live_file_input upload={@uploads.picture} class="hidden" />
<a onclick={"document.getElementById('#{@uploads.picture.ref}').click()"}>
<div class="relative z-0 w-24 h-24 sm:w-64 sm:h-64 ring-2 ring-zinc-300 rounded-full cursor-pointer bg-zinc-400 group hover:bg-tertiary">
<div class="group relative z-0 h-24 w-24 cursor-pointer rounded-full bg-zinc-400 ring-2 ring-zinc-300 hover:bg-tertiary sm:h-64 sm:w-64">
<div class="absolute flex h-full w-full items-center justify-center">
<.icon name={:camera} class="mx-auto h-8 w-8 text-white group-hover:text-opacity-70 sm:h-12 sm:w-12" />
</div>
<section>
<%= for entry <- @uploads.picture.entries do %>
<article class="upload-entry group relative flex h-24 w-24 sm:h-64 sm:w-64 cursor-pointer items-center rounded-full bg-white">
<article class="upload-entry group relative flex h-24 w-24 cursor-pointer items-center rounded-full bg-white sm:h-64 sm:w-64">
<div class="absolute z-10 flex h-full w-full items-center justify-center rounded-full">
<.icon name={:camera} class="mx-auto h-8 w-8 rounded-full text-white text-opacity-0 group-hover:text-opacity-100 sm:h-12 sm:w-12" />
</div>
<figure class="flex h-24 w-24 sm:h-64 sm:w-64 items-center justify-center rounded-full group-hover:opacity-80">
<.live_img_preview entry={entry} class="h-full w-full object-cover object-center rounded-full" />
<figure class="flex h-24 w-24 items-center justify-center rounded-full group-hover:opacity-80 sm:h-64 sm:w-64">
<.live_img_preview entry={entry} class="h-full w-full rounded-full object-cover object-center" />
</figure>
</article>
<% end %>
Expand Down
3 changes: 1 addition & 2 deletions lib/atomic_web/live/profile_live/show.ex
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
defmodule AtomicWeb.ProfileLive.Show do
use AtomicWeb, :live_view

import AtomicWeb.Components.{Button, Avatar , Gradient}
import AtomicWeb.Components.{Button, Avatar, Gradient}

alias Atomic.Accounts
alias Atomic.Organizations


@impl true
def mount(_params, _session, socket) do
{:ok, socket}
Expand Down
20 changes: 8 additions & 12 deletions lib/atomic_web/live/profile_live/show.html.heex
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
<div class="relative">
<div class="h-64 w-full bg-cover border-b-2" >
<.gradient class="h-64 w-full bg-cover bg-center" seed={@user.id} />
<div class="h-64 w-full border-b-2 bg-cover">
<.gradient class="h-64 w-full bg-cover bg-center" seed={@user.id} />
</div>


<!-- Profile Info Container -->
<div class="px-4 pt-4 relative">
<div class="relative px-4 pt-4">
<div class="flex items-start">
<!-- Profile Picture -->
<div class="relative -mt-16 flex-shrink-0">
<div class="relative">
<.avatar class="h-36 w-36 border-4 border-white rounded-full" name={@user.name} size={:xl} color={:light_gray} />
<.avatar class="h-36 w-36 rounded-full border-4 border-white" name={@user.name} size={:xl} color={:light_gray} />
</div>
</div>
<div class="flex-1 pl-6">
<!-- User Info -->
<h2 class="text-xl font-bold leading-7 text-zinc-900 sm:text-4xl">
<%= @user.name %>
</h2>

<div class="mt-2">
<%= if length(@organizations) > 0 do %>
<div class="mt-2">
Expand All @@ -32,7 +30,6 @@
<p class="py-2">No organizations found.</p>
<% end %>
</div>

<!-- Social Media Links -->
<div class="mt-4 flex gap-4">
<div class="flex flex-row items-center gap-x-1">
Expand All @@ -52,8 +49,8 @@
<.link class="text-blue-500">X</.link>
</div>
</div>
<div class="flex fllex-row mt-4 gap-8">

<div class="fllex-row mt-4 flex gap-8">
<%= if @user.email do %>
<div class="sm:col-span-1">
<dt class="text-sm font-medium text-gray-500">Email</dt>
Expand All @@ -76,10 +73,9 @@
</div>
<% end %>
</div>

<!-- Edit Button for Current User -->
<%= if @is_current_user do %>
<div class="flex justify-start mt-4">
<div class="mt-4 flex justify-start">
<.button patch={Routes.profile_edit_path(@socket, :edit, @user)}>
<%= gettext("Edit") %>
</.button>
Expand Down
2 changes: 1 addition & 1 deletion lib/atomic_web/templates/layout/live.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<div class="relative flex min-h-screen flex-col">
<div class="max-w-[1380px] mx-auto flex w-full flex-col lg:flex-row xl:px-8">
<!-- Navbar -->
<div class="relative flex-shrink-0 lg:w-72 lg:flex lg:max-w-[400px] sticky top-0 z-10 bg-white">
<div class="relative sticky top-0 z-10 flex-shrink-0 bg-white lg:max-w-[400px] lg:flex lg:w-72">
<%= render("_live_navbar.html", assigns) %>
</div>
<!-- Central content -->
Expand Down

0 comments on commit 4fd7220

Please sign in to comment.