Skip to content

Commit be8ee00

Browse files
committed
refactor: simplify bounty form structure and enhance UI responsiveness
- Removed redundant radio button options for bounty form type, streamlining the user interface. - Consolidated input fields for bounty details, improving layout and accessibility. - Updated the share drawer component to maintain functionality while enhancing code clarity.
1 parent d028738 commit be8ee00

File tree

2 files changed

+22
-89
lines changed

2 files changed

+22
-89
lines changed

lib/algora_web/live/org/dashboard_live.ex

Lines changed: 16 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,7 @@ defmodule AlgoraWeb.Org.DashboardLive do
9090
# Will be initialized when chat starts
9191
|> assign(:thread, nil)
9292
|> assign(:messages, [])
93-
|> assign(:show_chat, false)
94-
|> assign(:bounty_form_type, "github")}
93+
|> assign(:show_chat, false)}
9594
else
9695
{:ok, redirect(socket, to: ~p"/org/#{current_org.handle}/home")}
9796
end
@@ -1665,89 +1664,24 @@ defmodule AlgoraWeb.Org.DashboardLive do
16651664
end
16661665
}
16671666
/>
1668-
1669-
<div class="grid grid-cols-2 gap-4">
1670-
<label class={[
1671-
"group relative flex cursor-pointer rounded-lg px-3 py-2 shadow-sm focus:outline-none",
1672-
"border-2 bg-background transition-all duration-200 hover:border-primary hover:bg-primary/10",
1673-
"border-border has-[:checked]:border-primary has-[:checked]:bg-primary/10"
1674-
]}>
1675-
<input
1676-
type="radio"
1677-
name="bounty_form[type]"
1678-
value="github"
1679-
checked={@bounty_form_type == "github"}
1680-
class="sr-only"
1681-
phx-click={JS.show(to: "#github-form") |> JS.hide(to: "#custom-form")}
1682-
/>
1683-
<span class="flex flex-1 items-center justify-between">
1684-
<span class="text-sm font-medium">GitHub issue</span>
1685-
<.icon
1686-
name="tabler-check"
1687-
class="invisible size-5 text-primary group-has-[:checked]:visible"
1688-
/>
1689-
</span>
1690-
</label>
1691-
<label class={[
1692-
"group relative flex cursor-pointer rounded-lg px-3 py-2 shadow-sm focus:outline-none",
1693-
"border-2 bg-background transition-all duration-200 hover:border-primary hover:bg-primary/10",
1694-
"border-border has-[:checked]:border-primary has-[:checked]:bg-primary/10"
1695-
]}>
1696-
<input
1697-
type="radio"
1698-
name="bounty_form[type]"
1699-
value="custom"
1700-
checked={@bounty_form_type == "custom"}
1701-
class="sr-only"
1702-
phx-click={JS.show(to: "#custom-form") |> JS.hide(to: "#github-form")}
1703-
/>
1704-
<span class="flex flex-1 items-center justify-between">
1705-
<span class="text-sm font-medium">Custom</span>
1706-
<.icon
1707-
name="tabler-check"
1708-
class="invisible size-5 text-primary group-has-[:checked]:visible"
1709-
/>
1710-
</span>
1711-
</label>
1712-
</div>
1713-
1714-
<div id="github-form" class={if @bounty_form_type == "custom", do: "hidden"}>
1715-
<.input
1716-
label="URL"
1717-
field={@bounty_form[:url]}
1718-
placeholder="https://github.com/owner/repo/issues/123"
1719-
/>
1720-
</div>
1721-
1722-
<div
1723-
id="custom-form"
1724-
class={classes([@bounty_form_type == "github" && "hidden", "space-y-4"])}
1725-
>
1726-
<.input
1727-
label="Title"
1728-
field={@bounty_form[:title]}
1729-
placeholder="Brief description of the bounty"
1730-
/>
1731-
<.input
1732-
label="Description"
1733-
field={@bounty_form[:description]}
1734-
type="textarea"
1735-
placeholder="Requirements and acceptance criteria"
1736-
/>
1737-
</div>
1738-
1667+
<.input
1668+
label="URL"
1669+
field={@bounty_form[:url]}
1670+
placeholder="https://github.com/owner/repo/issues/123"
1671+
/>
17391672
<.input label="Amount" icon="tabler-currency-dollar" field={@bounty_form[:amount]} />
17401673
</div>
1741-
<div class="pt-4 ml-auto flex gap-4">
1742-
<.button variant="secondary" phx-click="close_share_drawer" type="button">
1743-
Cancel
1744-
</.button>
1745-
<.button type="submit">
1746-
Share Bounty <.icon name="tabler-arrow-right" class="-mr-1 ml-2 h-4 w-4" />
1747-
</.button>
1748-
</div>
17491674
</.card_content>
17501675
</.card>
1676+
1677+
<div class="pt-4 ml-auto flex gap-4">
1678+
<.button variant="secondary" phx-click="close_share_drawer" type="button">
1679+
Cancel
1680+
</.button>
1681+
<.button type="submit">
1682+
Share Bounty <.icon name="tabler-arrow-right" class="-mr-1 ml-2 h-4 w-4" />
1683+
</.button>
1684+
</div>
17511685
</.form>
17521686
"""
17531687
end
@@ -1863,12 +1797,7 @@ defmodule AlgoraWeb.Org.DashboardLive do
18631797

18641798
defp share_drawer(assigns) do
18651799
~H"""
1866-
<.drawer
1867-
show={@show_share_drawer}
1868-
direction="bottom"
1869-
on_cancel="close_share_drawer"
1870-
class={if @share_drawer_type == "bounty", do: "h-[100svh]"}
1871-
>
1800+
<.drawer show={@show_share_drawer} direction="bottom" on_cancel="close_share_drawer">
18721801
<.share_drawer_header
18731802
:if={@selected_developer}
18741803
selected_developer={@selected_developer}
@@ -1888,7 +1817,6 @@ defmodule AlgoraWeb.Org.DashboardLive do
18881817
bounty_form={@bounty_form}
18891818
tip_form={@tip_form}
18901819
contract_form={@contract_form}
1891-
bounty_form_type={@bounty_form_type}
18921820
/>
18931821
</div>
18941822
<.alert
@@ -1912,7 +1840,6 @@ defmodule AlgoraWeb.Org.DashboardLive do
19121840
bounty_form={@bounty_form}
19131841
tip_form={@tip_form}
19141842
contract_form={@contract_form}
1915-
bounty_form_type={@bounty_form_type}
19161843
/>
19171844
<% end %>
19181845
</div>

lib/algora_web/live/org/repo_nav.ex

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
defmodule AlgoraWeb.Org.RepoNav do
22
@moduledoc false
33
use Phoenix.Component
4+
use AlgoraWeb, :verified_routes
45

6+
import Ecto.Changeset
57
import Phoenix.LiveView
68

9+
alias Algora.Bounties
710
alias Algora.Organizations
11+
alias Algora.Organizations.Member
812
alias AlgoraWeb.Forms.BountyForm
913
alias AlgoraWeb.OrgAuth
1014

15+
require Logger
16+
1117
def on_mount(:default, %{"repo_owner" => repo_owner} = params, _session, socket) do
1218
current_user = socket.assigns[:current_user]
1319
current_org = Organizations.get_org_by(provider_login: repo_owner, provider: "github")

0 commit comments

Comments
 (0)