mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-07 10:17:42 +02:00
Support for rating system (#10124)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
@@ -16,8 +16,9 @@
|
||||
import contact, { formatName, getCurrentEmployee } from '@hcengineering/contact'
|
||||
import { myEmployeeStore } from '@hcengineering/contact-resources'
|
||||
import core, { AccountRole, getCurrentAccount, hasAccountRole } from '@hcengineering/core'
|
||||
import rating, { type PersonRating } from '@hcengineering/rating'
|
||||
import login, { loginId } from '@hcengineering/login'
|
||||
import { createQuery, getCurrentWorkspaceUrl } from '@hcengineering/presentation'
|
||||
import { createQuery, getCurrentWorkspaceUrl, hasResource } from '@hcengineering/presentation'
|
||||
import setting, { settingId, SettingsCategory } from '@hcengineering/setting'
|
||||
import {
|
||||
Action,
|
||||
@@ -36,6 +37,7 @@
|
||||
import HelpAndSupport from './HelpAndSupport.svelte'
|
||||
import { Analytics } from '@hcengineering/analytics'
|
||||
import { allowGuestSignUpStore } from '@hcengineering/view-resources'
|
||||
import { getClient } from '@hcengineering/account-client'
|
||||
|
||||
let items: SettingsCategory[] = []
|
||||
|
||||
@@ -197,6 +199,16 @@
|
||||
}
|
||||
let menu: Menu
|
||||
$: addClass = $deviceInfo.isMobile && $deviceInfo.isPortrait ? 'self-end' : undefined
|
||||
|
||||
const levelQuery = createQuery()
|
||||
|
||||
let personRating: PersonRating | undefined
|
||||
|
||||
levelQuery.query(rating.class.PersonRating, { accountId: getCurrentAccount().uuid }, (res) => {
|
||||
personRating = res[0]
|
||||
})
|
||||
|
||||
const hasRating = hasResource(rating.component.RatingRing)
|
||||
</script>
|
||||
|
||||
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
||||
@@ -222,15 +234,24 @@
|
||||
{/if}
|
||||
<div class="ml-2 flex-col">
|
||||
{#if person}
|
||||
<div class="overflow-label fs-bold caption-color">
|
||||
<div class="overflow-label fs-bold caption-color" class:mt-2={hasRating}>
|
||||
{formatName(person.name)}
|
||||
</div>
|
||||
<!-- TODO: Show current primary social id? -->
|
||||
<!-- <div class="overflow-label text-sm content-dark-color">{account.email}</div> -->
|
||||
{#if hasRating}
|
||||
<div class="flex-row-center text-sm">
|
||||
<Component
|
||||
is={rating.component.RatingRing}
|
||||
props={{ rating: personRating?.rating ?? 0, showValues: true }}
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div class="ap-menuItem separator" />
|
||||
</svelte:fragment>
|
||||
</svelte:component>
|
||||
|
||||
@@ -14,12 +14,13 @@
|
||||
-->
|
||||
<script lang="ts">
|
||||
import contact from '@hcengineering/contact'
|
||||
import { isArchivingMode, WorkspaceInfoWithStatus } from '@hcengineering/core'
|
||||
import { isArchivingMode, systemAccountUuid, WorkspaceInfoWithStatus } from '@hcengineering/core'
|
||||
import login from '@hcengineering/login'
|
||||
import { getMetadata, getResource } from '@hcengineering/platform'
|
||||
import presentation, { decodeTokenPayload, isAdminUser } from '@hcengineering/presentation'
|
||||
import presentation, { createQuery, decodeTokenPayload, hasResource, isAdminUser } from '@hcengineering/presentation'
|
||||
import {
|
||||
closePopup,
|
||||
Component,
|
||||
fetchMetadataLocalStorage,
|
||||
getCurrentLocation,
|
||||
Icon,
|
||||
@@ -39,6 +40,8 @@
|
||||
import { onDestroy, onMount } from 'svelte'
|
||||
|
||||
import { Analytics } from '@hcengineering/analytics'
|
||||
import type { PersonRating } from '@hcengineering/rating'
|
||||
import ratingPlugin from '@hcengineering/rating'
|
||||
import { workspacesStore } from '../utils'
|
||||
// import Drag from './icons/Drag.svelte'
|
||||
|
||||
@@ -48,6 +51,16 @@
|
||||
})
|
||||
})
|
||||
|
||||
const levelQuery = createQuery()
|
||||
|
||||
let sysRating: PersonRating | undefined
|
||||
|
||||
levelQuery.query(ratingPlugin.class.PersonRating, { accountId: systemAccountUuid }, (res) => {
|
||||
sysRating = res[0]
|
||||
})
|
||||
|
||||
const hasRating = hasResource(ratingPlugin.component.RatingRing)
|
||||
|
||||
function getWorkspaceLink (ws: WorkspaceInfoWithStatus): string {
|
||||
const loc: Location = {
|
||||
path: [workbenchId, ws.url]
|
||||
@@ -145,6 +158,24 @@
|
||||
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
||||
<div class="antiPopup" on:keydown={keyDown}>
|
||||
<div class="ap-space x2" />
|
||||
|
||||
<div class="p-2 ml-2 mr-2 mb-2 flex-grow flex flex-col">
|
||||
<div class="text-lg font-bold">
|
||||
{getMetadata(presentation.metadata.WorkspaceName) ?? ''}
|
||||
</div>
|
||||
{#if hasRating}
|
||||
<div class="flex-row-center text-sm">
|
||||
<Component
|
||||
is={ratingPlugin.component.RatingRing}
|
||||
props={{ rating: sysRating?.rating ?? 0, showValues: true }}
|
||||
/>
|
||||
</div>
|
||||
<div class="flex-row-center mt-2">
|
||||
<Component is={ratingPlugin.component.RatingActivities} props={{ rating: sysRating }} />
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
{#if isAdmin}
|
||||
<div class="p-2 ml-2 mr-2 mb-2 flex-grow flex-row-center">
|
||||
<SearchEdit bind:value={search} width={'100%'} />
|
||||
|
||||
Reference in New Issue
Block a user