Support disabled employee presenter (#2758)

* Support disabled employee presenter

Signed-off-by: Anton Brechka <anton.brechka@ezthera.com>

* Added DocNavLink

Signed-off-by: Anton Brechka <anton.brechka@ezthera.com>

* Remove unused condition

Signed-off-by: Anton Brechka <anton.brechka@ezthera.com>

---------

Signed-off-by: Anton Brechka <anton.brechka@ezthera.com>
This commit is contained in:
mrsadman99 2023-03-20 16:03:34 +07:00 committed by GitHub
parent ae84626521
commit 9460e7a406
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 27 deletions

View File

@ -20,9 +20,11 @@
import { Avatar } from '@hcengineering/presentation'
import { showPopup, tooltip } from '@hcengineering/ui'
import { EditDoc } from '@hcengineering/view-resources'
import DocNavLink from '@hcengineering/view-resources/src/components/DocNavLink.svelte'
import { employeeByIdStore } from '../utils'
export let value: Account
export let disabled = false
$: employee = $employeeByIdStore.get((value as EmployeeAccount).employee)
@ -35,34 +37,22 @@
{#if value}
<!-- svelte-ignore a11y-click-events-have-key-events -->
<div
class="flex-row-center"
class:user-container={employee !== undefined}
on:click={onClick}
use:tooltip={{ label: getEmbeddedLabel(employee ? getName(employee) : value.email) }}
>
<DocNavLink object={value} disableClick={disabled} noUnderline={disabled} {onClick}>
<span class="flex-row-center" use:tooltip={{ label: getEmbeddedLabel(employee ? getName(employee) : value.email) }}>
{#if employee}
<Avatar size={'x-small'} avatar={employee.avatar} />
<div class="overflow-label user">{getName(employee)}</div>
<span class="overflow-label user">{getName(employee)}</span>
{:else}
<div class="overflow-label user">{value.email}</div>
<span class="overflow-label user">{value.email}</span>
{/if}
</div>
</span>
</DocNavLink>
{/if}
<style lang="scss">
.user-container {
cursor: pointer;
.user {
margin-left: 0.5rem;
font-weight: 500;
text-align: left;
color: var(--accent-color);
}
&:hover .user {
text-decoration: underline;
color: var(--caption-color);
}
}
</style>

View File

@ -21,6 +21,7 @@
import EmployeeAccountPresenter from './EmployeeAccountPresenter.svelte'
export let value: Ref<EmployeeAccount>
export let disabled = false
let account: EmployeeAccount | undefined
@ -30,5 +31,5 @@
</script>
{#if account}
<EmployeeAccountPresenter value={account} />
<EmployeeAccountPresenter value={account} {disabled} />
{/if}