Skip to content

Commit

Permalink
feat: add profile pictures
Browse files Browse the repository at this point in the history
  • Loading branch information
zvonimirr committed Jun 16, 2024
1 parent 7c2bd58 commit cfd3b84
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/swipex_web/live/chat_live.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ defmodule SwipexWeb.ChatLive do
alias Phoenix.PubSub

def mount(%{"id" => id}, %{"user_id" => user_id}, socket) do
IO.inspect({id, user_id})

with true <- Swipex.User.has_matched(id, user_id),
{:ok, user} <- Swipex.User.get_user_by_id(id) do
PubSub.subscribe(Swipex.PubSub, "swipex")
Expand Down Expand Up @@ -55,7 +53,13 @@ defmodule SwipexWeb.ChatLive do

~H"""
<a href="/profile" class="text-blue-500">Back to profile</a>
<img
src={"https://api.dicebear.com/9.x/lorelei/svg?seed=#{@recipient["id"]}"}
alt="Profile picture"
class="rounded-full w-24 h-24"
/>
<h1 class="text-4xl mb-2">Chat with <%= @recipient["name"] %></h1>
<hr />
<div class="flex flex-col mt-4">
<%= for message <- @messages do %>
Expand Down
15 changes: 15 additions & 0 deletions lib/swipex_web/live/profile_live.ex
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ defmodule SwipexWeb.ProfileLive do
~H"""
<div class="flex gap-4 justify-between w-full mb-3">
<div class="flex flex-col gap-3">
<img
src={"https://api.dicebear.com/9.x/lorelei/svg?seed=#{@user["id"]}"}
alt="Profile picture"
class="rounded-full"
/>
<h1 class="text-4xl"><%= @user["name"] %></h1>
<p>Hey there, <%= @user["name"] %>, this is your profile page.</p>
<hr />
Expand All @@ -68,6 +73,11 @@ defmodule SwipexWeb.ProfileLive do
<div class="flex flex-col gap-3">
<p class="text-2xl">Let's swipe!</p>
<div class="flex flex-col gap-3">
<img
src={"https://api.dicebear.com/9.x/lorelei/svg?seed=#{@potential_match["id"]}"}
alt="Profile picture"
class="rounded-full"
/>
<p><%= @potential_match["name"] %></p>
<div class="flex gap-3">
<button
Expand Down Expand Up @@ -101,6 +111,11 @@ defmodule SwipexWeb.ProfileLive do
<% end %>
<%= for match <- @matches do %>
<div class="flex flex-col gap-3">
<img
src={"https://api.dicebear.com/9.x/lorelei/svg?seed=#{match["id"]}"}
alt="Profile picture"
class="rounded-full"
/>
<a href={"/chat/#{match["id"]}"} class="text-blue-400 hover:underline">
<%= match["name"] %>
</a>
Expand Down

0 comments on commit cfd3b84

Please sign in to comment.