From 00e160ad8632306049304d3241844ca8e638f0f9 Mon Sep 17 00:00:00 2001
From: Denis Bykhov <bykhov.denis@gmail.com>
Date: Thu, 1 Jun 2023 22:35:21 +0600
Subject: [PATCH] Remove Reminders button from workspace. (#3319)

---
 .../src/components/RemindersPopup.svelte      | 54 -------------------
 plugins/calendar-resources/src/index.ts       |  2 -
 plugins/calendar/src/index.ts                 |  3 +-
 .../src/components/Workbench.svelte           | 13 +----
 4 files changed, 3 insertions(+), 69 deletions(-)
 delete mode 100644 plugins/calendar-resources/src/components/RemindersPopup.svelte

diff --git a/plugins/calendar-resources/src/components/RemindersPopup.svelte b/plugins/calendar-resources/src/components/RemindersPopup.svelte
deleted file mode 100644
index b976b80752..0000000000
--- a/plugins/calendar-resources/src/components/RemindersPopup.svelte
+++ /dev/null
@@ -1,54 +0,0 @@
-<!--
-// Copyright © 2022 Hardcore Engineering Inc.
-//
-// Licensed under the Eclipse Public License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License. You may
-// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-//
-// See the License for the specific language governing permissions and
-// limitations under the License.
--->
-<script lang="ts">
-  import { EmployeeAccount } from '@hcengineering/contact'
-  import { getCurrentAccount } from '@hcengineering/core'
-  import { Table } from '@hcengineering/view-resources'
-  import { createQuery } from '@hcengineering/presentation'
-  import { Label, Scroller, deviceOptionsStore as deviceInfo } from '@hcengineering/ui'
-  import calendar from '../plugin'
-
-  const currentUser = getCurrentAccount() as EmployeeAccount
-  let remindersCount: number = 0
-
-  const query = createQuery()
-  $: query.query(calendar.mixin.Reminder, { state: 'active', participants: currentUser.employee }, (res) => {
-    remindersCount = res.length
-  })
-  $: isMobile = $deviceInfo.isMobile
-</script>
-
-<div class="notifyPopup" class:justify-center={!remindersCount} class:min-w-168={!isMobile}>
-  <div class="header">
-    <span class="fs-title overflow-label"><Label label={calendar.string.Reminders} /></span>
-  </div>
-  {#if remindersCount}
-    <Scroller>
-      <div class="px-4 clear-mins">
-        <Table
-          _class={calendar.mixin.Reminder}
-          config={['']}
-          options={{}}
-          query={{ state: 'active', participants: currentUser.employee }}
-          hiddenHeader
-        />
-      </div>
-    </Scroller>
-  {:else}
-    <div class="flex-grow flex-center">
-      <Label label={calendar.string.NoReminders} />
-    </div>
-  {/if}
-</div>
diff --git a/plugins/calendar-resources/src/index.ts b/plugins/calendar-resources/src/index.ts
index faebd94644..118ae59864 100644
--- a/plugins/calendar-resources/src/index.ts
+++ b/plugins/calendar-resources/src/index.ts
@@ -25,7 +25,6 @@ import Events from './components/Events.svelte'
 import ReminderPresenter from './components/ReminderPresenter.svelte'
 import ReminderViewlet from './components/activity/ReminderViewlet.svelte'
 import EditEvent from './components/EditEvent.svelte'
-import RemindersPopup from './components/RemindersPopup.svelte'
 import EventPresenter from './components/EventPresenter.svelte'
 import CreateEvent from './components/CreateEvent.svelte'
 
@@ -49,7 +48,6 @@ export default async (): Promise<Resources> => ({
     Events,
     DateTimePresenter,
     DocReminder,
-    RemindersPopup,
     EventPresenter,
     CreateEvent
   },
diff --git a/plugins/calendar/src/index.ts b/plugins/calendar/src/index.ts
index 3141d0bf6d..9e8d32fab4 100644
--- a/plugins/calendar/src/index.ts
+++ b/plugins/calendar/src/index.ts
@@ -85,8 +85,7 @@ const calendarPlugin = plugin(calendarId, {
     PersonsPresenter: '' as AnyComponent,
     Events: '' as AnyComponent,
     DateTimePresenter: '' as AnyComponent,
-    DocReminder: '' as AnyComponent,
-    RemindersPopup: '' as AnyComponent
+    DocReminder: '' as AnyComponent
   },
   string: {
     Title: '' as IntlString,
diff --git a/plugins/workbench-resources/src/components/Workbench.svelte b/plugins/workbench-resources/src/components/Workbench.svelte
index 349e1e70e8..07827d7b57 100644
--- a/plugins/workbench-resources/src/components/Workbench.svelte
+++ b/plugins/workbench-resources/src/components/Workbench.svelte
@@ -13,15 +13,13 @@
 // limitations under the License.
 -->
 <script lang="ts">
-  import calendar, { calendarId } from '@hcengineering/calendar'
   import contact, { Employee, EmployeeAccount } from '@hcengineering/contact'
   import core, { Class, Doc, Ref, Space, getCurrentAccount, setCurrentAccount } from '@hcengineering/core'
   import login from '@hcengineering/login'
   import notification, { notificationId } from '@hcengineering/notification'
   import { BrowserNotificatator, NotificationClientImpl } from '@hcengineering/notification-resources'
   import { IntlString, getMetadata, getResource } from '@hcengineering/platform'
-  import { ActionContext, configurationStore, createQuery, getClient } from '@hcengineering/presentation'
-  import { resolvedLocationStore } from '@hcengineering/ui'
+  import { ActionContext, createQuery, getClient } from '@hcengineering/presentation'
   import {
     AnyComponent,
     CompAndProps,
@@ -46,6 +44,7 @@
     openPanel,
     popupstore,
     resizeObserver,
+    resolvedLocationStore,
     setResolvedLocation,
     showPopup
   } from '@hcengineering/ui'
@@ -604,14 +603,6 @@
             notify={hasNotification}
           />
         </NavLink>
-        {#if $configurationStore.has(calendarId)}
-          <div class="spacer" />
-          <AppItem
-            icon={calendar.icon.Notifications}
-            label={calendar.string.Reminders}
-            on:click={() => showPopup(calendar.component.RemindersPopup, {}, notifyPosition)}
-          />
-        {/if}
         <div class="divider" />
         <Applications
           apps={getApps(apps)}