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 { @@ -46,10 +46,10 @@ export default class SlicedArray {
if(side === SliceEnd.Top) {
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) {
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) {
} */
@ -289,8 +289,8 @@ export default class SlicedArray { @@ -289,8 +289,8 @@ export default class SlicedArray {
const topWasMeantToLoad = add_offset < 0 ? limit + add_offset : limit;
const bottomWasMeantToLoad = Math.abs(add_offset);
const topFulfilled = (slice.length - sliceOffset) >= topWasMeantToLoad || slice.isEnd(SliceEnd.Top);
const bottomFulfilled = (sliceOffset - bottomWasMeantToLoad) >= 0 || slice.isEnd(SliceEnd.Bottom);
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) ? (sliced.setEnd(SliceEnd.Bottom), true) : false);
//console.log('sliceMe', topFulfilled, bottomFulfilled);

2
src/lib/appManagers/appMessagesManager.ts

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

21
src/scss/partials/_chatBubble.scss

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

2
src/scss/style.scss

@ -58,7 +58,7 @@ $chat-padding-handhelds: .5rem; @@ -58,7 +58,7 @@ $chat-padding-handhelds: .5rem;
--message-handhelds-margin: 5.5625rem;
--message-beside-button-margin: 2.875rem;
--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-text-size: 16px;
--messages-secondary-text-size: calc(var(--messages-text-size) - 1px);

Loading…
Cancel
Save