mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-20 22:00:43 +08:00
Add issue creation
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
import type { Author } from "@app/lib/cobs";
|
||||
|
||||
import {
|
||||
formatNodeId,
|
||||
formatRadicleId,
|
||||
formatSeedId,
|
||||
formatTimestamp,
|
||||
} from "@app/lib/utils";
|
||||
|
||||
@@ -19,6 +19,11 @@
|
||||
color: var(--color-foreground);
|
||||
padding: 0.125rem 0;
|
||||
}
|
||||
.id {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.caption {
|
||||
color: var(--color-foreground-5);
|
||||
}
|
||||
@@ -32,11 +37,16 @@
|
||||
</style>
|
||||
|
||||
<span class="authorship txt-tiny">
|
||||
<span class="highlight">
|
||||
{window.HEARTWOOD ? formatSeedId(author.id) : formatRadicleId(author.id)}
|
||||
<span class="id highlight layout-desktop">
|
||||
{window.HEARTWOOD ? formatNodeId(author.id) : formatRadicleId(author.id)}
|
||||
</span>
|
||||
<span class="id highlight layout-mobile">
|
||||
{window.HEARTWOOD
|
||||
? formatNodeId(author.id).replace("did:key:", "")
|
||||
: formatRadicleId(author.id)}
|
||||
</span>
|
||||
<span class="caption"> {caption} </span>
|
||||
<span class="txt-tiny date">
|
||||
<span class="date">
|
||||
{formatTimestamp(timestamp)}
|
||||
</span>
|
||||
</span>
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
<script lang="ts">
|
||||
import { createEventDispatcher } from "svelte";
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
export let removeable: boolean = false;
|
||||
export let key: number;
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.chip {
|
||||
display: inline-flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
color: var(--color-secondary);
|
||||
}
|
||||
.section {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0.2rem 0.5rem;
|
||||
}
|
||||
.text {
|
||||
background-color: var(--color-secondary-3);
|
||||
border-radius: var(--border-radius);
|
||||
}
|
||||
.close {
|
||||
color: var(--color-secondary);
|
||||
border: none;
|
||||
border-bottom-right-radius: var(--border-radius);
|
||||
border-top-right-radius: var(--border-radius);
|
||||
background-color: var(--color-secondary-2);
|
||||
line-height: 1.5;
|
||||
cursor: pointer;
|
||||
}
|
||||
.close:hover {
|
||||
background-color: var(--color-secondary-5);
|
||||
color: var(--color-foreground);
|
||||
}
|
||||
.removeable {
|
||||
border-bottom-right-radius: 0;
|
||||
border-top-right-radius: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="chip">
|
||||
<span class="section text" class:removeable><slot name="text" /></span>
|
||||
{#if removeable}
|
||||
<button class="section close" on:click={() => dispatch("remove", key)}>
|
||||
✕
|
||||
</button>
|
||||
{/if}
|
||||
</div>
|
||||
@@ -1,36 +1,17 @@
|
||||
<script lang="ts">
|
||||
import type { Blob } from "@app/lib/project";
|
||||
import type { MaybeBlob } from "@app/lib/project";
|
||||
import type { Comment, Thread } from "@app/lib/issue";
|
||||
|
||||
import Authorship from "@app/components/Authorship.svelte";
|
||||
import Avatar from "@app/components/Comment/Avatar.svelte";
|
||||
import Markdown from "@app/components/Markdown.svelte";
|
||||
import ReactionSelector from "./Comment/ReactionSelector.svelte";
|
||||
import Reactions from "@app/components/Comment/Reactions.svelte";
|
||||
|
||||
export let comment: Comment | Thread;
|
||||
export let caption = "left a comment";
|
||||
export let getImage: (path: string) => Promise<Blob>;
|
||||
|
||||
const templateComment = `<!--
|
||||
Please enter a comment message for your patch update. Leaving this
|
||||
blank is also okay.
|
||||
-->`;
|
||||
export let caption = "commented";
|
||||
export let getImage: (path: string) => Promise<MaybeBlob>;
|
||||
|
||||
$: source = comment.author.id;
|
||||
$: title = comment.author.profile
|
||||
? comment.author.profile.name
|
||||
: comment.author.id;
|
||||
|
||||
const selectReaction = (event: { detail: string }) => {
|
||||
// TODO: Once we allow adding reactions through the http-api, we should call it here.
|
||||
console.debug(event.detail);
|
||||
};
|
||||
|
||||
const incrementReaction = (event: { detail: string }) => {
|
||||
// TODO: Once we allow increment reactions through the http-api, we should call it here.
|
||||
console.debug(event.detail);
|
||||
};
|
||||
$: title = comment.author.id;
|
||||
</script>
|
||||
|
||||
<style>
|
||||
@@ -57,10 +38,7 @@ blank is also okay.
|
||||
.card-body {
|
||||
font-size: var(--font-size-small);
|
||||
padding: 0rem 1rem 1rem 1rem;
|
||||
}
|
||||
.reactions {
|
||||
display: flex;
|
||||
margin-top: 1rem;
|
||||
word-break: break-all;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -74,21 +52,13 @@ blank is also okay.
|
||||
{caption}
|
||||
author={comment.author}
|
||||
timestamp={comment.timestamp} />
|
||||
<ReactionSelector on:select={selectReaction} />
|
||||
</div>
|
||||
<div class="card-body">
|
||||
{#if comment.body.trim() === "" || comment.body.trim() === templateComment}
|
||||
{#if comment.body.trim() === ""}
|
||||
<span class="txt-missing">No description.</span>
|
||||
{:else}
|
||||
<Markdown content={comment.body} {getImage} />
|
||||
{/if}
|
||||
{#if comment.reactions.length > 0}
|
||||
<div class="reactions">
|
||||
<Reactions
|
||||
reactions={comment.reactions}
|
||||
on:click={incrementReaction} />
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
}
|
||||
|
||||
function createContainer(source: string) {
|
||||
source = source.replace("did:key:", "");
|
||||
const seed = source.toLowerCase();
|
||||
const avatar = createIcon({
|
||||
seed,
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
<!-- TODO: Once we are able to add reactions, we should allow people to interact with the reaction handler -->
|
||||
<script lang="ts" strictEvents>
|
||||
import { createEventDispatcher } from "svelte";
|
||||
import Icon from "@app/components/Icon.svelte";
|
||||
import { config } from "@app/lib/config";
|
||||
|
||||
const showReactions = false;
|
||||
|
||||
const dispatch = createEventDispatcher<{ select: string }>();
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.selector {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
position: relative;
|
||||
color: var(--color-foreground-5);
|
||||
border-radius: var(--border-radius);
|
||||
height: 1rem;
|
||||
width: 1rem;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
.selector > div {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.modal {
|
||||
position: absolute;
|
||||
left: 1.5rem;
|
||||
background-color: var(--color-foreground-1);
|
||||
border-radius: var(--border-radius);
|
||||
}
|
||||
.modal > div {
|
||||
padding: 0.5rem;
|
||||
}
|
||||
.modal > div:last-child {
|
||||
border-top-right-radius: var(--border-radius-small);
|
||||
border-bottom-right-radius: var(--border-radius-small);
|
||||
}
|
||||
.modal > div:first-child {
|
||||
border-top-left-radius: var(--border-radius-small);
|
||||
border-bottom-left-radius: var(--border-radius-small);
|
||||
}
|
||||
.modal > div:hover {
|
||||
background-color: var(--color-foreground-2);
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="selector">
|
||||
<Icon name="ellipsis" />
|
||||
{#if showReactions}
|
||||
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
||||
<div class="modal">
|
||||
{#each config.reactions as reaction}
|
||||
<div on:click={() => dispatch("select", reaction)}>
|
||||
{reaction}
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
@@ -1,30 +0,0 @@
|
||||
<script lang="ts" strictEvents>
|
||||
import { createEventDispatcher } from "svelte";
|
||||
import Button from "@app/components/Button.svelte";
|
||||
|
||||
export let reactions: Record<string, number> | null = null;
|
||||
|
||||
const dispatch = createEventDispatcher<{ click: string }>();
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.reactions {
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
</style>
|
||||
|
||||
{#if reactions}
|
||||
<div class="reactions">
|
||||
{#each Object.entries(reactions) as [reaction, count]}
|
||||
<!-- TODO: Remove the disabled attribute once we are able to increment reactions -->
|
||||
<Button
|
||||
variant="foreground"
|
||||
size="tiny"
|
||||
on:click={() => dispatch("click", reaction)}>
|
||||
{reaction}
|
||||
{count}
|
||||
</Button>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
@@ -12,6 +12,7 @@
|
||||
| "ellipsis"
|
||||
| "fork"
|
||||
| "gear"
|
||||
| "chat"
|
||||
| "magnifying-glass"
|
||||
| "moon"
|
||||
| "sun"
|
||||
@@ -70,6 +71,21 @@
|
||||
d="M14 7L17 10V16H10V7H14ZM13
|
||||
8H11V15H16V11H13V8ZM14 8.41421V10H15.5858L14 8.41421ZM8
|
||||
10H9V17H14V18H8V10Z" />
|
||||
{:else if name === "chat"}
|
||||
<path
|
||||
fill-rule="evenodd"
|
||||
clip-rule="evenodd"
|
||||
d="M5 6.5C4.72386 6.5 4.5
|
||||
6.72386 4.5 7V16C4.5 16.2761 4.72386 16.5 5 16.5H14.5147C16.2386 16.5 17.8919
|
||||
17.1848 19.1109 18.4038L19.5 18.7929V7C19.5 6.72386 19.2761 6.5 19 6.5H5ZM3.5
|
||||
7C3.5 6.17157 4.17157 5.5 5 5.5H19C19.8284 5.5 20.5 6.17157 20.5 7V20C20.5
|
||||
20.2022 20.3782 20.3845 20.1913 20.4619C20.0045 20.5393 19.7894 20.4966
|
||||
19.6464 20.3536L18.4038 19.1109C17.3724 18.0795 15.9734 17.5 14.5147
|
||||
17.5H5C4.17157 17.5 3.5 16.8284 3.5 16V7ZM7.5 10C7.5 9.72386 7.72386 9.5 8
|
||||
9.5H16C16.2761 9.5 16.5 9.72386 16.5 10C16.5 10.2761 16.2761 10.5 16
|
||||
10.5H8C7.72386 10.5 7.5 10.2761 7.5 10ZM7.5 13C7.5 12.7239 7.72386 12.5 8
|
||||
12.5H13C13.2761 12.5 13.5 12.7239 13.5 13C13.5 13.2761 13.2761 13.5 13
|
||||
13.5H8C7.72386 13.5 7.5 13.2761 7.5 13Z" />
|
||||
{:else if name === "ellipsis"}
|
||||
<path
|
||||
d="M7 12a2 2 0 1 1-4.001-.001A2 2 0 0 1 7 12zm12-2a2 2 0 1 0 .001
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
export let placeholder: string | undefined = undefined;
|
||||
export let value: string | undefined = undefined;
|
||||
|
||||
export let variant: "regular" | "dashed" = "regular";
|
||||
export let variant: "regular" | "form" = "regular";
|
||||
|
||||
export let autofocus: boolean = false;
|
||||
export let disabled: boolean = false;
|
||||
@@ -76,14 +76,17 @@
|
||||
font-size: var(--font-size-regular);
|
||||
padding: 1rem 1.5rem;
|
||||
}
|
||||
.dashed {
|
||||
border: 1px dashed var(--color-secondary);
|
||||
font-size: var(--font-size-small);
|
||||
padding: 0.5rem 1.25rem;
|
||||
.form {
|
||||
background: var(--color-foreground-1);
|
||||
border-radius: var(--border-radius-small);
|
||||
border: 1px solid var(--color-foreground-1);
|
||||
}
|
||||
.dashed:hover,
|
||||
.dashed:focus {
|
||||
background: var(--color-background-1);
|
||||
.form::placeholder {
|
||||
color: var(--color-foreground-5);
|
||||
}
|
||||
.form:focus,
|
||||
.form:hover {
|
||||
border: 1px solid var(--color-foreground-4);
|
||||
}
|
||||
.left-container {
|
||||
color: var(--color-secondary);
|
||||
@@ -141,7 +144,7 @@
|
||||
|
||||
<input
|
||||
class:regular={variant === "regular"}
|
||||
class:dashed={variant === "dashed"}
|
||||
class:form={variant === "form"}
|
||||
style:padding-left={leftContainerWidth
|
||||
? `${leftContainerWidth}px`
|
||||
: "auto"}
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
<script lang="ts">
|
||||
import { createEventDispatcher } from "svelte";
|
||||
|
||||
export let resizable: boolean = false;
|
||||
export let value: string | number | undefined = undefined;
|
||||
export let placeholder: string | undefined = undefined;
|
||||
|
||||
let textareaElement: HTMLTextAreaElement | undefined = undefined;
|
||||
|
||||
// We either auto-grow the text area, or allow the user to resize it. These
|
||||
// options are mutually exclusive because a user resized textarea would
|
||||
// automatically shrink upon text input otherwise.
|
||||
$: if (textareaElement && !resizable) {
|
||||
// React to changes to the textarea content.
|
||||
value;
|
||||
|
||||
// Reset height to 0px on every value change so that the textarea
|
||||
// immediately shrinks when all text is deleted.
|
||||
textareaElement.style.height = `0px`;
|
||||
textareaElement.style.height = `${textareaElement.scrollHeight}px`;
|
||||
}
|
||||
|
||||
const dispatch = createEventDispatcher<{
|
||||
submit: never;
|
||||
}>();
|
||||
|
||||
function handleKeydown(event: KeyboardEvent) {
|
||||
if (event.key === "Enter") {
|
||||
dispatch("submit");
|
||||
}
|
||||
if (event.key === "Escape") {
|
||||
textareaElement?.blur();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
textarea {
|
||||
background-color: var(--color-foreground-1);
|
||||
border: 1px solid var(--color-foreground-1);
|
||||
color: var(--color-foreground);
|
||||
border-radius: 0.5rem;
|
||||
font-family: inherit;
|
||||
height: 5rem;
|
||||
padding: 1rem;
|
||||
width: 100%;
|
||||
min-height: 2.5rem;
|
||||
resize: none;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.resizable {
|
||||
resize: vertical;
|
||||
overflow: scroll;
|
||||
}
|
||||
|
||||
textarea::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
textarea::-webkit-scrollbar-corner {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
textarea::-webkit-resizer {
|
||||
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAMAAAAolt3jAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAWJQAAFiUBSVIk8AAAAD9QTFRFAAAAZWZmZmZmZmVmZWVmwsLBwsLCZ2ZmwsPCZmdlZWZnwcLBZmZkYGJjw8LDwsPBZmZnZWZkZ2ZkwMDBWFtcNbXb2AAAABV0Uk5TAP///////////////////////1H/YDRrSAAAAFBJREFUeJxVjUESgCAMA2mqAoqK6P/f6kzjIXIos5NumpI8g5LbpJnNQvDl52mWUYTquqnXwstshpHaTi+o+hHXccoKmHVW9yvIxv218ntivmOYAWpLfqaRAAAAAElFTkSuQmCC);
|
||||
background-size: 7px;
|
||||
background-repeat: no-repeat;
|
||||
background-position: bottom 1px right 1px;
|
||||
}
|
||||
|
||||
textarea::placeholder {
|
||||
color: var(--color-foreground-5);
|
||||
}
|
||||
|
||||
textarea:focus,
|
||||
textarea:hover {
|
||||
border: 1px solid var(--color-foreground-4);
|
||||
}
|
||||
</style>
|
||||
|
||||
<textarea
|
||||
bind:this={textareaElement}
|
||||
bind:value
|
||||
class:resizable
|
||||
{placeholder}
|
||||
on:change
|
||||
on:click
|
||||
on:input
|
||||
on:keydown|stopPropagation={handleKeydown}
|
||||
on:keypress />
|
||||
Reference in New Issue
Block a user