From 792c35bcc167eea80dd3d617050f1141b2e5913b Mon Sep 17 00:00:00 2001 From: Alexander Platov Date: Fri, 2 Jun 2023 10:10:26 +0300 Subject: [PATCH] UBER-345: fixed Inbox. (#3325) Signed-off-by: Alexander Platov --- packages/theme/styles/common.scss | 1 + packages/theme/styles/components.scss | 28 +++++--- packages/ui/src/components/Tabs.svelte | 4 +- packages/ui/src/components/TabsControl.svelte | 10 +-- .../src/components/Activity.svelte | 19 ++++++ .../src/components/EmployeeInbox.svelte | 68 ++++++++++++------- .../src/components/Inbox.svelte | 4 +- .../src/components/NotificationView.svelte | 8 ++- .../components/PeopleNotificationsView.svelte | 63 +---------------- 9 files changed, 94 insertions(+), 111 deletions(-) diff --git a/packages/theme/styles/common.scss b/packages/theme/styles/common.scss index 9d931d8bbc..067d284813 100644 --- a/packages/theme/styles/common.scss +++ b/packages/theme/styles/common.scss @@ -51,6 +51,7 @@ min-height: 0; overflow: hidden; + &.header { background-color: var(--theme-comp-header-color); } &.filled { background-color: var(--theme-bg-color); } &.filledNav { background-color: var(--theme-navpanel-color); } &.border-left { border-left: 1px solid var(--theme-divider-color); } diff --git a/packages/theme/styles/components.scss b/packages/theme/styles/components.scss index b77fe3e40b..2dd7d69a6d 100644 --- a/packages/theme/styles/components.scss +++ b/packages/theme/styles/components.scss @@ -794,16 +794,11 @@ .inbox-activity__content { display: flex; flex-direction: column; - // flex-grow: 1; color: var(--theme-caption-color); &.shrink { padding: .75rem 0; } &:not(.shrink) { padding: 1rem 0; } - &.read { - opacity: .6; - - .time { color: var(--theme-content-color); } - } + // &.read {} } .time { color: var(--theme-halfcontent-color); } @@ -815,8 +810,11 @@ width: 0.5rem; background-color: var(--theme-inbox-notify); border-radius: 50%; - - &.people { background-color: var(--theme-inbox-counter-bgcolor); } + + &.people { + top: 1.5rem; + background-color: var(--theme-inbox-people-notify); + } } .counter { display: flex; @@ -835,7 +833,7 @@ } &.people { color: var(--theme-inbox-people-notify); - background-color: var(--theme-inbox-counter-bgcolor); + background-color: var(--theme-inbox-people-counter-bgcolor); } } .arrow { @@ -854,8 +852,16 @@ border-radius: 0.25rem; .notify { left: .125rem; } - .inbox-activity__content { padding: 1rem 1.25rem; } - .counter.float { right: 1.25rem; } + .inbox-activity__content { + padding: 1rem 1.25rem; + + &.shrink { padding: .75rem 1.25rem; } + } + .counter { + visibility: hidden; + + &.float { right: 1.25rem; } + } .arrow { right: 1.25rem; } } } diff --git a/packages/ui/src/components/Tabs.svelte b/packages/ui/src/components/Tabs.svelte index 892b221fff..feb9c0fcf3 100644 --- a/packages/ui/src/components/Tabs.svelte +++ b/packages/ui/src/components/Tabs.svelte @@ -19,12 +19,12 @@ export let model: TabModel export let selected = 0 - export let withPadding: boolean = false + export let padding: string | undefined = undefined export let noMargin: boolean = false export let size: 'small' | 'medium' = 'medium' - + {#if $$slots.rightButtons}
diff --git a/packages/ui/src/components/TabsControl.svelte b/packages/ui/src/components/TabsControl.svelte index 5f45d636d5..40db73429e 100644 --- a/packages/ui/src/components/TabsControl.svelte +++ b/packages/ui/src/components/TabsControl.svelte @@ -18,18 +18,12 @@ export let model: TabBase[] export let selected = 0 - export let withPadding: boolean = false + export let padding: string | undefined = undefined export let noMargin: boolean = false export let size: 'small' | 'medium' = 'medium' -
+
{#each model as tab, i}
{ selected = i }} diff --git a/plugins/notification-resources/src/components/EmployeeInbox.svelte b/plugins/notification-resources/src/components/EmployeeInbox.svelte index 1968a5e341..e10074d12c 100644 --- a/plugins/notification-resources/src/components/EmployeeInbox.svelte +++ b/plugins/notification-resources/src/components/EmployeeInbox.svelte @@ -136,6 +136,24 @@ dispatch('dm', id) } } + + function onKeydown (key: KeyboardEvent): void { + if (key.code === 'ArrowUp') { + key.stopPropagation() + key.preventDefault() + selected-- + } + if (key.code === 'ArrowDown') { + key.stopPropagation() + key.preventDefault() + selected++ + } + if (key.code === 'Enter') { + key.preventDefault() + key.stopPropagation() + changeSelected(selected) + } + }
-
- { - dispatch('close') - }} - /> +
+
+ { + dispatch('close') + }} + /> +
{#if employee} - - {getName(employee)} + + {getName(employee)} {/if} {#if newTxes > 0} -
+ {newTxes} -
+ {/if}
{#if me !== accountId} -
-
+
-
- +
+ {#if loading} {:else} @@ -178,6 +196,7 @@ value={item} selected={selected === i} {viewlets} + on:keydown={onKeydown} on:click={() => { selected = i changeSelected(selected) @@ -190,18 +209,21 @@ diff --git a/plugins/notification-resources/src/components/Inbox.svelte b/plugins/notification-resources/src/components/Inbox.svelte index e5b51f50af..c36af78eb3 100644 --- a/plugins/notification-resources/src/components/Inbox.svelte +++ b/plugins/notification-resources/src/components/Inbox.svelte @@ -84,7 +84,7 @@
{#if visibileNav} -
+
{#if selectedEmployee === undefined} { selectedEmployee = e.detail }} - withPadding + padding={'0 1.75rem'} noMargin size="small" > diff --git a/plugins/notification-resources/src/components/NotificationView.svelte b/plugins/notification-resources/src/components/NotificationView.svelte index b67fc42568..12f883f7f3 100644 --- a/plugins/notification-resources/src/components/NotificationView.svelte +++ b/plugins/notification-resources/src/components/NotificationView.svelte @@ -63,17 +63,19 @@ function showMenu (e: MouseEvent) { showPopup(Menu, { object: value, baseMenuClass: value._class }, getEventPositionElement(e)) } + + let div: HTMLDivElement + $: if (selected && div !== undefined) div.focus() {#if doc} -
+
{#if newTxes > 0 && !selected}
{/if}
{#if presenter} diff --git a/plugins/notification-resources/src/components/PeopleNotificationsView.svelte b/plugins/notification-resources/src/components/PeopleNotificationsView.svelte index a40498dc2f..b1cd4a7044 100644 --- a/plugins/notification-resources/src/components/PeopleNotificationsView.svelte +++ b/plugins/notification-resources/src/components/PeopleNotificationsView.svelte @@ -85,7 +85,7 @@ > {#if newTxes > 0 && !selected}
{/if} -
+
{#if employee} @@ -124,64 +124,3 @@
{/if} - -