Browse Source

Fix sliced array bounds on slice

Fix translucent chat colors
master
Eduard Kuzmenko 4 years ago
parent
commit
86dc4f1533
  1. 8
      src/helpers/slicedArray.ts
  2. 2
      src/lib/appManagers/appMessagesManager.ts
  3. 21
      src/scss/partials/_chatBubble.scss
  4. 2
      src/scss/style.scss

8
src/helpers/slicedArray.ts

@ -46,10 +46,10 @@ export default class SlicedArray {
if(side === SliceEnd.Top) { if(side === SliceEnd.Top) {
const slice = self.last; const slice = self.last;
return slice.end & side ? this.includes(slice[slice.length - 1]) : false; return slice.end & side ? this.includes(slice[slice.length - 1]) || !slice.length : false;
} else if(side === SliceEnd.Bottom) { } else if(side === SliceEnd.Bottom) {
const slice = self.first; const slice = self.first;
return slice.end & side ? this.includes(slice[0]) : false; return slice.end & side ? this.includes(slice[0]) || !slice.length : false;
}/* else if(side === SliceEnd.Both) { }/* else if(side === SliceEnd.Both) {
} */ } */
@ -289,8 +289,8 @@ export default class SlicedArray {
const topWasMeantToLoad = add_offset < 0 ? limit + add_offset : limit; const topWasMeantToLoad = add_offset < 0 ? limit + add_offset : limit;
const bottomWasMeantToLoad = Math.abs(add_offset); const bottomWasMeantToLoad = Math.abs(add_offset);
const topFulfilled = (slice.length - sliceOffset) >= topWasMeantToLoad || slice.isEnd(SliceEnd.Top); const topFulfilled = (slice.length - sliceOffset) >= topWasMeantToLoad || (slice.isEnd(SliceEnd.Top) ? (sliced.setEnd(SliceEnd.Top), true) : false);
const bottomFulfilled = (sliceOffset - bottomWasMeantToLoad) >= 0 || slice.isEnd(SliceEnd.Bottom); const bottomFulfilled = (sliceOffset - bottomWasMeantToLoad) >= 0 || (slice.isEnd(SliceEnd.Bottom) ? (sliced.setEnd(SliceEnd.Bottom), true) : false);
//console.log('sliceMe', topFulfilled, bottomFulfilled); //console.log('sliceMe', topFulfilled, bottomFulfilled);

2
src/lib/appManagers/appMessagesManager.ts

@ -1424,7 +1424,7 @@ export class AppMessagesManager {
let replies: MessageReplies.messageReplies; let replies: MessageReplies.messageReplies;
if(appPeersManager.isBroadcast(peerId)) { if(appPeersManager.isBroadcast(peerId)) {
const channelFull = appProfileManager.chatsFull[-peerId] as ChatFull.channelFull; const channelFull = appProfileManager.chatsFull[-peerId] as ChatFull.channelFull;
if(channelFull.linked_chat_id) { if(channelFull?.linked_chat_id) {
replies = { replies = {
_: 'messageReplies', _: 'messageReplies',
flags: 1, flags: 1,

21
src/scss/partials/_chatBubble.scss

@ -249,6 +249,7 @@ $bubble-margin: .25rem;
/* justify-self: center; */ /* justify-self: center; */
margin: 0 auto; margin: 0 auto;
max-width: 100%; max-width: 100%;
box-shadow: none;
} }
} }
@ -307,7 +308,8 @@ $bubble-margin: .25rem;
justify-content: center; justify-content: center;
color: #fff; color: #fff;
border-radius: 50%; border-radius: 50%;
background: rgba(0, 0, 0, .16); //background: rgba(0, 0, 0, .16);
background: var(--message-highlightning-color);
cursor: pointer; cursor: pointer;
} }
@ -491,7 +493,8 @@ $bubble-margin: .25rem;
} }
&.is-message-empty .message { &.is-message-empty .message {
background-color: rgba(0, 0, 0, .23); //background-color: rgba(0, 0, 0, .23);
background: var(--message-highlightning-color);
} }
/* &.is-message-empty .message { /* &.is-message-empty .message {
@ -1549,11 +1552,12 @@ $bubble-margin: .25rem;
.service-msg { .service-msg {
color: #fff; color: #fff;
background-color: rgba(0, 0, 0, .24); //background-color: rgba(0, 0, 0, .24);
font-size: 14px; background-color: var(--message-highlightning-color);
padding: 0 8px; font-size: .9375rem;
line-height: 24px; padding: 0 .5rem;
border-radius: 12px; line-height: 1.5rem;
border-radius: .75rem;
user-select: none; user-select: none;
display: flex; display: flex;
align-items: center; align-items: center;
@ -1998,7 +2002,8 @@ $bubble-margin: .25rem;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
border-radius: 6px; border-radius: 6px;
background-color: rgba(0, 0, 0, .23); //background-color: rgba(0, 0, 0, .23);
background: var(--message-highlightning-color);
z-index: 2; z-index: 2;
font-size: 14px; font-size: 14px;
user-select: none; user-select: none;

2
src/scss/style.scss

@ -58,7 +58,7 @@ $chat-padding-handhelds: .5rem;
--message-handhelds-margin: 5.5625rem; --message-handhelds-margin: 5.5625rem;
--message-beside-button-margin: 2.875rem; --message-beside-button-margin: 2.875rem;
--message-time-background: rgba(0, 0, 0, .35); --message-time-background: rgba(0, 0, 0, .35);
--message-highlightning-color: rgba(77, 142, 80, .4); --message-highlightning-color: hsla(85.5319, 36.9171%, 40.402%, .4);//rgba(77, 142, 80, .4);
--messages-container-width: #{$messages-container-width}; --messages-container-width: #{$messages-container-width};
--messages-text-size: 16px; --messages-text-size: 16px;
--messages-secondary-text-size: calc(var(--messages-text-size) - 1px); --messages-secondary-text-size: calc(var(--messages-text-size) - 1px);

Loading…
Cancel
Save