From 9355186920fffd60295ee41806a843b1e69f4be3 Mon Sep 17 00:00:00 2001 From: muhtimur Date: Mon, 14 Nov 2022 13:00:30 +0700 Subject: [PATCH 1/6] Allow to create new team Signed-off-by: muhtimur --- packages/core/src/classes.ts | 1 + plugins/tracker-assets/assets/icons.svg | 3 + plugins/tracker-assets/lang/en.json | 5 ++ plugins/tracker-assets/lang/ru.json | 5 ++ plugins/tracker-assets/src/index.ts | 1 + .../src/components/teams/CreateTeam.svelte | 84 +++++++++++++++++++ .../components/teams/TeamIconChooser.svelte | 41 +++++++++ plugins/tracker-resources/src/index.ts | 5 +- plugins/tracker-resources/src/plugin.ts | 5 ++ plugins/tracker/src/index.ts | 2 +- .../src/components/navigator/SpacesNav.svelte | 2 +- 11 files changed, 151 insertions(+), 3 deletions(-) create mode 100644 plugins/tracker-resources/src/components/teams/CreateTeam.svelte create mode 100644 plugins/tracker-resources/src/components/teams/TeamIconChooser.svelte diff --git a/packages/core/src/classes.ts b/packages/core/src/classes.ts index 6eba3d35827..d965c87cb19 100644 --- a/packages/core/src/classes.ts +++ b/packages/core/src/classes.ts @@ -271,6 +271,7 @@ export interface Space extends Doc { private: boolean members: Arr> archived: boolean + icon?: Asset } /** diff --git a/plugins/tracker-assets/assets/icons.svg b/plugins/tracker-assets/assets/icons.svg index 6c6793dc666..6072eebb6d9 100644 --- a/plugins/tracker-assets/assets/icons.svg +++ b/plugins/tracker-assets/assets/icons.svg @@ -50,6 +50,9 @@ + + + diff --git a/plugins/tracker-assets/lang/en.json b/plugins/tracker-assets/lang/en.json index e899fda7b1d..05a098b119c 100644 --- a/plugins/tracker-assets/lang/en.json +++ b/plugins/tracker-assets/lang/en.json @@ -40,6 +40,11 @@ "Completed": "Completed", "Canceled": "Canceled", "CreateTeam": "Create team", + "NewTeam": "New team", + "TeamTitlePlaceholder": "Team title", + "MakePrivate": "Make private", + "MakePrivateDescription": "Only members can see it", + "ChooseIcon": "Choose icon", "AddIssue": "Add Issue", "NewIssue": "New issue", "ResumeDraft": "Resume draft", diff --git a/plugins/tracker-assets/lang/ru.json b/plugins/tracker-assets/lang/ru.json index 14fd5b548d0..b3cd0551949 100644 --- a/plugins/tracker-assets/lang/ru.json +++ b/plugins/tracker-assets/lang/ru.json @@ -40,6 +40,11 @@ "Completed": "Завершен", "Canceled": "Отменено", "CreateTeam": "Создать команду", + "NewTeam": "Новая команда", + "TeamTitlePlaceholder": "Название команды", + "MakePrivate": "Сделать личным", + "MakePrivateDescription": "Только пользователи могут видеть это", + "ChooseIcon": "Выбрать иконку", "AddIssue": "Добавить задачу", "NewIssue": "Новая задача", "ResumeDraft": "Восстановить черновик", diff --git a/plugins/tracker-assets/src/index.ts b/plugins/tracker-assets/src/index.ts index c3be3fc5009..95dd44ff6c9 100644 --- a/plugins/tracker-assets/src/index.ts +++ b/plugins/tracker-assets/src/index.ts @@ -31,6 +31,7 @@ loadMetadata(tracker.icon, { NewIssue: `${icons}#newissue`, Magnifier: `${icons}#magnifier`, Home: `${icons}#home`, + RedCircle: `${icons}#red-circle`, Labels: `${icons}#priority-nopriority`, // TODO: add icon DueDate: `${icons}#inbox`, // TODO: add icon Parent: `${icons}#myissues`, // TODO: add icon diff --git a/plugins/tracker-resources/src/components/teams/CreateTeam.svelte b/plugins/tracker-resources/src/components/teams/CreateTeam.svelte new file mode 100644 index 00000000000..ab3a6e850d2 --- /dev/null +++ b/plugins/tracker-resources/src/components/teams/CreateTeam.svelte @@ -0,0 +1,84 @@ + + + + 0} + on:close={() => { + dispatch('close') + }} +> + + + +
+
+
+
+
diff --git a/plugins/tracker-resources/src/components/teams/TeamIconChooser.svelte b/plugins/tracker-resources/src/components/teams/TeamIconChooser.svelte new file mode 100644 index 00000000000..25d113b20f5 --- /dev/null +++ b/plugins/tracker-resources/src/components/teams/TeamIconChooser.svelte @@ -0,0 +1,41 @@ + + + { + dispatch('close') + }} +> +
+ {#each icons as obj} +
+
+ {/each} +
+
diff --git a/plugins/tracker-resources/src/index.ts b/plugins/tracker-resources/src/index.ts index 6ad18eb74fa..5ed03de3b4b 100644 --- a/plugins/tracker-resources/src/index.ts +++ b/plugins/tracker-resources/src/index.ts @@ -94,6 +94,8 @@ import IssueTemplates from './components/templates/IssueTemplates.svelte' import EditIssueTemplate from './components/templates/EditIssueTemplate.svelte' import TemplateEstimationEditor from './components/templates/EstimationEditor.svelte' +import CreateTeam from './components/teams/CreateTeam.svelte' + export async function queryIssue ( _class: Ref>, client: Client, @@ -216,7 +218,8 @@ export default async (): Promise => ({ IssueTemplates, IssueTemplatePresenter, EditIssueTemplate, - TemplateEstimationEditor + TemplateEstimationEditor, + CreateTeam }, completion: { IssueQuery: async (client: Client, query: string, filter?: { in?: RelatedDocument[], nin?: RelatedDocument[] }) => diff --git a/plugins/tracker-resources/src/plugin.ts b/plugins/tracker-resources/src/plugin.ts index 2dabaea0634..fa8ea2da0b7 100644 --- a/plugins/tracker-resources/src/plugin.ts +++ b/plugins/tracker-resources/src/plugin.ts @@ -60,6 +60,11 @@ export default mergeIds(trackerId, tracker, { Completed: '' as IntlString, Canceled: '' as IntlString, CreateTeam: '' as IntlString, + NewTeam: '' as IntlString, + TeamTitlePlaceholder: '' as IntlString, + MakePrivate: '' as IntlString, + MakePrivateDescription: '' as IntlString, + ChooseIcon: '' as IntlString, AddIssue: '' as IntlString, NewIssue: '' as IntlString, ResumeDraft: '' as IntlString, diff --git a/plugins/tracker/src/index.ts b/plugins/tracker/src/index.ts index 472faad773d..b18a0d403a5 100644 --- a/plugins/tracker/src/index.ts +++ b/plugins/tracker/src/index.ts @@ -59,7 +59,6 @@ export interface IssueStatusCategory extends Doc { * @public */ export interface Team extends Space { - teamLogo?: string | null identifier: string // Team identifier sequence: number issueStatuses: number @@ -413,6 +412,7 @@ export default plugin(trackerId, { NewIssue: '' as Asset, Magnifier: '' as Asset, Home: '' as Asset, + RedCircle: '' as Asset, Labels: '' as Asset, DueDate: '' as Asset, Parent: '' as Asset, diff --git a/plugins/workbench-resources/src/components/navigator/SpacesNav.svelte b/plugins/workbench-resources/src/components/navigator/SpacesNav.svelte index 6693aff9f12..df80a1594ec 100644 --- a/plugins/workbench-resources/src/components/navigator/SpacesNav.svelte +++ b/plugins/workbench-resources/src/components/navigator/SpacesNav.svelte @@ -114,7 +114,7 @@ getParentActions()} indent={'ml-2'}> {#each spaces as space (space._id)} {#if model.specials} - getActions(space)}> + getActions(space)}> {#each model.specials as special} Date: Tue, 15 Nov 2022 00:42:29 +0700 Subject: [PATCH 2/6] Add team presenter Signed-off-by: muhtimur --- packages/core/src/classes.ts | 2 +- plugins/tracker-resources/package.json | 3 +- .../src/components/teams/CreateTeam.svelte | 6 ++- .../src/components/teams/TeamPresenter.svelte | 44 +++++++++++++++++++ plugins/tracker/src/index.ts | 1 + .../src/components/navigator/SpacesNav.svelte | 22 ++++++++-- plugins/workbench-resources/src/index.ts | 2 + 7 files changed, 73 insertions(+), 7 deletions(-) create mode 100644 plugins/tracker-resources/src/components/teams/TeamPresenter.svelte diff --git a/packages/core/src/classes.ts b/packages/core/src/classes.ts index d965c87cb19..b0b0e73a2a8 100644 --- a/packages/core/src/classes.ts +++ b/packages/core/src/classes.ts @@ -271,7 +271,7 @@ export interface Space extends Doc { private: boolean members: Arr> archived: boolean - icon?: Asset + presenter?: AnyAttribute } /** diff --git a/plugins/tracker-resources/package.json b/plugins/tracker-resources/package.json index bd1a5b7a48d..623a89cf159 100644 --- a/plugins/tracker-resources/package.json +++ b/plugins/tracker-resources/package.json @@ -55,6 +55,7 @@ "@hcengineering/attachment-resources": "~0.6.0", "@hcengineering/workbench": "~0.6.2", "@hcengineering/attachment": "~0.6.1", - "@hcengineering/chunter-resources": "~0.6.0" + "@hcengineering/chunter-resources": "~0.6.0", + "@hcengineering/workbench-resources": "~0.6.1" } } diff --git a/plugins/tracker-resources/src/components/teams/CreateTeam.svelte b/plugins/tracker-resources/src/components/teams/CreateTeam.svelte index ab3a6e850d2..7e7b6d306c4 100644 --- a/plugins/tracker-resources/src/components/teams/CreateTeam.svelte +++ b/plugins/tracker-resources/src/components/teams/CreateTeam.svelte @@ -14,7 +14,7 @@ --> + +{#if model.specials} + getActions(space)}> + {#each model.specials as special} + dispatch('special', special.id)} + selected={false} + on:click={() => { + selectSpace(space._id, special.id) + }} + /> + {/each} + +{/if} diff --git a/plugins/tracker/src/index.ts b/plugins/tracker/src/index.ts index b18a0d403a5..6ca91ef520c 100644 --- a/plugins/tracker/src/index.ts +++ b/plugins/tracker/src/index.ts @@ -63,6 +63,7 @@ export interface Team extends Space { sequence: number issueStatuses: number defaultIssueStatus: Ref + icon?: Asset } /** diff --git a/plugins/workbench-resources/src/components/navigator/SpacesNav.svelte b/plugins/workbench-resources/src/components/navigator/SpacesNav.svelte index df80a1594ec..3dcf5bf3576 100644 --- a/plugins/workbench-resources/src/components/navigator/SpacesNav.svelte +++ b/plugins/workbench-resources/src/components/navigator/SpacesNav.svelte @@ -20,7 +20,16 @@ import { getResource } from '@hcengineering/platform' import preference from '@hcengineering/preference' import { getClient } from '@hcengineering/presentation' - import { Action, getCurrentLocation, IconAdd, IconEdit, IconSearch, navigate, showPopup } from '@hcengineering/ui' + import { + Action, + AnySvelteComponent, + getCurrentLocation, + IconAdd, + IconEdit, + IconSearch, + navigate, + showPopup + } from '@hcengineering/ui' import { getActions as getContributedActions } from '@hcengineering/view-resources' import { SpacesNavModel } from '@hcengineering/workbench' import { createEventDispatcher } from 'svelte' @@ -109,12 +118,19 @@ function getParentActions (): Action[] { return hasSpaceBrowser ? [browseSpaces, addSpace] : [addSpace] } + + function asComponent (val: any): AnySvelteComponent { + return val as AnySvelteComponent + } getParentActions()} indent={'ml-2'}> {#each spaces as space (space._id)} - {#if model.specials} - getActions(space)}> + {#if space.presenter} + {@const presenter = asComponent(space.presenter)} + + {:else if model.specials} + getActions(space)}> {#each model.specials as special} sp.archived) !== undefined } export { default as SpaceBrowser } from './components/SpaceBrowser.svelte' +export { default as TreeNode } from './components/navigator/TreeNode.svelte' +export { default as SpecialElement } from './components/navigator/SpecialElement.svelte' export default async (): Promise => ({ component: { WorkbenchApp, From b9b6bb29923c9eba2c9868dd0965e84f975e8d44 Mon Sep 17 00:00:00 2001 From: muhtimur Date: Tue, 15 Nov 2022 00:44:13 +0700 Subject: [PATCH 3/6] Remove unused import Signed-off-by: muhtimur --- .../tracker-resources/src/components/teams/CreateTeam.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/tracker-resources/src/components/teams/CreateTeam.svelte b/plugins/tracker-resources/src/components/teams/CreateTeam.svelte index 7e7b6d306c4..d3e4cd8408e 100644 --- a/plugins/tracker-resources/src/components/teams/CreateTeam.svelte +++ b/plugins/tracker-resources/src/components/teams/CreateTeam.svelte @@ -14,7 +14,7 @@ --> {#if model.specials} - getActions(space)}> + getActions(space)}> {#each model.specials as special} ( _class: Ref>, @@ -219,7 +220,8 @@ export default async (): Promise => ({ IssueTemplatePresenter, EditIssueTemplate, TemplateEstimationEditor, - CreateTeam + CreateTeam, + TeamPresenter }, completion: { IssueQuery: async (client: Client, query: string, filter?: { in?: RelatedDocument[], nin?: RelatedDocument[] }) => diff --git a/plugins/tracker-resources/src/plugin.ts b/plugins/tracker-resources/src/plugin.ts index fa8ea2da0b7..f34c515eb6e 100644 --- a/plugins/tracker-resources/src/plugin.ts +++ b/plugins/tracker-resources/src/plugin.ts @@ -278,6 +278,7 @@ export default mergeIds(trackerId, tracker, { DueDatePresenter: '' as AnyComponent, EditIssueTemplate: '' as AnyComponent, CreateTeam: '' as AnyComponent, + TeamPresenter: '' as AnyComponent, NewIssueHeader: '' as AnyComponent, IconPresenter: '' as AnyComponent, LeadPresenter: '' as AnyComponent, diff --git a/plugins/workbench-resources/src/components/navigator/SpacesNav.svelte b/plugins/workbench-resources/src/components/navigator/SpacesNav.svelte index 3dcf5bf3576..04ab77379de 100644 --- a/plugins/workbench-resources/src/components/navigator/SpacesNav.svelte +++ b/plugins/workbench-resources/src/components/navigator/SpacesNav.svelte @@ -20,17 +20,8 @@ import { getResource } from '@hcengineering/platform' import preference from '@hcengineering/preference' import { getClient } from '@hcengineering/presentation' - import { - Action, - AnySvelteComponent, - getCurrentLocation, - IconAdd, - IconEdit, - IconSearch, - navigate, - showPopup - } from '@hcengineering/ui' - import { getActions as getContributedActions } from '@hcengineering/view-resources' + import { Action, getCurrentLocation, IconAdd, IconEdit, IconSearch, navigate, showPopup } from '@hcengineering/ui' + import { getActions as getContributedActions, getObjectPresenter } from '@hcengineering/view-resources' import { SpacesNavModel } from '@hcengineering/workbench' import { createEventDispatcher } from 'svelte' import plugin from '../../plugin' @@ -118,47 +109,29 @@ function getParentActions (): Action[] { return hasSpaceBrowser ? [browseSpaces, addSpace] : [addSpace] } - - function asComponent (val: any): AnySvelteComponent { - return val as AnySvelteComponent - } getParentActions()} indent={'ml-2'}> {#each spaces as space (space._id)} - {#if space.presenter} - {@const presenter = asComponent(space.presenter)} - - {:else if model.specials} - getActions(space)}> - {#each model.specials as special} - + {:else} + {#await getSpaceName(client, space) then name} + dispatch('special', special.id)} - selected={currentSpace === space._id && special.id === currentSpecial} + _id={space._id} + title={name} + icon={classIcon(client, space._class)} + selected={currentSpace === space._id} + actions={() => getActions(space)} + bold={isChanged(space, $lastViews)} on:click={() => { - selectSpace(space._id, special.id) + selectSpace(space._id) }} /> - {/each} - - {:else} - {#await getSpaceName(client, space) then name} - getActions(space)} - bold={isChanged(space, $lastViews)} - on:click={() => { - selectSpace(space._id) - }} - /> - {/await} - {/if} + {/await} + {/if} + {/await} {/each} From b34052aba6cee802130a38f45efec1b24d68326f Mon Sep 17 00:00:00 2001 From: muhtimur Date: Tue, 15 Nov 2022 13:37:55 +0700 Subject: [PATCH 5/6] Remove unused import Signed-off-by: muhtimur --- .../src/components/navigator/SpacesNav.svelte | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/workbench-resources/src/components/navigator/SpacesNav.svelte b/plugins/workbench-resources/src/components/navigator/SpacesNav.svelte index 04ab77379de..51e9e853a57 100644 --- a/plugins/workbench-resources/src/components/navigator/SpacesNav.svelte +++ b/plugins/workbench-resources/src/components/navigator/SpacesNav.svelte @@ -26,7 +26,6 @@ import { createEventDispatcher } from 'svelte' import plugin from '../../plugin' import { classIcon, getSpaceName } from '../../utils' - import SpecialElement from './SpecialElement.svelte' import TreeItem from './TreeItem.svelte' import TreeNode from './TreeNode.svelte' From b57effc72a0024d52b1a3adb9f34216437caaa65 Mon Sep 17 00:00:00 2001 From: muhtimur Date: Tue, 15 Nov 2022 13:45:58 +0700 Subject: [PATCH 6/6] Correct specials selection Signed-off-by: muhtimur --- .../src/components/teams/TeamPresenter.svelte | 5 ++++- .../src/components/navigator/SpacesNav.svelte | 10 +++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/plugins/tracker-resources/src/components/teams/TeamPresenter.svelte b/plugins/tracker-resources/src/components/teams/TeamPresenter.svelte index 8ce6732ce35..7c4dae3225a 100644 --- a/plugins/tracker-resources/src/components/teams/TeamPresenter.svelte +++ b/plugins/tracker-resources/src/components/teams/TeamPresenter.svelte @@ -13,6 +13,7 @@ // limitations under the License. -->