Skip to content

Commit 87722ae

Browse files
committed
Remove unnecessary elements in device message view profile dialog
1 parent edafcac commit 87722ae

File tree

2 files changed

+43
-31
lines changed

2 files changed

+43
-31
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
- Fullscreen view for group avatar and own avatar in settings
4242
- Fix messagelist sometimes not loading more messages
4343
- Fix rockettheme font color for highlighted settings options
44+
- Fix device messages showing unneccessary elements
4445

4546
## [1.26.0] - 2021-12-15
4647

src/renderer/components/dialogs/ViewProfile.tsx

+42-31
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ export default function ViewProfile(props: {
6565
const tx = window.static_translate
6666
const { openDialog } = useContext(ScreenContext)
6767
const [contact, setContact] = useState<JsonContact>(props.contact)
68+
const isDeviceMessage = contact.id === C.DC_CONTACT_ID_DEVICE
6869

6970
const onClickEdit = () => {
7071
openDialog(EditContactNameDialog, {
@@ -85,7 +86,7 @@ export default function ViewProfile(props: {
8586
<DeltaDialogHeader
8687
title={tx('menu_view_profile')}
8788
onClickEdit={onClickEdit}
88-
showEditButton={true}
89+
showEditButton={!isDeviceMessage}
8990
showCloseButton={true}
9091
onClose={onClose}
9192
/>
@@ -109,6 +110,8 @@ export function ViewProfileInner({
109110
const { isChatLoaded, loadChats, chatCache } = useLogicVirtualChatList(
110111
chatListIds
111112
)
113+
const isDeviceMessage = contact.id === C.DC_CONTACT_ID_DEVICE
114+
112115
const tx = window.static_translate
113116

114117
const onChatClick = (chatId: number) => {
@@ -136,7 +139,9 @@ export function ViewProfileInner({
136139
</ClickForFullscreenAvatarWrapper>
137140
<ProfileInfoName
138141
name={contact.displayName}
139-
address={contact.address}
142+
address={
143+
isDeviceMessage ? tx('device_talk_subtitle') : contact.address
144+
}
140145
/>
141146
</div>
142147
<div
@@ -146,7 +151,7 @@ export function ViewProfileInner({
146151
justifyContent: 'center',
147152
}}
148153
>
149-
{contact.id !== C.DC_CONTACT_ID_DEVICE && (
154+
{!isDeviceMessage && (
150155
<button
151156
aria-label={tx('send_message')}
152157
onClick={onSendMessage}
@@ -175,35 +180,41 @@ export function ViewProfileInner({
175180
</div>
176181
</>
177182
)}
178-
<DeltaDialogContentTextSeperator text={tx('profile_shared_chats')} />
179-
</div>
180-
<div className='mutual-chats' style={{ flexGrow: 1 }}>
181-
<AutoSizer>
182-
{({ width, height }) => (
183-
<ChatListPart
184-
isRowLoaded={isChatLoaded}
185-
loadMoreRows={loadChats}
186-
rowCount={chatListIds.length}
187-
width={width}
188-
height={height}
189-
itemKey={index => 'key' + chatListIds[index]}
190-
itemHeight={CHATLISTITEM_CHAT_HEIGHT}
191-
>
192-
{({ index, style }) => {
193-
const [chatId] = chatListIds[index]
194-
return (
195-
<div style={style}>
196-
<ChatListItem
197-
chatListItem={chatCache[chatId] || undefined}
198-
onClick={onChatClick.bind(null, chatId)}
199-
/>
200-
</div>
201-
)
202-
}}
203-
</ChatListPart>
204-
)}
205-
</AutoSizer>
206183
</div>
184+
{!isDeviceMessage && (
185+
<>
186+
<DeltaDialogContentTextSeperator
187+
text={tx('profile_shared_chats')}
188+
/>
189+
<div className='mutual-chats' style={{ flexGrow: 1 }}>
190+
<AutoSizer>
191+
{({ width, height }) => (
192+
<ChatListPart
193+
isRowLoaded={isChatLoaded}
194+
loadMoreRows={loadChats}
195+
rowCount={chatListIds.length}
196+
width={width}
197+
height={height}
198+
itemKey={index => 'key' + chatListIds[index]}
199+
itemHeight={CHATLISTITEM_CHAT_HEIGHT}
200+
>
201+
{({ index, style }) => {
202+
const [chatId] = chatListIds[index]
203+
return (
204+
<div style={style}>
205+
<ChatListItem
206+
chatListItem={chatCache[chatId] || undefined}
207+
onClick={onChatClick.bind(null, chatId)}
208+
/>
209+
</div>
210+
)
211+
}}
212+
</ChatListPart>
213+
)}
214+
</AutoSizer>
215+
</div>
216+
</>
217+
)}
207218
</div>
208219
</>
209220
)

0 commit comments

Comments
 (0)