From 35be71c1826f44dee32087a17f9d0f02c15fa1fb Mon Sep 17 00:00:00 2001 From: Alexander Platov Date: Wed, 18 Dec 2024 07:34:06 +0300 Subject: [PATCH] Adaptive button in the Status Bar (#7497) Signed-off-by: Alexander Platov --- packages/theme/styles/button.scss | 42 ++++++++ packages/theme/styles/components.scss | 61 +++++++++++ packages/ui/src/components/ModernTab.svelte | 2 +- .../src/components/CombineAvatars.svelte | 83 +------------- .../src/components/ControlExt.svelte | 101 ++++-------------- .../src/components/ParticipantsList.svelte | 42 ++++++++ .../src/components/RoomButton.svelte | 76 +++++++++++++ 7 files changed, 244 insertions(+), 163 deletions(-) create mode 100644 plugins/love-resources/src/components/ParticipantsList.svelte create mode 100644 plugins/love-resources/src/components/RoomButton.svelte diff --git a/packages/theme/styles/button.scss b/packages/theme/styles/button.scss index df341e369a..71810660f2 100644 --- a/packages/theme/styles/button.scss +++ b/packages/theme/styles/button.scss @@ -171,6 +171,48 @@ & > * { pointer-events: none; } } +// StatusBar Button +.hulyStatusBarButton, +.hulyStatusBarButton .hulyStatusBarButton-icons { + display: flex; + align-items: center; + flex-wrap: nowrap; + min-width: 0; + min-height: 0; +} +.hulyStatusBarButton { + gap: var(--spacing-1); + padding: var(--spacing-0_25) var(--spacing-0_25) var(--spacing-0_25) var(--spacing-1); + height: 1.625rem; + font-weight: 500; + background-color: var(--theme-button-pressed); + border: 1px solid transparent; + border-radius: var(--extra-small-BorderRadius); + cursor: pointer; + + &-label { + white-space: nowrap; + word-break: break-all; + text-overflow: ellipsis; + overflow: hidden; + min-width: 0; + font-weight: 700; + color: var(--theme-caption-color); + } + &-icons { gap: var(--spacing-0_25); } + &:hover { + background-color: var(--theme-button-hovered); + border-color: var(--theme-navpanel-divider); + } + &.active { + order: -1; + background-color: var(--highlight-select); + border-color: var(--highlight-select-border); + + &:hover { background-color: var(--highlight-select-hover); } + } +} + // Old style Button .antiButton { display: flex; diff --git a/packages/theme/styles/components.scss b/packages/theme/styles/components.scss index 924821fcda..af256ddde6 100644 --- a/packages/theme/styles/components.scss +++ b/packages/theme/styles/components.scss @@ -317,6 +317,67 @@ } } +/* CombineAvatars */ +.hulyCombineAvatars-container { + display: flex; + align-items: center; + + .hulyCombineAvatar { + &.inline:not(:first-child) { margin-left: calc(1px - (0.875rem / 2)); } + &.tiny:not(:first-child) { margin-left: calc(1px - (1.13rem / 2)); } + &.card:not(:first-child) { margin-left: calc(1px - (1.25rem / 2)); } + &.x-small:not(:first-child) { margin-left: calc(1px - (1.5rem / 2)); } + &.smaller:not(:first-child) { margin-left: calc(1px - (1.75rem / 2)); } + &.small:not(:first-child) { margin-left: calc(1px - 1rem); } + &.medium:not(:first-child) { margin-left: calc(1px - (2.25rem / 2)); } + &.large:not(:first-child) { margin-left: calc(1px - (4.5rem / 2)); } + &.x-large:not(:first-child) { margin-left: calc(1px - (7.5rem / 2)); } + + &.inline, + &.tiny, + &.card, + &.x-small { font-size: 0.625rem; } + + &.inline, + &.tiny, + &.card, + &.x-small, + &.smaller, + &.small { + &:not(:last-child) { + mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M16,24.5v-17c0-3.2,1.8-6.1,4.5-7.5H8C3.6,0,0,3.6,0,8v16c0,4.4,3.6,8,8,8h12.5C17.8,30.6,16,27.7,16,24.5z'/%3E%3C/svg%3E%0A") no-repeat; + } + } + + &[data-over^='+']:last-child { + position: relative; + + &::after { + content: attr(data-over); + position: absolute; + top: 50%; + left: 50%; + color: var(--theme-caption-color); + transform: translate(-53%, -52%); + z-index: 2; + } + &::before { + content: ''; + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + background-color: var(--theme-bg-color); + border: 1px solid var(--theme-divider-color); + border-radius: 0.25rem; + opacity: 0.9; + z-index: 1; + } + } + } +} + /* Header */ .hulyHeader-container { display: flex; diff --git a/packages/ui/src/components/ModernTab.svelte b/packages/ui/src/components/ModernTab.svelte index 971d525b78..26aa6e82f8 100644 --- a/packages/ui/src/components/ModernTab.svelte +++ b/packages/ui/src/components/ModernTab.svelte @@ -48,7 +48,7 @@ style:max-width={orientation === 'horizontal' ? maxSize : 'auto'} style:max-height={orientation === 'vertical' ? maxSize : 'auto'} class:active={highlighted} - use:tooltip={{ label: label ? getEmbeddedLabel(label) : labelIntl }} + use:tooltip={{ label: label ? getEmbeddedLabel(label) : labelIntl, direction: 'bottom' }} on:click on:contextmenu={handleContextMenu} > diff --git a/plugins/contact-resources/src/components/CombineAvatars.svelte b/plugins/contact-resources/src/components/CombineAvatars.svelte index fa7fdff7e3..8e4279381e 100644 --- a/plugins/contact-resources/src/components/CombineAvatars.svelte +++ b/plugins/contact-resources/src/components/CombineAvatars.svelte @@ -49,93 +49,16 @@ {#if items !== undefined} -
+
{#if includeEmpty} -
+
{/if} {#each persons as person, i} -
+
{/each}
{/if} - - diff --git a/plugins/love-resources/src/components/ControlExt.svelte b/plugins/love-resources/src/components/ControlExt.svelte index a3827a8b44..7ad226a8cf 100644 --- a/plugins/love-resources/src/components/ControlExt.svelte +++ b/plugins/love-resources/src/components/ControlExt.svelte @@ -13,8 +13,7 @@ // limitations under the License. --> + + + {#each items as participant (participant.person)} + + +
participant.onclick?.(e)} + > +
+ +
+ {participant.name} +
+ {/each} +
diff --git a/plugins/love-resources/src/components/RoomButton.svelte b/plugins/love-resources/src/components/RoomButton.svelte new file mode 100644 index 0000000000..c452f5656b --- /dev/null +++ b/plugins/love-resources/src/components/RoomButton.svelte @@ -0,0 +1,76 @@ + + + +{#if adaptive} + + +
+ {label} +
+ {#each participants.slice(0, limit) as participant, i (participant._id)} +
+ +
+ {/each} +
+
+{:else} + + +
+ {label} +
+ {#each participants as participant (participant._id)} +
+ +
+ {/each} +
+
+{/if}