diff --git a/package-lock.json b/package-lock.json index 7e682a40e..0d7bc9e7a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,6 +10,7 @@ "dependencies": { "@radicle/gray-matter": "4.1.0", "@wooorm/starry-night": "^1.5.0", + "bs58": "^5.0.0", "buffer": "^6.0.3", "dompurify": "^3.0.0", "hast-util-to-dom": "^3.1.1", @@ -1100,6 +1101,11 @@ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, + "node_modules/base-x": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-4.0.0.tgz", + "integrity": "sha512-FuwxlW4H5kh37X/oW59pwTzzTKRzfrrQwhmyspRM7swOEZcHtDZSCt45U6oKgtuFE+WYPblePMVIPR4RZrh/hw==" + }, "node_modules/base64-js": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", @@ -1150,6 +1156,14 @@ "node": ">=8" } }, + "node_modules/bs58": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-5.0.0.tgz", + "integrity": "sha512-r+ihvQJvahgYT50JD05dyJNKlmmSlMoOGwn1lCcEzanPglg7TxYjioQUYehQ9mAR/+hOSd2jRc/Z2y5UxBymvQ==", + "dependencies": { + "base-x": "^4.0.0" + } + }, "node_modules/buffer": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", diff --git a/package.json b/package.json index 246e9d05c..236ce5604 100644 --- a/package.json +++ b/package.json @@ -43,6 +43,7 @@ "dependencies": { "@radicle/gray-matter": "4.1.0", "@wooorm/starry-night": "^1.5.0", + "bs58": "^5.0.0", "buffer": "^6.0.3", "dompurify": "^3.0.0", "hast-util-to-dom": "^3.1.1", diff --git a/public/index.css b/public/index.css index 0fd76dd35..ca1695da9 100644 --- a/public/index.css +++ b/public/index.css @@ -5,6 +5,7 @@ :root { --border-radius: 0.75rem; + --border-radius-tiny: 0.25rem; --border-radius-small: 0.5rem; --border-radius-round: 10rem; diff --git a/src/components/Authorship.svelte b/src/components/Authorship.svelte index a09324208..7905883ee 100644 --- a/src/components/Authorship.svelte +++ b/src/components/Authorship.svelte @@ -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 @@ - - {window.HEARTWOOD ? formatSeedId(author.id) : formatRadicleId(author.id)} + + {window.HEARTWOOD ? formatNodeId(author.id) : formatRadicleId(author.id)} + + + {window.HEARTWOOD + ? formatNodeId(author.id).replace("did:key:", "") + : formatRadicleId(author.id)}  {caption}  - + {formatTimestamp(timestamp)} diff --git a/src/components/Chip.svelte b/src/components/Chip.svelte new file mode 100644 index 000000000..66033cb15 --- /dev/null +++ b/src/components/Chip.svelte @@ -0,0 +1,52 @@ + + + + +
+ + {#if removeable} + + {/if} +
diff --git a/src/components/Comment.svelte b/src/components/Comment.svelte index 21deaca90..0b7d93e98 100644 --- a/src/components/Comment.svelte +++ b/src/components/Comment.svelte @@ -1,36 +1,17 @@ @@ -74,21 +52,13 @@ blank is also okay. {caption} author={comment.author} timestamp={comment.timestamp} /> -
- {#if comment.body.trim() === "" || comment.body.trim() === templateComment} + {#if comment.body.trim() === ""} No description. {:else} {/if} - {#if comment.reactions.length > 0} -
- -
- {/if}
diff --git a/src/components/Comment/Avatar.svelte b/src/components/Comment/Avatar.svelte index 8fc18bd02..692b35e79 100644 --- a/src/components/Comment/Avatar.svelte +++ b/src/components/Comment/Avatar.svelte @@ -13,6 +13,7 @@ } function createContainer(source: string) { + source = source.replace("did:key:", ""); const seed = source.toLowerCase(); const avatar = createIcon({ seed, diff --git a/src/components/Comment/ReactionSelector.svelte b/src/components/Comment/ReactionSelector.svelte deleted file mode 100644 index 229cad319..000000000 --- a/src/components/Comment/ReactionSelector.svelte +++ /dev/null @@ -1,63 +0,0 @@ - - - - - -
- - {#if showReactions} - - - {/if} -
diff --git a/src/components/Comment/Reactions.svelte b/src/components/Comment/Reactions.svelte deleted file mode 100644 index ac4255bf3..000000000 --- a/src/components/Comment/Reactions.svelte +++ /dev/null @@ -1,30 +0,0 @@ - - - - -{#if reactions} -
- {#each Object.entries(reactions) as [reaction, count]} - - - {/each} -
-{/if} diff --git a/src/components/Icon.svelte b/src/components/Icon.svelte index be1d7d8f3..d9eb2ed45 100644 --- a/src/components/Icon.svelte +++ b/src/components/Icon.svelte @@ -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"} + {:else if name === "ellipsis"} + 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(); + } + } + + + + +