Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov 2023-10-03 14:13:41 +06:00 committed by GitHub
parent 67ac21aa18
commit 89c841b424
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 20 additions and 23 deletions

View File

@ -21,6 +21,7 @@ import { Project, TimeReportDayType, createStatuses } from '@hcengineering/track
import { DOMAIN_TRACKER } from '.'
import tracker from './plugin'
import { DOMAIN_SPACE } from '@hcengineering/model-core'
import view from '@hcengineering/view'
async function createDefaultProject (tx: TxOperations): Promise<void> {
const current = await tx.findOne(tracker.class.Project, {
@ -73,12 +74,11 @@ async function createDefaults (tx: TxOperations): Promise<void> {
)
}
async function fixProjectIcons (tx: TxOperations): Promise<void> {
// @ts-expect-error
const projectsWithWrongIcon = await tx.findAll(tracker.class.Project, { icon: 'tracker:component:IconWithEmojii' })
async function fixIconsWithEmojis (tx: TxOperations): Promise<void> {
const projectsWithWrongIcon = await tx.findAll(tracker.class.Project, { icon: tracker.component.IconWithEmoji })
const promises = []
for (const project of projectsWithWrongIcon) {
promises.push(tx.update(project, { icon: tracker.component.IconWithEmoji }))
promises.push(tx.update(project, { icon: view.ids.IconWithEmoji }))
}
await Promise.all(promises)
}
@ -120,6 +120,6 @@ export const trackerOperation: MigrateOperation = {
async upgrade (client: MigrationUpgradeClient): Promise<void> {
const tx = new TxOperations(client, core.account.System)
await createDefaults(tx)
await fixProjectIcons(tx)
await fixIconsWithEmojis(tx)
}
}

View File

@ -567,7 +567,6 @@
kind={'regular'}
size={'small'}
component={ProjectPresenter}
iconWithEmoji={tracker.component.IconWithEmoji}
defaultIcon={tracker.icon.Home}
/>
<ObjectBox

View File

@ -58,7 +58,6 @@
kind={'regular'}
size={'large'}
component={ProjectPresenter}
iconWithEmoji={tracker.component.IconWithEmoji}
defaultIcon={tracker.icon.Home}
/>
</svelte:fragment>

View File

@ -305,7 +305,6 @@
kind={'regular'}
size={'large'}
component={ProjectPresenter}
iconWithEmoji={tracker.component.IconWithEmoji}
defaultIcon={tracker.icon.Home}
/>
<Button

View File

@ -59,7 +59,6 @@
size={'large'}
bind:space
component={ProjectPresenter}
iconWithEmoji={tracker.component.IconWithEmoji}
defaultIcon={tracker.icon.Home}
/>
</svelte:fragment>

View File

@ -47,6 +47,7 @@
import { createEventDispatcher } from 'svelte'
import tracker from '../../plugin'
import ChangeIdentity from './ChangeIdentity.svelte'
import view from '@hcengineering/view'
export let project: Project | undefined = undefined
@ -184,7 +185,7 @@
function chooseIcon (ev: MouseEvent) {
const icons = [tracker.icon.Home, tracker.icon.RedCircle]
showPopup(IconPicker, { icon, color, icons, iconWithEmoji: tracker.component.IconWithEmoji }, 'top', (result) => {
showPopup(IconPicker, { icon, color, icons }, 'top', (result) => {
if (result !== undefined && result !== null) {
icon = result.icon
color = result.color
@ -294,8 +295,8 @@
<Label label={tracker.string.ChooseIcon} />
</div>
<Button
icon={icon === tracker.component.IconWithEmoji ? IconWithEmoji : icon ?? tracker.icon.Home}
iconProps={icon === tracker.component.IconWithEmoji
icon={icon === view.ids.IconWithEmoji ? IconWithEmoji : icon ?? tracker.icon.Home}
iconProps={icon === view.ids.IconWithEmoji
? { icon: color }
: {
fill:

View File

@ -18,6 +18,7 @@
import { Project } from '@hcengineering/tracker'
import { Icon, IconWithEmoji, getPlatformColorDef, getPlatformColorForTextDef, themeStore } from '@hcengineering/ui'
import tracker from '../../plugin'
import view from '@hcengineering/view'
export let value: [Ref<Project>, Ref<Project>[]][]
@ -36,10 +37,9 @@
<div class="flex-presenter flex-gap-1-5">
{#each projects as project, i}
{#if value && i < MAX_VISIBLE_PROJECTS}
{@const icon =
project.icon === tracker.component.IconWithEmoji ? IconWithEmoji : project.icon ?? tracker.icon.Home}
{@const icon = project.icon === view.ids.IconWithEmoji ? IconWithEmoji : project.icon ?? tracker.icon.Home}
{@const iconProps =
project.icon === tracker.component.IconWithEmoji
project.icon === view.ids.IconWithEmoji
? { icon: project.color }
: {
fill:

View File

@ -16,6 +16,7 @@
import { Project } from '@hcengineering/tracker'
import { Icon, IconWithEmoji, getPlatformColorDef, getPlatformColorForTextDef, themeStore } from '@hcengineering/ui'
import tracker from '../../plugin'
import view from '@hcengineering/view'
export let value: Project | undefined
export let inline: boolean = false
@ -24,10 +25,10 @@
{#if value}
<div class="flex-presenter cursor-default" class:inline-presenter={inline}>
<div class="icon" class:emoji={value.icon === tracker.component.IconWithEmoji}>
<div class="icon" class:emoji={value.icon === view.ids.IconWithEmoji}>
<Icon
icon={value.icon === tracker.component.IconWithEmoji ? IconWithEmoji : value.icon ?? tracker.icon.Home}
iconProps={value.icon === tracker.component.IconWithEmoji
icon={value.icon === view.ids.IconWithEmoji ? IconWithEmoji : value.icon ?? tracker.icon.Home}
iconProps={value.icon === view.ids.IconWithEmoji
? { icon: value.color }
: {
fill:

View File

@ -14,6 +14,7 @@
-->
<script lang="ts">
import { Ref, Space } from '@hcengineering/core'
import { getResource } from '@hcengineering/platform'
import { Project } from '@hcengineering/tracker'
import {
IconWithEmoji,
@ -22,11 +23,10 @@
getPlatformColorForTextDef,
themeStore
} from '@hcengineering/ui'
import view from '@hcengineering/view'
import { NavLink, TreeNode } from '@hcengineering/view-resources'
import { SpacesNavModel, SpecialNavModel } from '@hcengineering/workbench'
import { SpecialElement } from '@hcengineering/workbench-resources'
import tracker from '../../plugin'
import { getResource } from '@hcengineering/platform'
export let space: Project
export let model: SpacesNavModel
@ -66,8 +66,8 @@
<TreeNode
{collapsed}
_id={space?._id}
icon={space?.icon === tracker.component.IconWithEmoji ? IconWithEmoji : space?.icon ?? model.icon}
iconProps={space?.icon === tracker.component.IconWithEmoji
icon={space?.icon === view.ids.IconWithEmoji ? IconWithEmoji : space?.icon ?? model.icon}
iconProps={space?.icon === view.ids.IconWithEmoji
? { icon: space.color }
: {
fill:

View File

@ -140,7 +140,6 @@
kind={'regular'}
size={'large'}
component={ProjectPresenter}
iconWithEmoji={tracker.component.IconWithEmoji}
defaultIcon={tracker.icon.Home}
/>
</svelte:fragment>