Update Notifications layout (#2500)

Signed-off-by: Alexander Platov <sas_lord@mail.ru>
This commit is contained in:
Alexander Platov 2023-01-12 18:50:41 +03:00 committed by GitHub
parent 6e1ae06beb
commit c74f48d044
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 346 additions and 143 deletions

View File

@ -27,7 +27,8 @@
ListView, ListView,
showPopup, showPopup,
tooltip, tooltip,
resizeObserver resizeObserver,
deviceOptionsStore
} from '@hcengineering/ui' } from '@hcengineering/ui'
import { createEventDispatcher } from 'svelte' import { createEventDispatcher } from 'svelte'
import presentation from '..' import presentation from '..'
@ -206,7 +207,13 @@
}} }}
> >
<div class="header flex-between"> <div class="header flex-between">
<EditBox kind={'search-style'} focusIndex={1} focus bind:value={search} {placeholder} /> <EditBox
kind={'search-style'}
focusIndex={1}
focus={!$deviceOptionsStore.isMobile}
bind:value={search}
{placeholder}
/>
{#if create !== undefined} {#if create !== undefined}
<div class="mx-2"> <div class="mx-2">
<Button <Button

View File

@ -25,7 +25,8 @@
IconSearch, IconSearch,
Label, Label,
ListView, ListView,
resizeObserver resizeObserver,
deviceOptionsStore
} from '@hcengineering/ui' } from '@hcengineering/ui'
import { createEventDispatcher } from 'svelte' import { createEventDispatcher } from 'svelte'
import presentation from '../plugin' import presentation from '../plugin'
@ -171,7 +172,7 @@
{/each} {/each}
</div> </div>
<EditBox <EditBox
focus focus={!$deviceOptionsStore.isMobile}
icon={IconSearch} icon={IconSearch}
kind={'search-style'} kind={'search-style'}
focusIndex={0} focusIndex={0}

View File

@ -17,7 +17,7 @@
import { translate } from '@hcengineering/platform' import { translate } from '@hcengineering/platform'
import { createEventDispatcher, onMount } from 'svelte' import { createEventDispatcher, onMount } from 'svelte'
import core, { Class, getCurrentAccount, Ref, Space } from '@hcengineering/core' import core, { Class, getCurrentAccount, Ref, Space } from '@hcengineering/core'
import { tooltip, CheckBox, resizeObserver } from '@hcengineering/ui' import { tooltip, CheckBox, resizeObserver, deviceOptionsStore } from '@hcengineering/ui'
import { createQuery } from '../utils' import { createQuery } from '../utils'
import presentation from '..' import presentation from '..'
import SpaceInfo from './SpaceInfo.svelte' import SpaceInfo from './SpaceInfo.svelte'
@ -85,7 +85,7 @@
} }
onMount(() => { onMount(() => {
if (input) input.focus() if (input && !$deviceOptionsStore.isMobile) input.focus()
}) })
</script> </script>

View File

@ -452,6 +452,7 @@ input.search {
.pt-3 { padding-top: .75rem; } .pt-3 { padding-top: .75rem; }
.pt-4 { padding-top: 1rem; } .pt-4 { padding-top: 1rem; }
.pt-6 { padding-top: 1.5rem; } .pt-6 { padding-top: 1.5rem; }
.pb-1 { padding-bottom: .25rem; }
.pb-2 { padding-bottom: .5rem; } .pb-2 { padding-bottom: .5rem; }
.pb-3 { padding-bottom: .75rem; } .pb-3 { padding-bottom: .75rem; }
.pb-4 { padding-bottom: 1rem; } .pb-4 { padding-bottom: 1rem; }

View File

@ -419,27 +419,30 @@
overflow: hidden; overflow: hidden;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
width: max-content; padding: .5rem;
height: max-content;
padding-bottom: 0.5rem;
min-width: 42rem;
max-width: 42rem;
height: 22rem;
min-height: 22rem; min-height: 22rem;
max-height: 22rem;
background: var(--popup-bg-color); background: var(--popup-bg-color);
border-radius: 0.5rem; border-radius: .5rem;
box-shadow: var(--popup-shadow); box-shadow: var(--popup-shadow);
.header { .header {
display: flex; display: flex;
align-items: center; align-items: center;
flex-shrink: 0; flex-shrink: 0;
padding: 0 1rem; padding: 0 .75rem .5rem 1rem;
height: 3rem; height: 3rem;
border-bottom: 1px solid var(--popup-divider); min-height: 0;
}
.space {
flex-shrink: 0;
height: .25rem;
&.x2 { height: .5rem; }
&.x3 { height: .75rem; }
} }
} }
.notifyPopup .comment::after,
.notifyPopup .mention::after { content: none !important; }
.notifyPopup .content .mention { margin-top: 0 !important; }
.helpAndSupportPopup { .helpAndSupportPopup {
min-height: 100%; min-height: 100%;

View File

@ -28,6 +28,7 @@
export let size: ButtonSize = 'medium' export let size: ButtonSize = 'medium'
export let shape: ButtonShape = undefined export let shape: ButtonShape = undefined
export let icon: Asset | AnySvelteComponent | undefined = undefined export let icon: Asset | AnySvelteComponent | undefined = undefined
export let iconProps: any | undefined = undefined
export let justify: 'left' | 'center' = 'center' export let justify: 'left' | 'center' = 'center'
export let disabled: boolean = false export let disabled: boolean = false
export let loading: boolean = false export let loading: boolean = false
@ -105,7 +106,7 @@
> >
{#if icon && !loading} {#if icon && !loading}
<div class="btn-icon pointer-events-none" class:resetIconSize> <div class="btn-icon pointer-events-none" class:resetIconSize>
<Icon bind:icon size={iconSize} /> <Icon bind:icon size={iconSize} {iconProps} />
</div> </div>
{/if} {/if}
{#if loading} {#if loading}

View File

@ -18,7 +18,7 @@
import { createEventDispatcher, onMount } from 'svelte' import { createEventDispatcher, onMount } from 'svelte'
import { getPlatformColor } from '../colors' import { getPlatformColor } from '../colors'
import ListView from './ListView.svelte' import ListView from './ListView.svelte'
import { resizeObserver } from '..' import { resizeObserver, deviceOptionsStore } from '..'
export let placeholder: IntlString | undefined = undefined export let placeholder: IntlString | undefined = undefined
export let placeholderParam: any | undefined = undefined export let placeholderParam: any | undefined = undefined
@ -70,7 +70,7 @@
} }
let input: HTMLElement let input: HTMLElement
onMount(() => { onMount(() => {
if (input) input.focus() if (input && !$deviceOptionsStore.isMobile) input.focus()
}) })
</script> </script>

View File

@ -20,7 +20,7 @@
import plugin from '../plugin' import plugin from '../plugin'
import CheckBox from './CheckBox.svelte' import CheckBox from './CheckBox.svelte'
import ListView from './ListView.svelte' import ListView from './ListView.svelte'
import { resizeObserver } from '..' import { resizeObserver, deviceOptionsStore } from '..'
export let placeholder: IntlString = plugin.string.SearchDots export let placeholder: IntlString = plugin.string.SearchDots
export let items: DropdownTextItem[] export let items: DropdownTextItem[]
@ -35,7 +35,7 @@
let searchInput: HTMLInputElement let searchInput: HTMLInputElement
onMount(() => { onMount(() => {
if (searchInput) searchInput.focus() if (searchInput && !$deviceOptionsStore.isMobile) searchInput.focus()
}) })
let selection = 0 let selection = 0

View File

@ -20,7 +20,7 @@
import plugin from '../plugin' import plugin from '../plugin'
import Icon from './Icon.svelte' import Icon from './Icon.svelte'
import ListView from './ListView.svelte' import ListView from './ListView.svelte'
import { resizeObserver } from '..' import { resizeObserver, deviceOptionsStore } from '..'
export let icon: Asset | AnySvelteComponent export let icon: Asset | AnySvelteComponent
export let placeholder: IntlString = plugin.string.SearchDots export let placeholder: IntlString = plugin.string.SearchDots
@ -37,7 +37,7 @@
let searchInput: HTMLInputElement let searchInput: HTMLInputElement
onMount(() => { onMount(() => {
if (searchInput) searchInput.focus() if (searchInput && !$deviceOptionsStore.isMobile) searchInput.focus()
}) })
let selection = 0 let selection = 0

View File

@ -23,7 +23,7 @@
import Label from './Label.svelte' import Label from './Label.svelte'
import ListView from './ListView.svelte' import ListView from './ListView.svelte'
import type { AnySvelteComponent } from '../types' import type { AnySvelteComponent } from '../types'
import { resizeObserver } from '../resize' import { resizeObserver, deviceOptionsStore } from '..'
interface ValueType { interface ValueType {
id: number | string | null id: number | string | null
@ -132,7 +132,7 @@
<EditBox <EditBox
kind={'search-style'} kind={'search-style'}
focusIndex={1} focusIndex={1}
focus focus={!$deviceOptionsStore.isMobile}
bind:value={search} bind:value={search}
{placeholder} {placeholder}
{placeholderParam} {placeholderParam}

View File

@ -0,0 +1,27 @@
<script lang="ts">
export let size: 'small' | 'medium' | 'large'
const fill: string = 'currentColor'
</script>
<svg class="svg-{size}" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<g>
<path
{fill}
d="M7.1,13.2c0.3,0.3,0.8,0.3,1.1,0c0.3-0.3,0.3-0.8,0-1.1l-0.6-0.6c-0.3-0.3-0.8-0.3-1.1,0c-0.3,0.3-0.3,0.8,0,1.1L7.1,13.2z"
fill-rule="evenodd"
clip-rule="evenodd"
/>
<path
{fill}
d="M22.5,6.5c-0.3-0.3-0.8-0.3-1.1,0L12,15.9l-0.1-0.1c-0.3-0.3-0.8-0.3-1.1,0c-0.3,0.3-0.3,0.8,0,1.1l0.6,0.6c0.3,0.3,0.8,0.3,1.1,0l10-10C22.8,7.2,22.8,6.8,22.5,6.5z"
fill-rule="evenodd"
clip-rule="evenodd"
/>
<path
{fill}
d="M17.5,6.5c-0.3-0.3-0.8-0.3-1.1,0L7,15.9l-4.5-4.5c-0.3-0.3-0.8-0.3-1.1,0c-0.3,0.3-0.3,0.8,0,1.1l5,5c0.3,0.3,0.8,0.3,1.1,0l10-10C17.8,7.2,17.8,6.8,17.5,6.5z"
fill-rule="evenodd"
clip-rule="evenodd"
/>
</g>
</svg>

View File

@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
export let size: 'small' | 'medium' | 'large' export let size: 'small' | 'medium' | 'large'
const fill: string = 'currentColor' export let fill: string = 'currentColor'
</script> </script>
<svg class="svg-{size}" {fill} viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"> <svg class="svg-{size}" {fill} viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">

View File

@ -124,6 +124,7 @@ export { default as IconEdit } from './components/icons/Edit.svelte'
export { default as IconInfo } from './components/icons/Info.svelte' export { default as IconInfo } from './components/icons/Info.svelte'
export { default as IconBlueCheck } from './components/icons/BlueCheck.svelte' export { default as IconBlueCheck } from './components/icons/BlueCheck.svelte'
export { default as IconCheck } from './components/icons/Check.svelte' export { default as IconCheck } from './components/icons/Check.svelte'
export { default as IconCheckAll } from './components/icons/CheckAll.svelte'
export { default as IconArrowLeft } from './components/icons/ArrowLeft.svelte' export { default as IconArrowLeft } from './components/icons/ArrowLeft.svelte'
export { default as IconArrowRight } from './components/icons/ArrowRight.svelte' export { default as IconArrowRight } from './components/icons/ArrowRight.svelte'
export { default as IconNavPrev } from './components/icons/NavPrev.svelte' export { default as IconNavPrev } from './components/icons/NavPrev.svelte'

View File

@ -255,12 +255,21 @@ export function fitPopupElement (
} else if (element === 'account') { } else if (element === 'account') {
newProps.bottom = '2.75rem' newProps.bottom = '2.75rem'
newProps.left = '5rem' newProps.left = '5rem'
newProps.minWidth = newProps.maxWidth = '42rem'
newProps.maxHeight = 'calc(100vh - 5.5rem)'
show = true
} else if (element === 'account-portrait') { } else if (element === 'account-portrait') {
newProps.bottom = 'calc(var(--app-panel-width) + .75rem)' newProps.bottom = 'calc(var(--app-panel-width) + .75rem)'
newProps.right = '.5rem' newProps.right = '.5rem'
newProps.minWidth = newProps.maxWidth = 'calc(100vw - 1rem)'
newProps.maxHeight = 'calc(100vh - var(--app-panel-width) - 1.5rem)'
show = true
} else if (element === 'account-mobile') { } else if (element === 'account-mobile') {
newProps.bottom = '.5rem' newProps.bottom = '.5rem'
newProps.left = 'calc(var(--app-panel-width) + .5rem)' newProps.left = 'calc(var(--app-panel-width) + .5rem)'
newProps.minWidth = newProps.maxWidth = 'calc(100vw - var(--app-panel-width) - 1rem)'
newProps.maxHeight = 'calc(100vh - 1rem)'
show = true
} else if (element === 'full' && contentPanel === undefined) { } else if (element === 'full' && contentPanel === undefined) {
newProps.top = '0' newProps.top = '0'
newProps.bottom = '0' newProps.bottom = '0'

View File

@ -43,6 +43,7 @@
export let showIcon: boolean = true export let showIcon: boolean = true
export let isNew: boolean = false export let isNew: boolean = false
export let isNextNew: boolean = false export let isNextNew: boolean = false
export let contentHidden: boolean = false
// export let showDocument = false // export let showDocument = false
let ptx: DisplayTx | undefined let ptx: DisplayTx | undefined
@ -305,7 +306,7 @@
</div> </div>
{#if viewlet && viewlet.component && viewlet.display !== 'inline'} {#if viewlet && viewlet.component && viewlet.display !== 'inline'}
<div class="activity-content {viewlet.display}"> <div class="activity-content {viewlet.display}" class:contentHidden>
<ShowMore ignore={edit}> <ShowMore ignore={edit}>
{#if tx.collectionAttribute !== undefined && (tx.txDocIds?.size ?? 0) > 1} {#if tx.collectionAttribute !== undefined && (tx.txDocIds?.size ?? 0) > 1}
<div class="flex-row-center flex-grow flex-wrap clear-mins"> <div class="flex-row-center flex-grow flex-wrap clear-mins">
@ -456,4 +457,21 @@
.lower { .lower {
text-transform: lowercase; text-transform: lowercase;
} }
.activity-content {
overflow: hidden;
visibility: visible;
max-height: max-content;
opacity: 1;
transition-property: max-height, opacity;
transition-timing-function: ease-in-out;
transition-duration: 0.15s;
&.contentHidden {
visibility: hidden;
padding: 0;
margin-top: -0.5rem;
max-height: 0;
opacity: 0;
}
}
</style> </style>

View File

@ -16,17 +16,33 @@
<script lang="ts"> <script lang="ts">
import { AttachmentDocList } from '@hcengineering/attachment-resources' import { AttachmentDocList } from '@hcengineering/attachment-resources'
import type { Comment } from '@hcengineering/chunter' import type { Comment } from '@hcengineering/chunter'
import chunter from '@hcengineering/chunter'
import { formatName } from '@hcengineering/contact' import { formatName } from '@hcengineering/contact'
import { Avatar, getClient, MessageViewer } from '@hcengineering/presentation' import { Avatar, getClient, MessageViewer } from '@hcengineering/presentation'
import { TimeSince, ShowMore } from '@hcengineering/ui' import { TimeSince, ShowMore, Icon } from '@hcengineering/ui'
import { getUser } from '../utils' import { getUser } from '../utils'
export let value: Comment export let value: Comment
export let inline: boolean = false
export let disableClick = false
const client = getClient() const client = getClient()
const cutId = (str: string): string => {
return str.slice(0, 4) + '...' + str.slice(-4)
}
</script> </script>
<div class="flex-row-top"> {#if inline}
<a class="flex-presenter inline-presenter" href="#{disableClick ? null : ''}">
<div class="icon">
<Icon icon={chunter.icon.Thread} size={'small'} />
</div>
<span class="label nowrap">Message</span>
</a>
&nbsp;<span class="content-dark-color">#{cutId(value._id.toString())}</span>
{:else}
<div class="flex-row-top">
<div class="avatar"> <div class="avatar">
<Avatar size={'medium'} /> <Avatar size={'medium'} />
</div> </div>
@ -44,7 +60,8 @@
<AttachmentDocList {value} /> <AttachmentDocList {value} />
</ShowMore> </ShowMore>
</div> </div>
</div> </div>
{/if}
<style lang="scss"> <style lang="scss">
.avatar { .avatar {

View File

@ -62,7 +62,7 @@
<svelte:component this={targetPresenter.presenter} value={target} /> <svelte:component this={targetPresenter.presenter} value={target} />
</div> </div>
{/if} {/if}
<span class="lower"><Label label={chunter.string.In} /></span> <span style:text-transform={'lowercase'}><Label label={chunter.string.In} /></span>
<div class="ml-2"> <div class="ml-2">
<svelte:component this={presenter.presenter} value={doc} /> <svelte:component this={presenter.presenter} value={doc} />
</div> </div>

View File

@ -2,7 +2,7 @@
import { Employee, EmployeeAccount, formatName, Status } from '@hcengineering/contact' import { Employee, EmployeeAccount, formatName, Status } from '@hcengineering/contact'
import { getCurrentAccount, Ref, Hierarchy, WithLookup } from '@hcengineering/core' import { getCurrentAccount, Ref, Hierarchy, WithLookup } from '@hcengineering/core'
import { Avatar, createQuery, getClient } from '@hcengineering/presentation' import { Avatar, createQuery, getClient } from '@hcengineering/presentation'
import { Button, getPanelURI, Label, showPopup } from '@hcengineering/ui' import { Button, getPanelURI, Label, showPopup, resizeObserver } from '@hcengineering/ui'
import EmployeeSetStatusPopup from './EmployeeSetStatusPopup.svelte' import EmployeeSetStatusPopup from './EmployeeSetStatusPopup.svelte'
import contact from '../plugin' import contact from '../plugin'
import EmployeeStatusPresenter from './EmployeeStatusPresenter.svelte' import EmployeeStatusPresenter from './EmployeeStatusPresenter.svelte'
@ -55,7 +55,12 @@
} }
</script> </script>
<div class="antiPopup p-4 flex-col"> <div
class="antiPopup p-4 flex-col"
use:resizeObserver={() => {
dispatch('changeContent')
}}
>
{#if employee} {#if employee}
<div class="flex-col-center pb-2"> <div class="flex-col-center pb-2">
<Avatar size="x-large" avatar={employee?.avatar} /> <Avatar size="x-large" avatar={employee?.avatar} />

View File

@ -40,6 +40,7 @@
"@hcengineering/activity": "^0.6.0", "@hcengineering/activity": "^0.6.0",
"@hcengineering/contact": "^0.6.9", "@hcengineering/contact": "^0.6.9",
"@hcengineering/core": "^0.6.20", "@hcengineering/core": "^0.6.20",
"@hcengineering/view": "^0.6.2" "@hcengineering/view": "^0.6.2",
"@hcengineering/view-resources": "^0.6.0"
} }
} }

View File

@ -16,11 +16,13 @@
<script lang="ts"> <script lang="ts">
import { TxViewlet } from '@hcengineering/activity' import { TxViewlet } from '@hcengineering/activity'
import { ActivityKey, DisplayTx, newDisplayTx, TxView } from '@hcengineering/activity-resources' import { ActivityKey, DisplayTx, newDisplayTx, TxView } from '@hcengineering/activity-resources'
import core, { Doc, TxCUD, TxProcessor, WithLookup } from '@hcengineering/core' import core, { Doc, TxCUD, TxProcessor, WithLookup, Ref, Class } from '@hcengineering/core'
import { Notification, NotificationStatus } from '@hcengineering/notification' import { Notification, NotificationStatus } from '@hcengineering/notification'
import { getClient } from '@hcengineering/presentation' import { getClient } from '@hcengineering/presentation'
import { ActionIcon, Component, getPlatformColor, IconBack, IconCheck, IconDelete } from '@hcengineering/ui' import { Button, Component, getPlatformColor, IconBack, IconCheck, IconDelete } from '@hcengineering/ui'
import type { AnyComponent } from '@hcengineering/ui'
import view from '@hcengineering/view' import view from '@hcengineering/view'
import { getObjectPreview } from '@hcengineering/view-resources'
import plugin from '../plugin' import plugin from '../plugin'
export let notification: WithLookup<Notification> export let notification: WithLookup<Notification>
@ -46,22 +48,33 @@
} }
$: displayTx = getDisplayTx(notification) $: displayTx = getDisplayTx(notification)
let presenter: AnyComponent | undefined
let doc: Doc | undefined
let visible: boolean = false
async function updatePreviewPresenter (ref?: Ref<Class<Doc>>): Promise<void> {
presenter = ref !== undefined ? await getObjectPreview(client, ref) : undefined
}
$: if (displayTx) updatePreviewPresenter(displayTx.tx.objectClass)
$: if (presenter !== undefined && displayTx) {
client.findOne(displayTx.tx.objectClass, { _id: displayTx.tx.objectId }).then((res) => (doc = res))
}
</script> </script>
{#if displayTx} {#if displayTx}
{@const isNew = notification.status !== NotificationStatus.Read} {@const isNew = notification.status !== NotificationStatus.Read}
<!-- svelte-ignore a11y-mouse-events-have-key-events --> <!-- svelte-ignore a11y-click-events-have-key-events -->
<div class="content">
<div class="flex-row">
<div class="bottom-divider mb-2">
<div class="flex-row-center mb-2 mt-2">
<div class="notify mr-4" style:color={isNew ? getPlatformColor(11) : '#555555'} />
<div <div
class="flex-shrink" class="content {isNew ? 'new' : 'readed'} with-document"
on:click={() => { class:visible
style:--color={isNew ? getPlatformColor(11) : '#555555'}
on:click|preventDefault|stopPropagation={() => {
changeState(notification, NotificationStatus.Read) changeState(notification, NotificationStatus.Read)
visible = !visible
}} }}
> >
<div class="subheader">
<div class="flex-grow">
<Component <Component
is={view.component.ObjectPresenter} is={view.component.ObjectPresenter}
props={{ props={{
@ -72,46 +85,131 @@
}} }}
/> />
</div> </div>
<div class="flex flex-reverse flex-gap-3 flex-grow"> <div class="buttons-group xsmall-gap">
<ActionIcon <Button
icon={IconDelete}
label={plugin.string.Remove}
size={'medium'}
action={() => {
client.remove(notification)
}}
/>
<ActionIcon
icon={isNew ? IconCheck : IconBack} icon={isNew ? IconCheck : IconBack}
iconProps={!isNew ? { kind: 'curve' } : {}} iconProps={!isNew ? { kind: 'curve' } : {}}
label={plugin.string.MarkAsRead} kind={'transparent'}
showTooltip={{ label: plugin.string.MarkAsRead }}
size={'medium'} size={'medium'}
action={() => { on:click={() => {
if (!isNew && visible) visible = false
changeState(notification, isNew ? NotificationStatus.Read : NotificationStatus.Notified) changeState(notification, isNew ? NotificationStatus.Read : NotificationStatus.Notified)
}} }}
/> />
<Button
icon={IconDelete}
kind={'transparent'}
showTooltip={{ label: plugin.string.Remove }}
size={'medium'}
on:click={() => {
client.remove(notification)
}}
/>
</div> </div>
</div> </div>
<TxView tx={displayTx} {viewlets} showIcon={false} contentHidden={!visible} />
{#if presenter && doc}
<div class="document-preview">
<Component is={presenter} props={{ object: doc }} />
</div> </div>
<TxView tx={displayTx} {viewlets} showIcon={false} /> {/if}
</div>
</div> </div>
{/if} {/if}
<style lang="scss"> <style lang="scss">
.content { .content {
padding: 0.5rem; position: relative;
border-radius: 0.5rem; display: flex;
border: 1px solid transparent; flex-direction: column;
padding: 0.5rem 0.75rem 0.75rem;
min-height: 0;
border: 1px solid var(--button-border-color);
border-radius: 0.75rem;
transition-property: border-color, background-color, height;
transition-duration: 0.3s, 0.15s, 0.15s;
transition-timing-function: ease-in-out;
&:not(:last-child) {
margin-bottom: 0.75rem;
} }
.notify { &.new {
background-color: var(--popup-bg-hover);
}
&.readed {
background-color: var(--body-accent);
}
&:hover {
border-color: var(--button-border-hover);
}
&.with-document {
cursor: pointer;
&::before {
content: '';
position: absolute;
bottom: -0.25rem;
left: 1rem;
right: 1rem;
width: calc(100% - 2rem);
height: 0.75rem;
background-color: var(--body-accent);
border: 1px solid var(--divider-color);
border-radius: 0.5rem;
z-index: -1;
transition: bottom 0.15s ease-in-out;
box-shadow: var(--primary-shadow);
}
&:hover::before {
bottom: -0.4rem;
}
&.visible::before {
bottom: 0.25rem;
}
}
.subheader {
position: relative;
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 0 0.5rem 1.75rem;
margin-bottom: 0.5rem;
min-height: 0;
border-bottom: 1px solid var(--divider-color);
&::before {
content: '';
position: absolute;
top: 50%;
left: 0.5rem;
width: 0.5rem; width: 0.5rem;
height: 0.5rem; height: 0.5rem;
border-radius: 0.25rem; background-color: var(--color);
outline: 1px solid transparent; transform: translateY(calc(-50% - 0.25rem));
outline-offset: 2px; border-radius: 50%;
transition: all 0.1s ease-in-out; }
z-index: -1; }
background-color: currentColor; .document-preview {
overflow: hidden;
visibility: hidden;
margin-top: -0.5rem;
padding: 0;
max-height: 0;
background-color: var(--body-color);
border: 1px solid var(--divider-color);
border-radius: 0.5rem;
opacity: 0;
transition-property: margin-top, max-height, opacity;
transition-timing-function: ease-in-out;
transition-duration: 0.15s;
}
&.visible .document-preview {
visibility: visible;
margin-top: 0.5rem;
padding: 0.75rem 1rem;
max-height: max-content;
opacity: 1;
}
} }
</style> </style>

View File

@ -20,7 +20,7 @@
import core, { getCurrentAccount, WithLookup } from '@hcengineering/core' import core, { getCurrentAccount, WithLookup } from '@hcengineering/core'
import { Notification, NotificationStatus } from '@hcengineering/notification' import { Notification, NotificationStatus } from '@hcengineering/notification'
import { createQuery, getClient } from '@hcengineering/presentation' import { createQuery, getClient } from '@hcengineering/presentation'
import { ActionIcon, IconCheck, IconDelete, Scroller } from '@hcengineering/ui' import { Button, IconCheckAll, IconDelete, Scroller } from '@hcengineering/ui'
import Label from '@hcengineering/ui/src/components/Label.svelte' import Label from '@hcengineering/ui/src/components/Label.svelte'
import notification from '../plugin' import notification from '../plugin'
import NotificationView from './NotificationView.svelte' import NotificationView from './NotificationView.svelte'
@ -80,29 +80,32 @@
<div class="notifyPopup" class:justify-center={notifications.length === 0}> <div class="notifyPopup" class:justify-center={notifications.length === 0}>
<div class="header flex-between"> <div class="header flex-between">
<span class="fs-title overflow-label"><Label label={notification.string.Notifications} /></span> <span class="fs-title overflow-label"><Label label={notification.string.Notifications} /></span>
<div class="flex flex-gap-2"> {#if notifications.length > 0}
<ActionIcon <div class="buttons-group xxsmall-gap">
icon={IconCheck} <Button
label={notification.string.MarkAllAsRead} icon={IconCheckAll}
kind={'list'}
showTooltip={{ label: notification.string.MarkAllAsRead }}
size={'medium'} size={'medium'}
action={markAsReadNotifications} on:click={markAsReadNotifications}
/> />
<ActionIcon <Button
icon={IconDelete} icon={IconDelete}
label={notification.string.RemoveAll} kind={'list'}
showTooltip={{ label: notification.string.RemoveAll }}
size={'medium'} size={'medium'}
action={deleteNotifications} on:click={deleteNotifications}
/> />
</div> </div>
{/if}
</div> </div>
{#if notifications.length > 0} {#if notifications.length > 0}
<Scroller> <Scroller padding={'0 .5rem'}>
<div class="px-2 clear-mins">
{#each notifications as n} {#each notifications as n}
<NotificationView notification={n} {viewlets} /> <NotificationView notification={n} {viewlets} />
{/each} {/each}
</div>
</Scroller> </Scroller>
<div class="space x3" />
{:else} {:else}
<div class="flex-grow flex-center"> <div class="flex-grow flex-center">
<Label label={notification.string.NoNotifications} /> <Label label={notification.string.NoNotifications} />

View File

@ -73,8 +73,6 @@
async function removeTag (id: Ref<TagReference>): Promise<void> { async function removeTag (id: Ref<TagReference>): Promise<void> {
dispatch('delete', id) dispatch('delete', id)
} }
$: console.log('[!!!] items: ', items)
$: console.log('[!!!] items - count: ', items.length)
</script> </script>
<Button <Button

View File

@ -25,7 +25,8 @@
Label, Label,
Loading, Loading,
resizeObserver, resizeObserver,
showPopup showPopup,
deviceOptionsStore
} from '@hcengineering/ui' } from '@hcengineering/ui'
import { Filter } from '@hcengineering/view' import { Filter } from '@hcengineering/view'
import { FilterQuery } from '@hcengineering/view-resources' import { FilterQuery } from '@hcengineering/view-resources'
@ -80,7 +81,7 @@
}) })
onMount(() => { onMount(() => {
if (searchInput) searchInput.focus() if (searchInput && !$deviceOptionsStore.isMobile) searchInput.focus()
}) })
const toggleGroup = (ev: MouseEvent): void => { const toggleGroup = (ev: MouseEvent): void => {

View File

@ -27,7 +27,8 @@
IconClose, IconClose,
Label, Label,
showPopup, showPopup,
resizeObserver resizeObserver,
deviceOptionsStore
} from '@hcengineering/ui' } from '@hcengineering/ui'
import { createEventDispatcher, onMount } from 'svelte' import { createEventDispatcher, onMount } from 'svelte'
import tags from '../plugin' import tags from '../plugin'
@ -98,7 +99,7 @@
return '' return ''
} }
onMount(() => { onMount(() => {
if (searchElement) searchElement.focus() if (searchElement && !$deviceOptionsStore.isMobile) searchElement.focus()
}) })
const tagSort = (a: TagElement, b: TagElement) => { const tagSort = (a: TagElement, b: TagElement) => {
const r = (b.refCount ?? 0) - (a.refCount ?? 0) const r = (b.refCount ?? 0) - (a.refCount ?? 0)

View File

@ -17,7 +17,7 @@
import { createQuery } from '@hcengineering/presentation' import { createQuery } from '@hcengineering/presentation'
import { MessageTemplate } from '@hcengineering/templates' import { MessageTemplate } from '@hcengineering/templates'
import { TextEditorHandler } from '@hcengineering/text-editor' import { TextEditorHandler } from '@hcengineering/text-editor'
import { closePopup, EditWithIcon, IconSearch, Label } from '@hcengineering/ui' import { closePopup, EditWithIcon, IconSearch, Label, deviceOptionsStore } from '@hcengineering/ui'
import templates from '../plugin' import templates from '../plugin'
export let editor: TextEditorHandler export let editor: TextEditorHandler
@ -67,7 +67,12 @@
<svelte:window on:keydown={onKeyDown} /> <svelte:window on:keydown={onKeyDown} />
<div class="antiPopup template-popup"> <div class="antiPopup template-popup">
<div class="mt-4 mb-4"> <div class="mt-4 mb-4">
<EditWithIcon icon={IconSearch} bind:value={query} placeholder={templates.string.SearchTemplate} /> <EditWithIcon
icon={IconSearch}
bind:value={query}
placeholder={templates.string.SearchTemplate}
focus={!$deviceOptionsStore.isMobile}
/>
</div> </div>
<Label label={templates.string.Suggested} /> <Label label={templates.string.Suggested} />
<div class="scroll mt-2"> <div class="scroll mt-2">

View File

@ -15,7 +15,7 @@
<script lang="ts"> <script lang="ts">
import { afterUpdate, createEventDispatcher } from 'svelte' import { afterUpdate, createEventDispatcher } from 'svelte'
import ui, { Label, EditWithIcon, IconSearch } from '@hcengineering/ui' import ui, { Label, EditWithIcon, IconSearch, deviceOptionsStore } from '@hcengineering/ui'
import SpaceInfo from './SpaceInfo.svelte' import SpaceInfo from './SpaceInfo.svelte'
import type { Ref, Class, Space, DocumentQuery } from '@hcengineering/core' import type { Ref, Class, Space, DocumentQuery } from '@hcengineering/core'
@ -40,7 +40,12 @@
<div class="antiPopup antiPopup-withHeader"> <div class="antiPopup antiPopup-withHeader">
<div class="ap-space" /> <div class="ap-space" />
<div class="ap-header"> <div class="ap-header">
<EditWithIcon icon={IconSearch} bind:value={search} placeholder={ui.string.SearchDots} focus /> <EditWithIcon
icon={IconSearch}
bind:value={search}
placeholder={ui.string.SearchDots}
focus={!$deviceOptionsStore.isMobile}
/>
<div class="ap-caption"><Label label={ui.string.Suggested} /></div> <div class="ap-caption"><Label label={ui.string.Suggested} /></div>
</div> </div>
<div class="ap-space" /> <div class="ap-space" />

View File

@ -62,7 +62,7 @@
const space = typeof query.space === 'string' ? query.space : tracker.team.DefaultTeam const space = typeof query.space === 'string' ? query.space : tracker.team.DefaultTeam
const showCreateDialog = async () => { const showCreateDialog = async () => {
showPopup(NewProject, { space, targetElement: null }, null) showPopup(NewProject, { space, targetElement: null }, 'top')
} }
const handleViewModeChanged = (newMode: ProjectsViewMode) => { const handleViewModeChanged = (newMode: ProjectsViewMode) => {

View File

@ -67,7 +67,7 @@
const space = typeof query.space === 'string' ? query.space : tracker.team.DefaultTeam const space = typeof query.space === 'string' ? query.space : tracker.team.DefaultTeam
const showCreateDialog = async () => { const showCreateDialog = async () => {
showPopup(NewSprint, { space, targetElement: null }, null) showPopup(NewSprint, { space, targetElement: null }, 'top')
} }
const handleViewModeChanged = (newMode: SprintViewMode) => { const handleViewModeChanged = (newMode: SprintViewMode) => {

View File

@ -67,7 +67,7 @@
$: if (docWidth > 900 && docSize) docSize = false $: if (docWidth > 900 && docSize) docSize = false
const showCreateDialog = async () => { const showCreateDialog = async () => {
showPopup(CreateIssueTemplate, { targetElement: null }, null) showPopup(CreateIssueTemplate, { targetElement: null }, 'top')
} }
</script> </script>

View File

@ -18,7 +18,7 @@
import presentation, { getClient } from '@hcengineering/presentation' import presentation, { getClient } from '@hcengineering/presentation'
import type { State } from '@hcengineering/task' import type { State } from '@hcengineering/task'
import task from '@hcengineering/task' import task from '@hcengineering/task'
import ui, { Button, CheckBox, Label, Loading, resizeObserver } from '@hcengineering/ui' import ui, { Button, CheckBox, Label, Loading, resizeObserver, deviceOptionsStore } from '@hcengineering/ui'
import { Filter } from '@hcengineering/view' import { Filter } from '@hcengineering/view'
import { createEventDispatcher, onMount } from 'svelte' import { createEventDispatcher, onMount } from 'svelte'
import view from '../../plugin' import view from '../../plugin'
@ -127,7 +127,7 @@
}) })
onMount(() => { onMount(() => {
if (searchInput) searchInput.focus() if (searchInput && !$deviceOptionsStore.isMobile) searchInput.focus()
}) })
const dispatch = createEventDispatcher() const dispatch = createEventDispatcher()

View File

@ -91,6 +91,7 @@ export {
buildModel, buildModel,
getCollectionCounter, getCollectionCounter,
getObjectPresenter, getObjectPresenter,
getObjectPreview,
LoadingProps, LoadingProps,
setActiveViewletId, setActiveViewletId,
getActiveViewletId, getActiveViewletId,