diff --git a/dev/prod/webpack.config.js b/dev/prod/webpack.config.js index e5165b386b..3784e44a3e 100644 --- a/dev/prod/webpack.config.js +++ b/dev/prod/webpack.config.js @@ -56,34 +56,14 @@ module.exports = { { test: /\.svelte$/, use: { - loader: 'svelte-loader', + loader: 'svelte-loader', options: { + compilerOptions: { + dev: !prod, + }, emitCss: true, - preprocess: require('svelte-preprocess')({ postcss: true }) - } - // options: { - // dev: !prod, - // emitCss: true, - // hotReload: !prod, - // preprocess: require('svelte-preprocess')({ - // babel: { - // presets: [ - // [ - // '@babel/preset-env', - // { - // loose: true, - // modules: false, - // targets: { - // esmodules: true - // } - // } - // ], - // '@babel/typescript' - // ], - // plugins: ['@babel/plugin-proposal-optional-chaining'] - // } - // }) - // } + preprocess: require('svelte-preprocess')({ postcss: true }) + } } }, diff --git a/models/recruit/src/index.ts b/models/recruit/src/index.ts index 3eb8da79a4..1ff5b0b012 100644 --- a/models/recruit/src/index.ts +++ b/models/recruit/src/index.ts @@ -129,6 +129,14 @@ export function createModel (builder: Builder): void { icon: contact.icon.Person, label: recruit.string.Candidates, position: 'bottom' + }, + { + id: 'archive', + component: workbench.component.Archive, + icon: view.icon.Archive, + label: workbench.string.Archive, + position: 'top', + visibleIf: workbench.function.HasArchiveSpaces } ] } @@ -287,6 +295,22 @@ export function createModel (builder: Builder): void { label: recruit.string.SearchApplication, query: recruit.completion.ApplicationQuery }, recruit.completion.ApplicationCategory) + + builder.createDoc(view.class.ActionTarget, core.space.Model, { + target: recruit.class.Vacancy, + action: task.action.ArchiveSpace, + query: { + archived: false + } + }) + + builder.createDoc(view.class.ActionTarget, core.space.Model, { + target: recruit.class.Vacancy, + action: task.action.UnarchiveSpace, + query: { + archived: true + } + }) } export { default } from './plugin' diff --git a/models/task/src/index.ts b/models/task/src/index.ts index 82edbe5a8f..89026e26c6 100644 --- a/models/task/src/index.ts +++ b/models/task/src/index.ts @@ -404,22 +404,6 @@ export function createModel (builder: Builder): void { } }) - builder.createDoc(view.class.ActionTarget, core.space.Model, { - target: task.class.SpaceWithStates, - action: task.action.ArchiveSpace, - query: { - archived: false - } - }) - - builder.createDoc(view.class.ActionTarget, core.space.Model, { - target: task.class.SpaceWithStates, - action: task.action.UnarchiveSpace, - query: { - archived: true - } - }) - builder.mixin(task.class.State, core.class.Class, view.mixin.AttributeEditor, { editor: task.component.StateEditor }) diff --git a/models/workbench/src/plugin.ts b/models/workbench/src/plugin.ts index 39c4430999..7c5edc49da 100644 --- a/models/workbench/src/plugin.ts +++ b/models/workbench/src/plugin.ts @@ -13,12 +13,20 @@ // limitations under the License. // -import { mergeIds } from '@anticrm/platform' +import { Space } from '@anticrm/core' +import { IntlString, mergeIds, Resource } from '@anticrm/platform' import { AnyComponent } from '@anticrm/ui' import workbench, { workbenchId } from '@anticrm/workbench' export default mergeIds(workbenchId, workbench, { component: { - ApplicationPresenter: '' as AnyComponent + ApplicationPresenter: '' as AnyComponent, + Archive: '' as AnyComponent + }, + string: { + Archive: '' as IntlString + }, + function: { + HasArchiveSpaces: '' as Resource<(spaces: Space[]) => boolean> } }) diff --git a/plugins/workbench-resources/src/components/NavHeader.svelte b/plugins/workbench-resources/src/components/NavHeader.svelte index 933585fe65..650370721f 100644 --- a/plugins/workbench-resources/src/components/NavHeader.svelte +++ b/plugins/workbench-resources/src/components/NavHeader.svelte @@ -15,8 +15,7 @@ {#if model} {#if model.specials} - {#each getSpecials(model.specials, 'top') as special} - selectSpecial(special.id)} /> + {#each topSpecials as special} + dispatch('special', special.id)} selected={special.id === currentSpecial} /> {/each} {/if} - {#if archivedSpaces.length > 0} - selectSpecial('archive')} /> - {/if} {#if showDivider}{/if} {#each model.spaces as m (m.label)} - + {/each} {#if model.specials} - {#each getSpecials(model.specials, 'bottom') as special} - selectSpecial(special.id)} /> + {#each bottomSpecials as special} + dispatch('special', special.id)} selected={special.id === currentSpecial} /> {/each} {/if}
diff --git a/plugins/workbench-resources/src/components/Workbench.svelte b/plugins/workbench-resources/src/components/Workbench.svelte index 7a2b21a800..635e3945fb 100644 --- a/plugins/workbench-resources/src/components/Workbench.svelte +++ b/plugins/workbench-resources/src/components/Workbench.svelte @@ -13,15 +13,15 @@ // limitations under the License. --> {#if client} @@ -145,6 +187,7 @@ label={visibileNav ? workbench.string.HideMenu : workbench.string.ShowMenu} selected={!visibileNav} action={toggleNav} + notify={false} />
@@ -166,20 +209,23 @@ {#if currentApplication} {/if} - - + selectSpecial(evt.detail)} + on:space={(evt) => updateSpace(evt.detail)} + on:archive={(evt) => selectArchive()} + /> + {/if}
{#if currentApplication && currentApplication.component} - + + {:else if specialComponent} + {:else} - {#if ownSpecialComponent} - - {:else if specialComponent} - - {:else} - - {/if} + {/if}
diff --git a/plugins/workbench-resources/src/components/navigator/SpacesNav.svelte b/plugins/workbench-resources/src/components/navigator/SpacesNav.svelte index ba98365580..557329a88a 100644 --- a/plugins/workbench-resources/src/components/navigator/SpacesNav.svelte +++ b/plugins/workbench-resources/src/components/navigator/SpacesNav.svelte @@ -12,30 +12,25 @@ // See the License for the specific language governing permissions and // limitations under the License. --> -
{ dispatch('click') }} @@ -88,6 +89,10 @@ line-height: 100%; } + &.selected { + background-color: var(--theme-button-bg-enabled); + } + &:hover { background-color: var(--theme-button-bg-enabled); .tool { diff --git a/plugins/workbench-resources/src/index.ts b/plugins/workbench-resources/src/index.ts index 57aa737548..5c6b719192 100644 --- a/plugins/workbench-resources/src/index.ts +++ b/plugins/workbench-resources/src/index.ts @@ -16,15 +16,20 @@ import WorkbenchApp from './components/WorkbenchApp.svelte' import ApplicationPresenter from './components/ApplicationPresenter.svelte' import { Resources } from '@anticrm/platform' +import Archive from './components/Archive.svelte' +import { Space } from '@anticrm/core' + +function hasArchiveSpaces (spaces: Space[]): boolean { + return spaces.find(sp => sp.archived) !== undefined +} -/*! - * Anticrm Platform™ Workbench Plugin - * © 2020 Anticrm Platform Contributors. All Rights Reserved. - * Licensed under the Eclipse Public License, Version 2.0 - */ export default async (): Promise => ({ component: { WorkbenchApp, - ApplicationPresenter + ApplicationPresenter, + Archive + }, + function: { + HasArchiveSpaces: hasArchiveSpaces } }) diff --git a/plugins/workbench-resources/src/utils.ts b/plugins/workbench-resources/src/utils.ts index 8f898533fe..34dd56c449 100644 --- a/plugins/workbench-resources/src/utils.ts +++ b/plugins/workbench-resources/src/utils.ts @@ -1,24 +1,22 @@ // // Copyright © 2020, 2021 Anticrm Platform Contributors. // Copyright © 2021 Hardcore Engineering Inc. -// +// // Licensed under the Eclipse Public License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. You may // obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0 -// +// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// +// // See the License for the specific language governing permissions and // limitations under the License. // -import type { Ref, Obj, Class } from '@anticrm/core' +import type { Class, Client, Obj, Ref } from '@anticrm/core' import type { Asset } from '@anticrm/platform' -import type { Client } from '@anticrm/core' -import type { EmployeeAccount } from '@anticrm/contact' -export function classIcon(client: Client, _class: Ref>): Asset | undefined { +export function classIcon (client: Client, _class: Ref>): Asset | undefined { return client.getHierarchy().getClass(_class).icon } diff --git a/plugins/workbench/src/index.ts b/plugins/workbench/src/index.ts index 2e944199fb..feb07b5598 100644 --- a/plugins/workbench/src/index.ts +++ b/plugins/workbench/src/index.ts @@ -14,7 +14,7 @@ // import type { Class, Doc, Mixin, Obj, Ref, Space } from '@anticrm/core' -import type { Asset, IntlString, Metadata, Plugin } from '@anticrm/platform' +import type { Asset, IntlString, Metadata, Plugin, Resource } from '@anticrm/platform' import { plugin } from '@anticrm/platform' import type { AnyComponent } from '@anticrm/ui' @@ -59,6 +59,7 @@ export interface SpecialNavModel { icon: Asset component: AnyComponent position?: 'top'|'bottom' // undefined == 'top + visibleIf?: Resource<(spaces: Space[]) => boolean> } /**