From 36bc394e7affdb2d2561a69357172f4f9b26019c Mon Sep 17 00:00:00 2001 From: Vyacheslav Tumanov Date: Thu, 29 Feb 2024 19:40:00 +0500 Subject: [PATCH] Use logo for workspaces (#4828) Signed-off-by: Vyacheslav Tumanov --- models/setting/src/index.ts | 22 ++++- .../src/components/EditAvatarPopup.svelte | 3 +- .../src/components/EditableAvatar.svelte | 4 + .../src/components/SelectAvatarPopup.svelte | 20 ++-- plugins/contact-resources/src/utils.ts | 10 +- .../src/components/Cropper.svelte | 6 +- plugins/setting-assets/lang/en.json | 3 +- plugins/setting-assets/lang/ru.json | 3 +- .../src/components/WorkspaceSetting.svelte | 91 +++++++++++++++++++ plugins/setting-resources/src/index.ts | 2 + plugins/setting/src/index.ts | 15 ++- .../src/components/Logo.svelte | 30 +++++- 12 files changed, 193 insertions(+), 16 deletions(-) create mode 100644 plugins/setting-resources/src/components/WorkspaceSetting.svelte diff --git a/models/setting/src/index.ts b/models/setting/src/index.ts index f2c3212265..4de7cebdab 100644 --- a/models/setting/src/index.ts +++ b/models/setting/src/index.ts @@ -28,6 +28,7 @@ import { type Integration, type IntegrationType, type InviteSettings, + type WorkspaceSetting, type SettingsCategory, type UserMixin } from '@hcengineering/setting' @@ -99,6 +100,11 @@ export class TInviteSettings extends TConfiguration implements InviteSettings { limit!: number } +@Model(setting.class.WorkspaceSetting, core.class.Doc, DOMAIN_SETTING) +export class TWorkspaceSetting extends TDoc implements WorkspaceSetting { + icon?: string +} + export function createModel (builder: Builder): void { builder.createModel( TIntegration, @@ -107,7 +113,8 @@ export function createModel (builder: Builder): void { TWorkspaceSettingCategory, TEditable, TUserMixin, - TInviteSettings + TInviteSettings, + TWorkspaceSetting ) builder.mixin(setting.class.Integration, core.class.Class, notification.mixin.ClassCollaborators, { @@ -205,6 +212,19 @@ export function createModel (builder: Builder): void { }, setting.ids.Configure ) + builder.createDoc( + setting.class.WorkspaceSettingCategory, + core.space.Model, + { + name: 'workspaceSettings', + label: setting.string.Branding, + icon: setting.icon.AccountSettings, + component: setting.component.WorkspaceSetting, + order: 1002, + secured: true + }, + setting.ids.WorkspaceSetting + ) builder.createDoc( setting.class.WorkspaceSettingCategory, core.space.Model, diff --git a/plugins/contact-resources/src/components/EditAvatarPopup.svelte b/plugins/contact-resources/src/components/EditAvatarPopup.svelte index 116d488db9..d23179a00c 100644 --- a/plugins/contact-resources/src/components/EditAvatarPopup.svelte +++ b/plugins/contact-resources/src/components/EditAvatarPopup.svelte @@ -20,6 +20,7 @@ import presentation from '@hcengineering/presentation' export let file: Blob + export let lessCrop: boolean = false let inputRef: HTMLInputElement const targetMimes = ['image/png', 'image/jpg', 'image/jpeg'] @@ -64,7 +65,7 @@
{#await CropperP then Cropper}
- +