Skip to content

Commit

Permalink
more clarifications
Browse files Browse the repository at this point in the history
  • Loading branch information
zkat committed Jul 6, 2023
1 parent 11bfe2d commit 0509d77
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 6 deletions.
7 changes: 7 additions & 0 deletions lib/banchan/accounts/accounts.ex
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,13 @@ defmodule Banchan.Accounts do
Enum.any?(user_roles, &(&1 in roles))
end

@doc """
Returns true if user is an artist.
"""
def artist?(%User{} = user) do
has_roles?(user, [:artist])
end

@doc """
Returns true if user has mod or admin privs.
"""
Expand Down
10 changes: 8 additions & 2 deletions lib/banchan_web/live/discover_live/components/offerings.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ defmodule BanchanWeb.DiscoverLive.Components.Offerings do
"""
use BanchanWeb, :live_component

alias Surface.Components.LivePatch
alias Surface.Components.{LivePatch, LiveRedirect}

alias Banchan.Accounts
alias Banchan.Offerings

alias BanchanWeb.Components.InfiniteScroll
Expand Down Expand Up @@ -67,7 +68,12 @@ defmodule BanchanWeb.DiscoverLive.Components.Offerings do
end

~F"""
<discover-offerings>
<discover-offerings class="flex flex-col items-center">
{#if Accounts.artist?(@current_user)}
<div class="pb-2">
Looking for your own offerings? Go to the <LiveRedirect class="link" to={~p"/studios"}>My Studios</LiveRedirect> page and select a studio.
</div>
{/if}
{#if Enum.empty?(@offerings)}
<div class="text-2xl">No Results</div>
{#if @suggest_studios}
Expand Down
10 changes: 8 additions & 2 deletions lib/banchan_web/live/discover_live/components/studios.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ defmodule BanchanWeb.DiscoverLive.Components.Studios do
"""
use BanchanWeb, :live_component

alias Surface.Components.LivePatch
alias Surface.Components.{LivePatch, LiveRedirect}

alias Banchan.Accounts
alias Banchan.Studios

alias BanchanWeb.Components.{InfiniteScroll, StudioCard}
Expand Down Expand Up @@ -67,7 +68,12 @@ defmodule BanchanWeb.DiscoverLive.Components.Studios do
end

~F"""
<discover-studios>
<discover-studios class="flex flex-col items-center">
{#if Accounts.artist?(@current_user)}
<div class="pb-2">
Looking for your own studios? Go to the <LiveRedirect class="link" to={~p"/studios"}>My Studios</LiveRedirect> page.
</div>
{/if}
{#if Enum.empty?(@studios)}
<div class="text-2xl">No Results</div>
{#if @suggest_offerings}
Expand Down
2 changes: 1 addition & 1 deletion lib/banchan_web/live/studio_live/index.ex
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ defmodule BanchanWeb.StudioLive.Index do
<Card class="border-2 border-dashed shadow-xs opacity-50 hover:opacity-100 hover:bg-base-200 h-full transition-all">
<div class="m-auto flex flex-col items-center">
<span class="text-3xl m-auto">New Studio</span>
<span class="text-sm p-2">Commissions are done through studios, rather than user accounts.</span>
<span class="text-sm p-2">Commissions are done through studios, rather than user accounts. Click here to create one.</span>
</div>
</Card>
</LiveRedirect>
Expand Down
2 changes: 1 addition & 1 deletion lib/banchan_web/live/studio_live/shop.ex
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ defmodule BanchanWeb.StudioLive.Shop do
<Card class="border-2 border-dashed shadow-xs opacity-50 hover:opacity-100 hover:bg-base-200 h-full transition-all">
<div class="flex flex-col items-center m-auto">
<span class="text-4xl">New Offering</span>
<span class="text-sm">Offerings are what users can select when they want a commission. For example, "Illustration", or "Chibi".</span>
<span class="text-sm">Offerings are what users can select when they want a commission. For example, "Illustration", or "Chibi". Click here to make one.</span>
</div>
</Card>
</LiveRedirect>
Expand Down

0 comments on commit 0509d77

Please sign in to comment.