diff --git a/src/lib/cobs.ts b/src/lib/cobs.ts deleted file mode 100644 index 23519c615..000000000 --- a/src/lib/cobs.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { parseNodeId } from "@app/lib/utils"; - -// Formats COBs Object Ids -export function formatObjectId(id: string): string { - return id.substring(0, 11); -} - -export function stripDidPrefix(array: string[]): string[] { - return array.map(id => id.replace("did:key:", "")); -} - -export function validateTag( - value: string, - items: string[], -): { success: false; error: string } | { success: true } { - if (value.trim().length > 0) { - if (items.includes(value)) { - return { success: false, error: "This tag is already added" }; - } else { - return { success: true }; - } - } - return { success: false, error: "This tag is not valid" }; -} - -export function validateAssignee( - value: string, - items: string[], -): { success: false; error: string } | { success: true } { - const nodeId = parseNodeId(value); - if (nodeId) { - if (items.includes(`${nodeId.prefix}${nodeId.pubkey}`)) { - return { success: false, error: "This assignee is already added" }; - } else { - return { success: true }; - } - } - return { success: false, error: "This assignee is not valid" }; -} diff --git a/src/lib/utils.ts b/src/lib/utils.ts index b58db0164..45de28e46 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -301,3 +301,12 @@ export function createAddRemoveArrays( remove: currentArray.filter(item => !newArray.includes(item)), }; } + +// Formats COBs Object Ids +export function formatObjectId(id: string): string { + return id.substring(0, 11); +} + +export function stripDidPrefix(array: string[]): string[] { + return array.map(id => id.replace("did:key:", "")); +} diff --git a/src/views/projects/Cob/AssigneeInput.svelte b/src/views/projects/Cob/AssigneeInput.svelte new file mode 100644 index 000000000..6b93da126 --- /dev/null +++ b/src/views/projects/Cob/AssigneeInput.svelte @@ -0,0 +1,122 @@ + + + + +
diff --git a/src/views/projects/Cob/CobHeader.svelte b/src/views/projects/Cob/CobHeader.svelte index 12ec4df18..d62e58f8f 100644 --- a/src/views/projects/Cob/CobHeader.svelte +++ b/src/views/projects/Cob/CobHeader.svelte @@ -1,8 +1,10 @@ - - - - diff --git a/src/views/projects/Cob/TagInput.svelte b/src/views/projects/Cob/TagInput.svelte new file mode 100644 index 000000000..760378ba4 --- /dev/null +++ b/src/views/projects/Cob/TagInput.svelte @@ -0,0 +1,122 @@ + + + + + diff --git a/src/views/projects/Issue.svelte b/src/views/projects/Issue.svelte index 468bc6028..74f40089b 100644 --- a/src/views/projects/Issue.svelte +++ b/src/views/projects/Issue.svelte @@ -6,17 +6,15 @@ import * as utils from "@app/lib/utils"; import { HttpdClient } from "@httpd-client"; - import { parseNodeId, formatNodeId } from "@app/lib/utils"; import { sessionStore } from "@app/lib/session"; - import { validateAssignee, validateTag } from "@app/lib/cobs"; + import AssigneeInput from "./Cob/AssigneeInput.svelte"; import Authorship from "@app/components/Authorship.svelte"; - import Avatar from "@app/components/Avatar.svelte"; import Badge from "@app/components/Badge.svelte"; import Button from "@app/components/Button.svelte"; import CobHeader from "@app/views/projects/Cob/CobHeader.svelte"; - import CobSideInput from "./Cob/CobSideInput.svelte"; import CobStateButton from "@app/views/projects/Cob/CobStateButton.svelte"; + import TagInput from "./Cob/TagInput.svelte"; import Textarea from "@app/components/Textarea.svelte"; import Thread from "@app/components/Thread.svelte"; @@ -101,7 +99,11 @@ await api.project.updateIssue( projectId, issue.id, - { type: "tag", add, remove }, + { + type: "tag", + add, + remove, + }, $sessionStore.id, ); issue = await api.project.getIssueById(projectId, issue.id); @@ -120,7 +122,11 @@ await api.project.updateIssue( projectId, issue.id, - { type: "assign", add, remove }, + { + type: "assign", + add: utils.stripDidPrefix(add), + remove: utils.stripDidPrefix(remove), + }, $sessionStore.id, ); issue = await api.project.getIssueById(projectId, issue.id); @@ -176,10 +182,6 @@ margin: 0 0 2.5rem 0; gap: 1rem; } - .tag { - overflow: hidden; - text-overflow: ellipsis; - } @media (max-width: 960px) { .issue { @@ -256,30 +258,10 @@ diff --git a/src/views/projects/Issue/IssueTeaser.svelte b/src/views/projects/Issue/IssueTeaser.svelte index 80824c1bc..5208e726a 100644 --- a/src/views/projects/Issue/IssueTeaser.svelte +++ b/src/views/projects/Issue/IssueTeaser.svelte @@ -1,11 +1,11 @@