Skip to content

Commit a498ccd

Browse files
committed
refactor(styles): enhance unread message count visibility and button interactions, group state
1 parent b67ebd6 commit a498ccd

3 files changed

Lines changed: 72 additions & 25 deletions

File tree

packages/webapp/src/components/pages/document/hooks/useUpdateDocPageUnreadMsg.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const useUpdateDocPageUnreadMsg = () => {
1111

1212
const selectors = [
1313
`.wrapBlock[data-id="${channel.id}"] > .title .btnOpenChatBox`,
14+
`.wrapBlock[data-id="${channel.id}"] > .title .ha-group`,
1415
`.wrapBlock[data-id="${channel.id}"] > .buttonWrapper .btn_openChatBox`
1516
]
1617

packages/webapp/src/styles/components/_heading-actions.scss

Lines changed: 70 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,25 @@
2323
}
2424

2525
.title {
26+
// Base positioning (always)
2627
.ha-wrap.has-selection > .ha-group {
2728
position: absolute;
2829
right: -3.9rem;
2930
top: 50%;
3031
transform: translateY(-50%);
3132
z-index: 10;
3233

34+
// Default: hide chat until “open” state
3335
.ha-chat-btn {
3436
display: none;
3537
}
3638
}
3739

38-
&:hover .ha-wrap.has-selection > .ha-group {
40+
// “Open” state:
41+
// - on hover
42+
// - OR when unread count exists on the group
43+
&:hover .ha-wrap.has-selection > .ha-group,
44+
.ha-wrap.has-selection > .ha-group[data-unread-count]:not([data-unread-count='']) {
3945
flex-direction: column;
4046
align-items: center;
4147
background-color: var(--bg-docy, #fff);
@@ -46,54 +52,96 @@
4652
gap: 2px;
4753
border-radius: 46%;
4854

49-
.ha-comment-btn {
50-
border-radius: 0 0 46% 46% !important;
51-
}
52-
.ha-chat-btn {
53-
border-radius: 46% 46% 0 0 !important;
54-
}
55-
56-
.ha-chat-btn,
57-
.ha-comment-btn {
55+
// Shared button reset + show buttons
56+
:is(.ha-chat-btn, .ha-comment-btn) {
5857
position: relative !important;
5958
transform: none !important;
6059
box-shadow: none;
61-
border-radius: 0;
6260
border: 0;
6361
top: 0 !important;
6462
left: 0 !important;
6563
right: 0 !important;
6664
display: flex;
6765
}
66+
67+
// Keep your “capsule” corners
68+
.ha-chat-btn {
69+
border-radius: 46% 46% 0 0 !important;
70+
}
71+
72+
.ha-comment-btn {
73+
border-radius: 0 0 46% 46% !important;
74+
}
6875
}
69-
}
7076

71-
.ha-chat-btn,
72-
.ha-comment-btn {
73-
svg {
74-
position: relative;
75-
top: 1px;
77+
// Unread-only extras (badge + force visibility)
78+
.ha-wrap.has-selection > .ha-group[data-unread-count]:not([data-unread-count='']) {
79+
:is(.ha-chat-btn, .ha-comment-btn) {
80+
display: flex !important;
81+
visibility: visible !important;
82+
}
83+
84+
&::before {
85+
content: attr(data-unread-count);
86+
position: absolute;
87+
z-index: 2;
88+
89+
top: 0;
90+
right: 0;
91+
left: 23px;
92+
93+
display: flex;
94+
align-items: center;
95+
justify-content: center;
96+
97+
color: #fff;
98+
font-weight: 600;
99+
font-size: 12px;
100+
101+
background-color: red !important;
102+
border-radius: var(--radius-field);
103+
104+
width: max-content;
105+
max-width: 20rem;
106+
padding-block: 0.25rem;
107+
padding-inline: 0.5rem;
108+
109+
text-align: center;
110+
white-space: normal;
111+
transform: none;
112+
opacity: 1;
113+
}
76114
}
77115
}
78116

79-
// Unread message count badge
117+
// Icon nudge (cleaner selector)
118+
:is(.ha-chat-btn, .ha-comment-btn) svg {
119+
position: relative;
120+
top: 1px;
121+
}
122+
123+
// Unread message count badge on the chat button (separate feature)
80124
.ha-chat-btn[data-unread-count]:not([data-unread-count='']) {
81-
// Show count inside button
125+
visibility: visible !important;
126+
82127
&::before {
83128
content: attr(data-unread-count);
84129
color: #fff;
85-
font-weight: semibold;
130+
font-weight: 600;
86131
display: flex;
87132
align-items: center;
88133
justify-content: center;
134+
89135
transform: none;
90136
opacity: 1;
91137
background-color: red !important;
92138
font-size: 16px;
93-
top: 0px;
94-
right: 0px;
139+
140+
top: 0;
141+
right: 0;
95142
left: 23px;
96143
}
144+
97145
&::after {
98146
display: none;
99147
}

packages/webapp/src/styles/styles.scss

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,9 +302,7 @@ $bg-root: #f8f9fa;
302302
left: calc(100% + 16px);
303303
top: calc(50%);
304304
transform: translateY(-50%);
305-
&[data-unread-count] {
306-
visibility: visible;
307-
}
305+
308306
svg {
309307
position: relative;
310308
top: 1px;

0 commit comments

Comments
 (0)