diff --git a/src/components/CheckoutPatchButton.svelte b/src/components/CheckoutPatchButton.svelte new file mode 100644 index 000000000..18024c0e5 --- /dev/null +++ b/src/components/CheckoutPatchButton.svelte @@ -0,0 +1,48 @@ + + + + {#snippet toggle(onclick)} + + {/snippet} + {#snippet popover()} + + + To checkout this patch in your working copy, run: + + + + {/snippet} + diff --git a/src/components/CheckoutRepoButton.svelte b/src/components/CheckoutRepoButton.svelte new file mode 100644 index 000000000..aa03bd743 --- /dev/null +++ b/src/components/CheckoutRepoButton.svelte @@ -0,0 +1,37 @@ + + + + {#snippet toggle(onclick)} + + {/snippet} + + {#snippet popover()} + + + To checkout a working copy of this repo, run: + + + + {/snippet} + diff --git a/src/components/Command.svelte b/src/components/Command.svelte index a58455c95..3163fa470 100644 --- a/src/components/Command.svelte +++ b/src/components/Command.svelte @@ -21,7 +21,7 @@ } -
+
clipboard.copy()} diff --git a/src/components/Header.svelte b/src/components/Header.svelte index 56e11c0b6..f29f923b5 100644 --- a/src/components/Header.svelte +++ b/src/components/Header.svelte @@ -1,29 +1,21 @@
@@ -129,122 +112,8 @@ {@render center?.()}
- - {#snippet toggle(onclick)} - - - - {/snippet} - {#snippet popover()} - -
-
- Getting started -
-
- Hello - , - - your identity has been created and stored on your machine. -
-
- Your public key is - {truncateDid(config.publicKey)} - - you can share this with anyone to find you on the network. -
-
- {#if radicleInstalled()} -
- Radicle CLI is setup -
- {:else} -
-
- Make sure to install - Radicle CLI -
-
- To be able to interact with repos on the Radicle network - you'll need to install a node on your computer. This node - will identify itself on the network with your keys to push - and pull changes. -
-
- To install the node and other Radicle CLI tooling, simply - run the command below from your shell: -
- -
- {/if} -
-
Guide
- - -
- {/snippet} -
- - {#snippet toggle(onclick)} - - {#if $nodeRunning} - - Online - {:else} - - Offline - {/if} - - {/snippet} - {#snippet popover()} - -
- {#if $nodeRunning} - Your node is up and running, your changes will be synced - automatically. - {:else} - Your node is not running, changes you make are safe but won't - be announced. - {/if} -
-
- {/snippet} -
+ + + import type { Config } from "@bindings/config/Config"; + + import { didFromPublicKey, truncateDid } from "@app/lib/utils"; + import { radicleInstalled } from "@app/lib/checkRadicleCLI.svelte"; + + import Border from "@app/components/Border.svelte"; + import Command from "@app/components/Command.svelte"; + import CopyableId from "@app/components/CopyableId.svelte"; + import Icon from "@app/components/Icon.svelte"; + import NakedButton from "@app/components/NakedButton.svelte"; + import NodeId from "@app/components/NodeId.svelte"; + import Popover from "@app/components/Popover.svelte"; + import RepoGuide from "@app/components/RepoGuide.svelte"; + + interface Props { + config: Config; + } + const { config }: Props = $props(); + + + + + + {#snippet toggle(onclick)} + + + + {/snippet} + {#snippet popover()} + +
+
+ Getting started +
+
+ Hello + , + + your identity has been created and stored on your machine. +
+
+ Your public key is + {truncateDid(config.publicKey)} + + you can share this with anyone to find you on the network. +
+
+ {#if radicleInstalled()} +
+ Radicle CLI is setup +
+ {:else} +
+
+ Make sure to install Radicle CLI +
+
+ To be able to interact with repos on the Radicle network you'll + need to install a node on your computer. This node will identify + itself on the network with your keys to push and pull changes. +
+
+ To install the node and other Radicle CLI tooling, simply run the + command below from your shell: +
+ +
+ {/if} +
+
Guide
+ + +
+ {/snippet} +
diff --git a/src/components/IssueSecondColumn.svelte b/src/components/IssueSecondColumn.svelte index 7927a5ff2..c9d6eed44 100644 --- a/src/components/IssueSecondColumn.svelte +++ b/src/components/IssueSecondColumn.svelte @@ -1,40 +1,35 @@ + +{#snippet iconSnippet(status: IssueStatus)} +
+ +
+{/snippet} + +{#snippet counterSnippet(status: IssueStatus)} +
+ {#if status === "all"} + {counters.open + counters.closed} + {:else} + {counters[status]} + {/if} +
+{/snippet} + + + {#snippet toggle(onclick)} + + {@render iconSnippet(status)} + {capitalize(status)} + {@render counterSnippet(status)} + + + {/snippet} + + {#snippet popover()} + + + {#snippet item(state)} + { + changeFilter(state); + closeFocused(); + }}> + {@render iconSnippet(state)} + {capitalize(state)} + {@render counterSnippet(state)} + + {/snippet} + + + {/snippet} + diff --git a/src/components/NodeStatusButton.svelte b/src/components/NodeStatusButton.svelte new file mode 100644 index 000000000..45c420e48 --- /dev/null +++ b/src/components/NodeStatusButton.svelte @@ -0,0 +1,43 @@ + + + + {#snippet toggle(onclick)} + + {#if $nodeRunning} + + Online + {:else} + + Offline + {/if} + + {/snippet} + {#snippet popover()} + +
+ {#if $nodeRunning} + Your node is up and running, your changes will be synced + automatically. + {:else} + Your node is not running, changes you make are safe but won't be + announced. + {/if} +
+
+ {/snippet} +
diff --git a/src/components/PatchStateFilterButton.svelte b/src/components/PatchStateFilterButton.svelte new file mode 100644 index 000000000..18118bcf8 --- /dev/null +++ b/src/components/PatchStateFilterButton.svelte @@ -0,0 +1,77 @@ + + +{#snippet iconSnippet(status: PatchStatus | undefined)} +
+ +
+{/snippet} + +{#snippet counterSnippet(status: PatchStatus | undefined)} +
+ {#if status} + {counters[status]} + {:else} + {counters.draft + counters.open + counters.archived + counters.merged} + {/if} +
+{/snippet} + + + {#snippet toggle(onclick)} + + {@render iconSnippet(status)} + {status ? capitalize(status) : "All"} + {@render counterSnippet(status)} + + + {/snippet} + + {#snippet popover()} + + + {#snippet item(state)} + { + await select(state); + closeFocused(); + }}> + {@render iconSnippet(state)} + {state ? capitalize(state) : "All"} + {@render counterSnippet(state)} + + {/snippet} + + + {/snippet} + diff --git a/src/views/home/guides/Repos.svelte b/src/components/RepoGuide.svelte similarity index 91% rename from src/views/home/guides/Repos.svelte rename to src/components/RepoGuide.svelte index a201ed6f7..d67b86c3d 100644 --- a/src/views/home/guides/Repos.svelte +++ b/src/components/RepoGuide.svelte @@ -1,12 +1,14 @@ + + + {#snippet toggle(onclick)} + + + Review + + {/snippet} + + {#snippet popover()} + +
+ { + const newReview = await createReview(); + if (newReview) { + await push({ + resource: "repo.patch", + rid, + patch: patchId, + status, + reviewId: newReview.id, + }); + } + closeFocused(); + }}> + + + Write Review + + + { + await createReview("reject"); + await loadPatch(); + closeFocused(); + }}> + + + Reject + + + { + await createReview("accept"); + await loadPatch(); + closeFocused(); + }}> + + + Accept + + + +
+ +
+
+
+ Clicking the buttons will create a blank review, add comments, a + summary, and your verdict after. Depending on your sync settings your + review might be published to the network right away. We are actively + working on draft reviews, stay tuned. +
+
+
+ {/snippet} +
diff --git a/src/components/Reviews.svelte b/src/components/Reviews.svelte index 6380f8177..5f2c8c9b3 100644 --- a/src/components/Reviews.svelte +++ b/src/components/Reviews.svelte @@ -6,43 +6,29 @@ import type { Verdict } from "@bindings/cob/patch/Verdict"; import { announce } from "@app/components/AnnounceSwitch.svelte"; - import { closeFocused } from "./Popover.svelte"; - import { didFromPublicKey } from "@app/lib/utils"; import { invoke } from "@app/lib/invoke"; import { nodeRunning } from "@app/lib/events"; - import { push } from "@app/lib/router"; - import Border from "@app/components/Border.svelte"; import Icon from "@app/components/Icon.svelte"; import NakedButton from "@app/components/NakedButton.svelte"; - import OutlineButton from "@app/components/OutlineButton.svelte"; - import Popover from "@app/components/Popover.svelte"; + import ReviewButton from "@app/components/ReviewButton.svelte"; import ReviewTeaser from "@app/components/ReviewTeaser.svelte"; interface Props { - rid: string; + config: Config; + loadPatch: () => Promise; patchId: string; revision: Revision; - config: Config; + rid: string; status: PatchStatus | undefined; - loadPatch: () => Promise; } - const { rid, patchId, revision, config, status, loadPatch }: Props = $props(); + const { config, loadPatch, patchId, revision, rid, status }: Props = $props(); let hideReviews = $state( revision.reviews === undefined || revision.reviews.length === 0, ); - const hasOwnReview = $derived( - Boolean( - revision.reviews && - revision.reviews.some( - value => value.author.did === didFromPublicKey(config.publicKey), - ), - ), - ); - $effect(() => { // eslint-disable-next-line @typescript-eslint/no-unused-expressions patchId; @@ -96,105 +82,14 @@
- - {#snippet toggle(onclick)} - - - Review - - {/snippet} - - {#snippet popover()} - -
- { - const newReview = await createReview(); - if (newReview) { - await push({ - resource: "repo.patch", - rid, - patch: patchId, - status, - reviewId: newReview.id, - }); - } - closeFocused(); - }}> - - - Write Review - - - { - await createReview("reject"); - await loadPatch(); - closeFocused(); - }}> - - - Reject - - - { - await createReview("accept"); - await loadPatch(); - closeFocused(); - }}> - - - Accept - - - -
- -
-
-
- Clicking the buttons will create a blank review, add comments, a - summary, and your verdict after. Depending on your sync settings - your review might be published to the network right away. We are - actively working on draft reviews, stay tuned. -
-
-
- {/snippet} -
+
diff --git a/src/views/repo/Patch.svelte b/src/views/repo/Patch.svelte index 9e91da011..f74225729 100644 --- a/src/views/repo/Patch.svelte +++ b/src/views/repo/Patch.svelte @@ -10,7 +10,6 @@ import type { Review } from "@bindings/cob/patch/Review"; import type { Revision } from "@bindings/cob/patch/Revision"; - import capitalize from "lodash/capitalize"; import fuzzysort from "fuzzysort"; import * as roles from "@app/lib/roles"; @@ -28,11 +27,8 @@ import AssigneeInput from "@app/components/AssigneeInput.svelte"; import Border from "@app/components/Border.svelte"; - import Button from "@app/components/Button.svelte"; - import Command from "@app/components/Command.svelte"; + import CheckoutPatchButton from "@app/components/CheckoutPatchButton.svelte"; import CopyableId from "@app/components/CopyableId.svelte"; - import DropdownList from "@app/components/DropdownList.svelte"; - import DropdownListItem from "@app/components/DropdownListItem.svelte"; import EditableTitle from "@app/components/EditableTitle.svelte"; import Icon from "@app/components/Icon.svelte"; import LabelInput from "@app/components/LabelInput.svelte"; @@ -40,11 +36,10 @@ import Link from "@app/components/Link.svelte"; import NakedButton from "@app/components/NakedButton.svelte"; import NewPatchButton from "@app/components/NewPatchButton.svelte"; - import OutlineButton from "@app/components/OutlineButton.svelte"; import PatchStateButton from "@app/components/PatchStateButton.svelte"; + import PatchStateFilterButton from "@app/components/PatchStateFilterButton.svelte"; import PatchTeaser from "@app/components/PatchTeaser.svelte"; import PatchTimeline from "@app/components/PatchTimeline.svelte"; - import Popover, { closeFocused } from "@app/components/Popover.svelte"; import ReviewComponent from "@app/components/Review.svelte"; import RevisionBadges from "@app/components/RevisionBadges.svelte"; import RevisionComponent from "@app/components/Revision.svelte"; @@ -104,13 +99,6 @@ more = patches.more; }); - const checkoutCommand = $derived.by(() => { - if (tab === "revisions" && selectedRevision.id !== patch.id) { - return `rad patch checkout ${formatOid(patch.id)} --revision ${formatOid(selectedRevision.id)}`; - } else { - return `rad patch checkout ${formatOid(patch.id)}`; - } - }); const project = $derived(repo.payloads["xyz.radicle.project"]!); async function updateTitle(newTitle: string) { @@ -334,28 +322,6 @@ } -{#snippet icons(status: PatchStatus | undefined)} -
- -
-{/snippet} - -{#snippet counters(status: PatchStatus | undefined)} -
- {#if status} - {project.meta.patches[status]} - {:else} - {project.meta.patches.draft + - project.meta.patches.open + - project.meta.patches.archived + - project.meta.patches.merged} - {/if} -
-{/snippet} - {#snippet headerCenter()} @@ -410,44 +376,12 @@
{#if showFilters}
- - {#snippet toggle(onclick)} - - {@render icons(status)} - {status ? capitalize(status) : "All"} - {@render counters(status)} - - - {/snippet} - - {#snippet popover()} - - - {#snippet item(state)} - { - await loadPatches(state); - closeFocused(); - }}> - {@render icons(state)} - {state ? capitalize(state) : "All"} - {@render counters(state)} - - {/snippet} - - - {/snippet} - + { + await loadPatches(selectedState); + }} /> {#if patchTeasers.length > 0} { @@ -562,28 +496,11 @@ allowedToEdit={true} title={patch.title} cobId={patch.id} /> -
- - {#snippet toggle(onclick)} - - {/snippet} - {#snippet popover()} - - To checkout this patch in your working copy, run: - - - {/snippet} - +
+
diff --git a/src/views/repo/RepoHome.svelte b/src/views/repo/RepoHome.svelte index 7d81079ac..cc94d0fca 100644 --- a/src/views/repo/RepoHome.svelte +++ b/src/views/repo/RepoHome.svelte @@ -1,18 +1,16 @@