Browse Source

feat(PrPage): always show reply compose

to intice users to login and reply
master
DanConwayDev 2 years ago
parent
commit
8273f3472d
No known key found for this signature in database
GPG Key ID: 68E15486D73F75E1
  1. 6
      src/lib/components/events/Compose.svelte
  2. 8
      src/lib/wrappers/Compose.svelte
  3. 38
      src/routes/repo/[repo_id]/pr/[pr_id]/+page.svelte

6
src/lib/components/events/Compose.svelte

@ -1,7 +1,11 @@ @@ -1,7 +1,11 @@
<script lang="ts">
import { login } from '$lib/stores/users'
export let sendReply: (content: string) => void = () => {}
export let submitting = false
export let logged_in = false
let submit = () => {
if (!logged_in) login()
sendReply(content)
}
let content = ''
@ -23,6 +27,8 @@ @@ -23,6 +27,8 @@
>
{#if submitting}
Sending
{:else if !logged_in}
Login before Sending
{:else}
Send
{/if}

8
src/lib/wrappers/Compose.svelte

@ -19,11 +19,7 @@ @@ -19,11 +19,7 @@
repo_id = $selected_repo.repo_id
pr_id = $selected_pr_full.summary.id
edit_mode =
$logged_in_user !== undefined &&
repo_id.length > 0 &&
pr_id.length > 0 &&
!submitted
edit_mode = repo_id.length > 0 && pr_id.length > 0 && !submitted
}
async function sendReply(content: string) {
@ -77,7 +73,7 @@ @@ -77,7 +73,7 @@
</script>
{#if edit_mode}
<Compose {sendReply} {submitting} />
<Compose {sendReply} {submitting} logged_in={!!$logged_in_user} />
{/if}
{#if submitted}
<div>sent!</div>

38
src/routes/repo/[repo_id]/pr/[pr_id]/+page.svelte

@ -63,17 +63,7 @@ @@ -63,17 +63,7 @@
<Container>
<div class="md:flex">
<div class="md:mr-2 md:w-2/3">
<div class="prose my-3">
{#if $selected_pr_full.pr_event && $selected_pr_full.pr_event.kind === patch_kind}
<Patch
content={$selected_pr_full.pr_event.content}
tags={$selected_pr_full.pr_event.tags}
/>
{:else}
<ParsedContent content={$selected_pr_full.summary.descritpion} />
{/if}
</div>
<div role="alert" class="alert">
<div role="alert" class="alert mt-3">
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
@ -87,17 +77,27 @@ @@ -87,17 +77,27 @@
></path></svg
>
<div>
<h3 class="prose text-xs">
to view the latest patches from this PR <a href="/ngit"
>install ngit</a
>, run
<span class="rounded bg-neutral p-1 font-mono"
><span class="py-3">ngit prs list</span></span
> from the local repository and select this PR title
<h3 class="prose mb-2 text-sm font-bold">
view proposal in local git repository
</h3>
<p class="prose text-xs">
<a href="/ngit">install ngit</a>, run
<span class="rounded bg-neutral p-1 font-mono"
><span class="py-3">ngit list</span></span
> from the local repository and select the proposal title
</p>
</div>
</div>
<div class="prose my-3">
{#if $selected_pr_full.pr_event && $selected_pr_full.pr_event.kind === patch_kind}
<Patch
content={$selected_pr_full.pr_event.content}
tags={$selected_pr_full.pr_event.tags}
/>
{:else}
<ParsedContent content={$selected_pr_full.summary.descritpion} />
{/if}
</div>
{#each $selected_pr_replies as event}
<Thread {event} replies={[]} />
{/each}

Loading…
Cancel
Save