Initial commit on Forgejo
Fresh repository history for elektrine/tarakan hosted at https://git.elektrine.com/elektrine/tarakan.
This commit is contained in:
commit
af6077b9c3
455 changed files with 78366 additions and 0 deletions
163
lib/tarakan_web/live/repository_commits_live.html.heex
Normal file
163
lib/tarakan_web/live/repository_commits_live.html.heex
Normal file
|
|
@ -0,0 +1,163 @@
|
|||
<Layouts.app flash={@flash} current_scope={@current_scope} current_path={assigns[:current_path]}>
|
||||
<Layouts.page>
|
||||
<.repository_header repository={@repository} active_tab={:commits} />
|
||||
|
||||
<section
|
||||
:if={@live_action == :index and @branch_options != []}
|
||||
id="commits-reference"
|
||||
class="mt-4 flex flex-col gap-3 rounded-md border border-rule bg-panel px-3 py-2.5 sm:flex-row sm:items-center sm:justify-between"
|
||||
>
|
||||
<form id="commits-branch-form" phx-change="select_branch" class="min-w-0">
|
||||
<label for="commits-branch-select" class="sr-only">Branch</label>
|
||||
<select
|
||||
id="commits-branch-select"
|
||||
name="branch"
|
||||
class="max-w-[14rem] truncate rounded-md border border-rule bg-ground px-2.5 py-1.5 font-mono text-[11px] text-ink focus:border-signal focus:outline-none"
|
||||
>
|
||||
<option
|
||||
:for={branch <- @branch_options}
|
||||
value={branch}
|
||||
selected={branch == @selected_branch}
|
||||
>
|
||||
{branch}{if branch == @repository.default_branch, do: " (default)", else: ""}
|
||||
</option>
|
||||
</select>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
<div
|
||||
:if={@view_state == :loading}
|
||||
id="commits-loading"
|
||||
class="mt-4 border border-rule px-5 py-8 text-center"
|
||||
aria-live="polite"
|
||||
>
|
||||
<.icon name="hero-arrow-path" class="mx-auto size-5 text-ink-faint" />
|
||||
<p class="mt-4 font-display text-sm uppercase tracking-[0.12em] text-ink">
|
||||
Loading commit history
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<section
|
||||
:if={@view_state == :error}
|
||||
id="commits-error"
|
||||
class="mt-4 border border-rule px-6 py-8 text-center"
|
||||
aria-live="polite"
|
||||
>
|
||||
<.icon name="hero-clock" class="mx-auto size-7 text-ink-faint" />
|
||||
<h2 class="mt-4 font-display text-lg uppercase tracking-[0.12em] text-ink">
|
||||
{error_title(@error_kind)}
|
||||
</h2>
|
||||
<p class="mx-auto mt-2 max-w-lg text-sm leading-6 text-ink-muted">
|
||||
{error_message(@error_kind)}
|
||||
</p>
|
||||
<button
|
||||
:if={@error_kind not in [:empty_repository, :not_found]}
|
||||
id="retry-commits"
|
||||
type="button"
|
||||
phx-click="retry"
|
||||
class="mt-5 border border-strong px-4 py-2 font-display text-xs uppercase tracking-[0.12em] text-ink transition hover:bg-panel"
|
||||
>
|
||||
Retry
|
||||
</button>
|
||||
</section>
|
||||
|
||||
<%= if @live_action == :index and @view_state == :ready do %>
|
||||
<section id="commits" class="mt-4 overflow-hidden rounded-md border border-rule">
|
||||
<div id="commits-list" phx-update="stream" class="divide-y divide-rule">
|
||||
<.link
|
||||
:for={{id, commit} <- @streams.commits}
|
||||
id={id}
|
||||
navigate={RepositoryPaths.repository_commit_path(@repository, commit.sha)}
|
||||
class="grid grid-cols-[minmax(0,1fr)_auto] items-center gap-4 px-4 py-3 transition-colors hover:bg-panel"
|
||||
>
|
||||
<div class="min-w-0">
|
||||
<p class="truncate text-sm text-ink">{commit.subject}</p>
|
||||
<p class="mt-1 truncate font-mono text-[11px] text-ink-faint">
|
||||
<span class="text-ink-muted">{commit.author_name}</span>
|
||||
<span aria-hidden="true"> · </span>
|
||||
{commit_datetime(commit.committed_at)}
|
||||
</p>
|
||||
</div>
|
||||
<span class="shrink-0 font-mono text-[11px] text-ink-faint">
|
||||
{short_sha(commit.sha)}
|
||||
</span>
|
||||
</.link>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<div :if={@has_more?} class="mt-4 text-center">
|
||||
<button
|
||||
id="commits-load-more"
|
||||
type="button"
|
||||
phx-click="load_more"
|
||||
class="border border-strong px-4 py-2 font-display text-xs uppercase tracking-[0.12em] text-ink transition hover:bg-panel"
|
||||
>
|
||||
Load more
|
||||
</button>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= if @live_action == :show and @view_state == :ready do %>
|
||||
<section id="commit-detail" class="mt-4 overflow-hidden rounded-md border border-rule">
|
||||
<header class="border-b border-rule bg-panel px-4 py-3">
|
||||
<h2 id="commit-subject" class="break-words text-sm font-semibold text-ink">
|
||||
{@commit.subject}
|
||||
</h2>
|
||||
<p class="mt-1 flex flex-wrap items-center gap-x-2 font-mono text-[11px] text-ink-faint">
|
||||
<span class="text-ink-muted">{@commit.author_name}</span>
|
||||
<span aria-hidden="true">·</span>
|
||||
<span>{commit_datetime(@commit.committed_at)}</span>
|
||||
<span aria-hidden="true">·</span>
|
||||
<span id="commit-detail-sha" title={@commit.sha}>{short_sha(@commit.sha)}</span>
|
||||
</p>
|
||||
</header>
|
||||
|
||||
<div
|
||||
:if={@commit.body}
|
||||
id="commit-body"
|
||||
class="whitespace-pre-wrap border-b border-rule px-4 py-3 text-sm leading-6 text-ink"
|
||||
phx-no-format
|
||||
>{@commit.body}</div>
|
||||
|
||||
<div class="flex items-center justify-between gap-4 border-b border-rule px-4 py-2.5">
|
||||
<span class="font-mono text-[10px] uppercase tracking-[0.12em] text-ink-faint">
|
||||
Patch
|
||||
</span>
|
||||
<.link
|
||||
id="commit-browse-code"
|
||||
navigate={RepositoryPaths.repository_code_path(@repository, @commit.sha)}
|
||||
class="inline-flex items-center gap-1.5 font-mono text-[11px] text-ink-muted transition hover:text-signal"
|
||||
>
|
||||
Browse code at this commit <.icon name="hero-arrow-up-right" class="size-3.5" />
|
||||
</.link>
|
||||
</div>
|
||||
|
||||
<div
|
||||
:if={@commit.patch == ""}
|
||||
id="commit-patch-empty"
|
||||
class="px-4 py-6 text-center text-sm text-ink-faint"
|
||||
>
|
||||
No textual changes in this commit.
|
||||
</div>
|
||||
|
||||
<div :if={@commit.patch != ""} id="commit-patch" class="overflow-x-auto">
|
||||
<div id="commit-patch-lines" class="min-w-max py-2">
|
||||
<div
|
||||
:for={{type, text} <- diff_lines(@commit.patch)}
|
||||
class={["whitespace-pre px-4 font-mono text-xs leading-5", diff_line_class(type)]}
|
||||
phx-no-format
|
||||
>{text}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
:if={@commit.patch_truncated or diff_line_over_limit?(@commit.patch)}
|
||||
id="commit-patch-truncated"
|
||||
class="border-t border-rule px-4 py-2.5 text-xs text-ink-muted"
|
||||
>
|
||||
This patch is too large to show in full; the beginning is shown above.
|
||||
</div>
|
||||
</section>
|
||||
<% end %>
|
||||
</Layouts.page>
|
||||
</Layouts.app>
|
||||
Loading…
Add table
Add a link
Reference in a new issue