diff --git a/models/view/src/plugin.ts b/models/view/src/plugin.ts index 7c33b052c9..02d7e6b83c 100644 --- a/models/view/src/plugin.ts +++ b/models/view/src/plugin.ts @@ -101,9 +101,7 @@ export default mergeIds(viewId, view, { General: '' as IntlString, Navigation: '' as IntlString, Editor: '' as IntlString, - MarkdownFormatting: '' as IntlString, - Pin: '' as IntlString, - Unpin: '' as IntlString + MarkdownFormatting: '' as IntlString }, function: { FilterArrayAllResult: '' as FilterFunction, diff --git a/packages/theme/styles/popups.scss b/packages/theme/styles/popups.scss index d839be6499..6fa2b0f8ff 100644 --- a/packages/theme/styles/popups.scss +++ b/packages/theme/styles/popups.scss @@ -317,6 +317,11 @@ box-shadow: var(--theme-popup-shadow); user-select: none; + &.isDock { + border-radius: 0; + height: 100%; + } + .ap-space { flex-shrink: 0; height: .25rem; diff --git a/packages/ui/src/components/Dock.svelte b/packages/ui/src/components/Dock.svelte new file mode 100644 index 0000000000..744722d347 --- /dev/null +++ b/packages/ui/src/components/Dock.svelte @@ -0,0 +1,52 @@ + + + +{#if $dockStore !== undefined} +
+ { + _close(ev?.detail) + }} + on:dock={() => { + if ($dockStore !== undefined) { + unpin() + } + }} + /> +
+{/if} + + diff --git a/packages/ui/src/components/Popup.svelte b/packages/ui/src/components/Popup.svelte index ebe609a912..451280a5b3 100644 --- a/packages/ui/src/components/Popup.svelte +++ b/packages/ui/src/components/Popup.svelte @@ -24,13 +24,13 @@ instances.forEach((p) => p.fitPopupInstance()) } - $: instances.length = $modal.length + $: instances.length = $modal.filter((p) => p.dock !== true).length {#if $modal.length > 0} {/if} -{#each $modal as popup, i (popup.id)} +{#each $modal.filter((p) => p.dock !== true) as popup, i (popup.id)} import { onMount } from 'svelte' import { deviceOptionsStore as deviceInfo, resizeObserver, testing } from '..' - import { CompAndProps, fitPopupElement } from '../popups' + import { CompAndProps, fitPopupElement, pin } from '../popups' import type { AnySvelteComponent, DeviceOptions, PopupAlignment, PopupOptions, PopupPositionElement } from '../types' export let is: AnySvelteComponent @@ -314,6 +314,9 @@ fullSize = !fullSize fitPopup(modalHTML, element, contentPanel) }} + on:dock={() => { + pin(popup.id) + }} on:changeContent={(ev) => { fitPopup(modalHTML, element, contentPanel) if (ev.detail?.notFit !== undefined) notFit = ev.detail.notFit diff --git a/packages/ui/src/components/internal/Root.svelte b/packages/ui/src/components/internal/Root.svelte index d33933457b..d944bac993 100644 --- a/packages/ui/src/components/internal/Root.svelte +++ b/packages/ui/src/components/internal/Root.svelte @@ -250,6 +250,7 @@ } .app { + display: flex; height: calc(100% - var(--status-bar-height)); .error { diff --git a/packages/ui/src/index.ts b/packages/ui/src/index.ts index aa1cefbb6f..a1f61332fb 100644 --- a/packages/ui/src/index.ts +++ b/packages/ui/src/index.ts @@ -252,6 +252,8 @@ export { default as NumberInput } from './components/NumberInput.svelte' export { default as Lazy } from './components/Lazy.svelte' export { default as TimeZonesPopup } from './components/TimeZonesPopup.svelte' +export { default as Dock } from './components/Dock.svelte' + export * from './types' export * from './location' export * from './utils' diff --git a/packages/ui/src/popups.ts b/packages/ui/src/popups.ts index 75b5b1032f..a105268e52 100644 --- a/packages/ui/src/popups.ts +++ b/packages/ui/src/popups.ts @@ -1,6 +1,6 @@ import { getResource } from '@hcengineering/platform' import { type ComponentType } from 'svelte' -import { writable } from 'svelte/store' +import { derived, writable } from 'svelte/store' import type { AnyComponent, AnySvelteComponent, @@ -29,6 +29,7 @@ export interface CompAndProps { fixed?: boolean refId?: string } + dock?: boolean } export interface PopupResult { @@ -39,6 +40,10 @@ export interface PopupResult { export const popupstore = writable([]) +export const dockStore = derived(popupstore, (popups) => { + return popups.find((popup) => popup.dock) +}) + export function updatePopup (id: string, props: Partial): void { popupstore.update((popups) => { const popupIndex = popups.findIndex((p) => p.id === id) @@ -409,3 +414,17 @@ export function getEventPositionElement (evt: MouseEvent): PopupAlignment | unde getBoundingClientRect: () => rect } } + +export function pin (id: string): void { + popupstore.update((popups) => { + popups.forEach((p) => (p.dock = p.id === id)) + return popups + }) +} + +export function unpin (): void { + popupstore.update((popups) => { + popups.forEach((p) => (p.dock = false)) + return popups + }) +} diff --git a/plugins/notification-resources/src/components/NotificationSettings.svelte b/plugins/notification-resources/src/components/NotificationSettings.svelte index d6c08c86d6..78a2b824e1 100644 --- a/plugins/notification-resources/src/components/NotificationSettings.svelte +++ b/plugins/notification-resources/src/components/NotificationSettings.svelte @@ -34,7 +34,8 @@ defineSeparators, settingsSeparators, Separator, - NavItem + NavItem, + Loading } from '@hcengineering/ui' import notification from '../plugin' import NotificationGroupSetting from './NotificationGroupSetting.svelte' @@ -53,6 +54,8 @@ const query = createQuery() + let loading = true + query.query(notification.class.NotificationSetting, {}, (res) => { settings = new Map() for (const value of res) { @@ -61,6 +64,7 @@ settings.set(value.type, arr) } settings = settings + loading = false }) let group: Ref | undefined = undefined @@ -136,13 +140,17 @@
- {#if group} - - {/if} - {#if currentPreferenceGroup} - {#await getResource(currentPreferenceGroup.presenter) then presenter} - - {/await} + {#if loading} + + {:else} + {#if group} + + {/if} + {#if currentPreferenceGroup} + {#await getResource(currentPreferenceGroup.presenter) then presenter} + + {/await} + {/if} {/if}
diff --git a/plugins/view/src/index.ts b/plugins/view/src/index.ts index 5166412134..e537a06baa 100644 --- a/plugins/view/src/index.ts +++ b/plugins/view/src/index.ts @@ -197,7 +197,9 @@ const view = plugin(viewId, { Save: '' as IntlString, PublicView: '' as IntlString, Archived: '' as IntlString, - MoreActions: '' as IntlString + MoreActions: '' as IntlString, + Pin: '' as IntlString, + Unpin: '' as IntlString }, icon: { Table: '' as Asset, diff --git a/plugins/workbench-resources/src/components/Workbench.svelte b/plugins/workbench-resources/src/components/Workbench.svelte index ef118653a7..5d64437455 100644 --- a/plugins/workbench-resources/src/components/Workbench.svelte +++ b/plugins/workbench-resources/src/components/Workbench.svelte @@ -35,6 +35,7 @@ Button, CompAndProps, Component, + Dock, IconSettings, Label, Location, @@ -852,6 +853,7 @@ + {/if}