This repository has been archived by the owner on Sep 11, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 831
/
_EventBubbleTile.scss
619 lines (519 loc) · 16.1 KB
/
_EventBubbleTile.scss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
/*
Copyright 2021 The Matrix.org Foundation C.I.C.
Licensed under the Apache 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
http://www.apache.org/licenses/LICENSE-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.
*/
.mx_RoomView_body[data-layout=bubble] {
.mx_RoomView_timeline, .mx_RoomView_statusArea, .mx_MessageComposer {
width: 100%;
max-width: 1200px;
margin: 0 auto;
}
}
.mx_EventTile[data-layout=bubble],
.mx_GenericEventListSummary[data-layout=bubble] {
--avatarSize: 32px;
--gutterSize: 11px;
--cornerRadius: 12px;
--maxWidth: 70%;
margin-right: 60px;
}
.mx_EventTile[data-layout=bubble] {
position: relative;
margin-top: var(--gutterSize);
margin-left: 49px;
font-size: $font-14px;
.mx_ThreadInfo {
clear: both;
width: fit-content;
}
.mx_EventTile_content {
margin-right: 0;
}
&.mx_EventTile_continuation {
margin-top: 2px;
}
&.mx_EventTile_highlight {
&::before {
background-color: $event-highlight-bg-color;
}
color: $alert;
}
/* For replies */
.mx_EventTile {
padding-top: 0;
}
&::before {
content: '';
position: absolute;
top: -1px;
bottom: -1px;
left: -60px;
right: -60px;
z-index: -1;
border-radius: 4px;
}
&:hover,
&.mx_EventTile_selected {
&::before {
background: $eventbubble-bg-hover;
}
.mx_EventTile_avatar {
img {
box-shadow: 0 0 0 3px $eventbubble-bg-hover;
}
}
}
.mx_DisambiguatedProfile,
.mx_EventTile_line {
width: fit-content;
max-width: 70%;
// fixed line height to prevent emoji from being taller than text
line-height: $font-18px;
}
> .mx_DisambiguatedProfile {
position: relative;
top: -2px;
left: 2px;
font-size: $font-15px;
}
.mx_MessageActionBar {
top: -28px;
right: 0;
z-index: 9; // above the avatar
}
.mx_MediaBody {
// leave space for the timestamp
padding-right: 48px;
}
.mx_MImageBody_thumbnail_container {
min-height: calc(1.8rem + var(--gutterSize) + var(--gutterSize));
min-width: calc(1.8rem + var(--gutterSize) + var(--gutterSize));
}
.mx_CallEvent {
background-color: unset;
border-style: solid;
border-width: 1px;
border-color: $quinary-content;
}
&[data-self=false] {
.mx_EventTile_line {
border-bottom-right-radius: var(--cornerRadius);
.mx_MImageBody .mx_MImageBody_thumbnail_container,
.mx_MImageBody::before,
.mx_MVideoBody .mx_MVideoBody_container,
.mx_MediaBody,
.mx_MLocationBody_map,
.mx_MBeaconBody {
border-bottom-right-radius: var(--cornerRadius) !important;
}
}
.mx_EventTile_avatar {
left: -34px;
}
.mx_MessageActionBar {
right: -100px; // to make sure it doesn't overflow to the left or cover sender profile
}
--backgroundColor: $eventbubble-others-bg;
}
&[data-self=true] {
.mx_EventTile_line {
margin-inline-start: auto;
border-bottom-left-radius: var(--cornerRadius);
.mx_MImageBody .mx_MImageBody_thumbnail_container,
.mx_MImageBody::before,
.mx_MVideoBody .mx_MVideoBody_container,
.mx_MediaBody,
.mx_MLocationBody_map,
.mx_MBeaconBody {
border-bottom-left-radius: var(--cornerRadius) !important;
}
}
.mx_EventTile_sticker {
// align timestamp with those inside bubbles
margin-right: 32px;
}
.mx_ThreadInfo {
float: right;
margin-right: calc(-1 * var(--gutterSize));
}
.mx_DisambiguatedProfile {
display: none;
}
.mx_ReplyTile .mx_DisambiguatedProfile {
display: block;
}
.mx_ReactionsRow {
float: right;
clear: right;
display: flex;
/* Moving the "add reaction button" before the reactions */
> :last-child {
order: -1;
}
}
.mx_EventTile_avatar {
top: -19px; // height of the sender block
right: -35px;
}
.mx_MediaBody {
background: $eventbubble-self-bg;
}
--backgroundColor: $eventbubble-self-bg;
}
.mx_EventTile_line {
position: relative;
display: flex;
gap: 5px;
margin: 0 -12px 0 -9px;
border-top-left-radius: var(--cornerRadius);
border-top-right-radius: var(--cornerRadius);
// the selector here is quite weird because timestamps can appear linked & unlinked and in different places
// in the DOM depending on the specific rendering context
> a, // timestamp wrapper anchor
.mx_MessageActionBar + .mx_MessageTimestamp {
position: absolute;
padding: 4px 8px;
bottom: 0;
right: 0;
z-index: 3; // above media and location share maps
}
&.mx_EventTile_mediaLine .mx_MVoiceMessageBody {
// allow the event to be collapsed, this causes the waveform to get cropped
min-width: 0;
}
// we put the timestamps for media (other than stickers) atop the media
// for images we also apply a linear gradient and change the timestamp colour to aid readability
&.mx_EventTile_mediaLine.mx_EventTile_image {
.mx_MessageTimestamp {
color: #ffffff; // regardless of theme, always visible on the below gradient
}
// linear gradient to make the timestamp more visible
.mx_MImageBody::before {
content: "";
position: absolute;
background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.2) 100%);
z-index: 1;
top: 0;
bottom: 0;
left: 0;
right: 0;
pointer-events: none;
}
}
&.mx_EventTile_sticker {
> a, // timestamp wrapper anchor
.mx_MessageActionBar + .mx_MessageTimestamp {
// position timestamps for stickers to the right of the un-bubbled sticker
right: unset;
left: 100%;
}
.mx_MStickerBody_wrapper {
padding: 0;
}
}
.mx_MImageBody {
width: 100%;
height: 100%;
.mx_MImageBody_thumbnail.mx_MImageBody_thumbnail--blurhash {
position: unset;
}
}
//noinspection CssReplaceWithShorthandSafely
.mx_MImageBody .mx_MImageBody_thumbnail_container,
.mx_MVideoBody .mx_MVideoBody_container,
.mx_MediaBody {
border-radius: unset;
border-top-left-radius: var(--cornerRadius);
border-top-right-radius: var(--cornerRadius);
}
.mx_EventTile_e2eIcon {
flex-shrink: 0; // keep it at full size
}
}
&:not(.mx_EventTile_noBubble) .mx_EventTile_line:not(.mx_EventTile_mediaLine) {
// make the top and bottom padding 1px smaller so that we can pad .mx_EventTile_content by 1px
// to avoid anti-zalgo cutting off our larger than text emojis.
padding: calc(var(--gutterSize) - 1px);
padding-right: 60px; // space for the timestamp
background: var(--backgroundColor);
.mx_EventTile_content {
padding: 1px;
}
}
&.mx_EventTile_continuation[data-self=false] .mx_EventTile_line {
border-top-left-radius: 0;
.mx_MImageBody .mx_MImageBody_thumbnail_container,
.mx_MVideoBody .mx_MVideoBody_container,
.mx_MImageBody::before,
.mx_MediaBody,
.mx_MLocationBody_map,
.mx_MBeaconBody {
border-top-left-radius: 0;
}
}
&.mx_EventTile_lastInSection[data-self=false] .mx_EventTile_line {
border-bottom-left-radius: var(--cornerRadius);
.mx_MImageBody .mx_MImageBody_thumbnail_container,
.mx_MVideoBody .mx_MVideoBody_container,
.mx_MImageBody::before,
.mx_MediaBody,
.mx_MLocationBody_map,
.mx_MBeaconBody {
border-bottom-left-radius: var(--cornerRadius);
}
}
&.mx_EventTile_continuation[data-self=true] .mx_EventTile_line {
border-top-right-radius: 0;
.mx_MImageBody .mx_MImageBody_thumbnail_container,
.mx_MVideoBody .mx_MVideoBody_container,
.mx_MImageBody::before,
.mx_MediaBody,
.mx_MLocationBody_map,
.mx_MBeaconBody {
border-top-right-radius: 0;
}
}
&.mx_EventTile_lastInSection[data-self=true] .mx_EventTile_line {
border-bottom-right-radius: var(--cornerRadius);
.mx_MImageBody .mx_MImageBody_thumbnail_container,
.mx_MVideoBody .mx_MVideoBody_container,
.mx_MImageBody::before,
.mx_MediaBody,
.mx_MLocationBody_map,
.mx_MBeaconBody {
border-bottom-right-radius: var(--cornerRadius);
}
}
.mx_EventTile_avatar {
position: absolute;
top: 0;
line-height: 1;
z-index: 9;
img {
box-shadow: 0 0 0 3px $background;
border-radius: 50%;
}
}
&.mx_EventTile_noSender {
.mx_EventTile_avatar {
top: -19px;
}
}
.mx_BaseAvatar,
.mx_EventTile_avatar {
line-height: 1;
}
&[data-has-reply=true] {
> .mx_EventTile_line {
flex-direction: column;
}
.mx_ReplyChain_show {
order: 99999;
}
.mx_ReplyChain {
.mx_EventTile_reply {
max-width: 90%;
padding: 0;
> a, // timestamp wrapper anchor
.mx_MessageActionBar + .mx_MessageTimestamp {
display: none !important;
}
}
.mx_EventTile {
display: flex;
gap: var(--gutterSize);
.mx_EventTile_avatar {
position: static;
}
.mx_DisambiguatedProfile {
display: none;
}
}
}
}
.mx_MPollBody {
width: 550px; // to prevent timestamp overlapping summary text
.mx_MPollBody_totalVotes {
// align summary text with corner timestamp
padding: 4px 0;
}
}
.mx_EditMessageComposer_buttons {
position: static;
padding: 0;
margin: 8px 0 0;
background: transparent;
}
.mx_ReactionsRow {
margin-right: -18px;
margin-left: -9px;
}
/* Special layout scenario for "Unable To Decrypt (UTD)" events */
&.mx_EventTile_bad > .mx_EventTile_line {
display: grid;
grid-template:
"reply reply" auto
"shield body" auto
"shield link" auto
/ auto 1fr;
.mx_EventTile_e2eIcon {
grid-area: shield;
}
.mx_UnknownBody {
grid-area: body;
}
.mx_EventTile_keyRequestInfo {
grid-area: link;
}
.mx_ReplyChain_wrapper {
grid-area: reply;
}
}
.mx_EventTile_readAvatars {
position: absolute;
right: -78px; // as close to right gutter without clipping as possible
bottom: 0;
top: auto;
}
.mx_MTextBody {
max-width: 100%;
}
.mx_CallEvent_wrapper {
justify-content: center;
}
}
.mx_EventTile.mx_EventTile_noBubble[data-layout=bubble] {
--backgroundColor: transparent;
.mx_EventTile_line.mx_EventTile_emote {
padding-right: 60px; // align with bubbles text
font-style: italic;
> a { // timestamp anchor wrapper
align-self: center;
bottom: unset;
top: unset;
font-style: normal; // undo italic above
}
.mx_MEmoteBody {
padding: 4px 0;
}
}
}
.mx_EventTile.mx_EventTile_bubbleContainer[data-layout=bubble],
.mx_EventTile.mx_EventTile_leftAlignedBubble[data-layout=bubble] {
.mx_EventTile_line > a {
// hide this timestamp as the tile will render its own
display: none;
}
}
.mx_EventTile.mx_EventTile_bubbleContainer[data-layout=bubble],
.mx_EventTile.mx_EventTile_leftAlignedBubble[data-layout=bubble],
.mx_EventTile.mx_EventTile_info[data-layout=bubble],
.mx_GenericEventListSummary[data-layout=bubble][data-expanded=false] {
--backgroundColor: transparent;
--gutterSize: 0;
display: flex;
align-items: center;
justify-content: flex-start;
padding: 5px 0;
.mx_EventTile_avatar {
position: static;
order: -1;
margin-right: 5px;
}
.mx_EventTile_line,
.mx_EventTile_info {
min-width: 100%;
// Preserve alignment with left edge of text in bubbles
margin: 0;
}
.mx_EventTile_e2eIcon {
margin-left: 9px;
}
.mx_EventTile_line {
> a, // timestamp wrapper anchor
.mx_MessageActionBar + .mx_MessageTimestamp {
right: auto;
left: -77px;
bottom: unset;
align-self: center;
.mx_MessageTimestamp, &.mx_MessageTimestamp {
vertical-align: middle;
}
}
}
}
.mx_GenericEventListSummary[data-layout=bubble] {
--maxWidth: 70%;
margin-left: calc(var(--avatarSize) + var(--gutterSize));
.mx_GenericEventListSummary_toggle {
margin: 0 55px 0 5px;
float: none;
&[aria-expanded=false] {
order: 9;
}
&[aria-expanded=true] {
text-align: right;
}
}
.mx_GenericEventListSummary_line {
display: none;
}
.mx_GenericEventListSummary_avatars {
padding-top: 0;
}
&::after {
content: "";
clear: both;
}
}
.mx_GenericEventListSummary[data-expanded=false][data-layout=bubble] {
// Align with left edge of bubble tiles
padding: 0 49px;
}
// ideally we'd use display=contents here for the layout to all work regardless of the *ELS but
// that breaks ScrollPanel's reliance upon offsetTop so we have to have a bit more finesse.
.mx_GenericEventListSummary[data-expanded=true][data-layout=bubble] {
display: flex;
flex-direction: column;
margin: 0;
.mx_EventTile_info {
padding: 2px 0;
margin-right: 0;
.mx_MessageActionBar {
right: 127px; // align with that of right-column bubbles
}
.mx_EventTile_readAvatars {
right: -18px; // match alignment to RRs of chat bubbles
}
&::before {
right: 0; // match alignment of the hover background to that of chat bubbles
}
}
}
// increase margin between ELS and the next Event to not have our user avatar overlap the expand/collapse button
.mx_GenericEventListSummary[data-layout=bubble][data-expanded=false] + .mx_EventTile[data-layout=bubble][data-self=true] {
margin-top: 20px;
}
/* events that do not require bubble layout */
.mx_GenericEventListSummary[data-layout=bubble],
.mx_EventTile.mx_EventTile_bad[data-layout=bubble] {
.mx_EventTile_line {
background: transparent;
}
&:hover {
&::before {
background: transparent;
}
}
}
.mx_EventTile_tileError[data-layout=bubble] .mx_EventTile_line {
flex-direction: column; // restore the centering
}