Skip to content

Commit 13c4734

Browse files
committed
fix: use correct colors for CopyToClipbaord buttons on ctx
1 parent f292d8a commit 13c4734

File tree

12 files changed

+70
-18
lines changed

12 files changed

+70
-18
lines changed

ts/components/AboutView.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { switchThemeTo } from '../themes/switchTheme';
77
import { SessionToastContainer } from './SessionToastContainer';
88
import { Flex } from './basic/Flex';
99
import { themeStore } from '../state/theme/store';
10-
import { SessionButton, SessionButtonType } from './basic/SessionButton';
10+
import { SessionButton, SessionButtonColor, SessionButtonType } from './basic/SessionButton';
1111
import { Localizer } from './basic/Localizer';
1212
import { CopyToClipboardButton } from './buttons';
1313
import { tr } from '../localization/localeTools';
@@ -102,6 +102,7 @@ export const AboutView = () => {
102102
className="version"
103103
text={versionInfo}
104104
buttonType={SessionButtonType.Simple}
105+
buttonColor={SessionButtonColor.TextPrimary}
105106
/>
106107
<SessionButton
107108
buttonType={SessionButtonType.Simple}
@@ -119,17 +120,20 @@ export const AboutView = () => {
119120
className="os"
120121
text={systemInfo}
121122
buttonType={SessionButtonType.Simple}
123+
buttonColor={SessionButtonColor.TextPrimary}
122124
/>
123125
<CopyToClipboardButton
124126
className="commitHash"
125127
text={commitInfo}
126128
buttonType={SessionButtonType.Simple}
129+
buttonColor={SessionButtonColor.TextPrimary}
127130
/>
128131
{environmentStates.length ? (
129132
<CopyToClipboardButton
130133
className="environment"
131134
text={environmentStates.join(' - ')}
132135
buttonType={SessionButtonType.Simple}
136+
buttonColor={SessionButtonColor.TextPrimary}
133137
/>
134138
) : null}
135139
<a href="https://getsession.org" style={{ margin: '0 0 var(--margins-lg) 0' }}>

ts/components/SessionWrapperModal.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,20 +190,23 @@ export function ModalBottomButtonWithBorder({
190190
onClick,
191191
buttonColor,
192192
dataTestId,
193+
buttonType,
193194
disabled,
194195
}: {
195196
text: string;
196197
onClick: () => void | Promise<void>;
197198
disabled?: boolean;
198199
buttonColor?: SessionButtonColor;
199200
dataTestId?: SessionDataTestId;
201+
buttonType?: SessionButtonType;
200202
}) {
201203
return (
202204
<SessionButton
203205
text={text}
204206
onClick={onClick}
205207
disabled={disabled}
206208
buttonColor={buttonColor}
209+
buttonType={buttonType}
207210
dataTestId={dataTestId}
208211
style={{ minWidth: 'var(--modal-actions-outline-min-width)' }}
209212
/>

ts/components/basic/SessionButton.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ export enum SessionButtonColor {
2424
Purple = 'purple',
2525
Orange = 'orange',
2626
Red = 'red',
27-
White = 'white',
28-
Black = 'black',
27+
TextPrimary = 'text-primary',
2928
Grey = 'gray',
3029
Primary = 'primary',
3130
Tertiary = 'background-tertiary',

ts/components/buttons/CopyToClipboardButton.tsx

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import useTimeoutFn from 'react-use/lib/useTimeoutFn';
55

66
import { useHotkey } from '../../hooks/useHotkey';
77
import { ToastUtils } from '../../session/utils';
8-
import { SessionButtonProps } from '../basic/SessionButton';
8+
import { SessionButtonProps, type SessionButtonColor } from '../basic/SessionButton';
99
import { SessionIconButtonProps, SessionLucideIconButton } from '../icon/SessionIconButton';
1010
import { LUCIDE_ICONS_UNICODE } from '../icon/lucide';
1111
import type { SessionIconSize } from '../icon';
@@ -17,12 +17,22 @@ type CopyProps = {
1717
copyContent?: string;
1818
onCopyComplete?: (copiedValue: string | undefined) => void;
1919
hotkey?: boolean;
20-
};
20+
} & { buttonColor: SessionButtonColor };
2121

22-
type CopyToClipboardButtonProps = Omit<SessionButtonProps, 'children' | 'onClick'> & CopyProps;
22+
type CopyToClipboardButtonProps = Omit<SessionButtonProps, 'children' | 'onClick' | 'buttonColor'> &
23+
CopyProps;
2324

2425
export const CopyToClipboardButton = (props: CopyToClipboardButtonProps) => {
25-
const { copyContent, onCopyComplete, hotkey = false, text } = props;
26+
const {
27+
copyContent,
28+
onCopyComplete,
29+
hotkey = false,
30+
text,
31+
buttonType,
32+
buttonColor,
33+
dataTestId,
34+
disabled,
35+
} = props;
2636
const [copied, setCopied] = useState(false);
2737

2838
// reset the copied state after 5 seconds
@@ -59,9 +69,10 @@ export const CopyToClipboardButton = (props: CopyToClipboardButtonProps) => {
5969
aria-label={'copy to clipboard button'}
6070
text={text && !isEmpty(text) ? text : copied ? tr('copied') : tr('copy')}
6171
onClick={onClick}
62-
buttonColor={props.buttonColor}
63-
dataTestId={props.dataTestId}
64-
disabled={props.disabled}
72+
buttonColor={buttonColor}
73+
dataTestId={dataTestId}
74+
disabled={disabled}
75+
buttonType={buttonType}
6576
/>
6677
);
6778
};

ts/components/conversation/right-panel/overlay/message-info/components/MessageFrom.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { ContactName } from '../../../../ContactName/ContactName';
1010
import { useSelectedConversationKey } from '../../../../../../state/selectors/selectedConversation';
1111
import { useShowUserDetailsCbFromConversation } from '../../../../../menuAndSettingsHooks/useShowUserDetailsCb';
1212
import { PubKey } from '../../../../../../session/types';
13+
import { SessionButtonColor } from '../../../../../basic/SessionButton';
1314

1415
const StyledFromContainer = styled.div`
1516
display: flex;
@@ -60,6 +61,7 @@ export const MessageFrom = (props: { sender: string; isSenderAdmin: boolean }) =
6061
iconSize={'small'}
6162
copyContent={`${profileName} ${sender}`}
6263
margin={'0 0 0 var(--margins-xs)'}
64+
buttonColor={SessionButtonColor.TextPrimary}
6365
/>
6466
) : null}
6567
</Flex>

ts/components/conversation/right-panel/overlay/message-info/components/MessageInfo.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import { useCurrentUserHasPro } from '../../../../../../hooks/useHasPro';
3939
import { ProIconButton } from '../../../../../buttons/ProButton';
4040
import { assertUnreachable } from '../../../../../../types/sqlSharedTypes';
4141
import { ProMessageFeature } from '../../../../../../models/proMessageFeature';
42+
import { SessionButtonColor } from '../../../../../basic/SessionButton';
4243

4344
export const MessageInfoLabel = styled.label<{ color?: string }>`
4445
font-size: var(--font-size-lg);
@@ -78,6 +79,7 @@ export const LabelWithInfo = (props: LabelWithInfoProps) => {
7879
iconSize={'small'}
7980
copyContent={props.info}
8081
margin={'0 0 0 var(--margins-xs)'}
82+
buttonColor={SessionButtonColor.TextPrimary}
8183
/>
8284
) : null}
8385
</Flex>

ts/components/dialog/UserProfileModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export const UserProfileModal = ({
115115
{!isBlindedAndNotResolved && (
116116
<CopyToClipboardButton
117117
copyContent={conversationIdToDisplay}
118-
buttonColor={SessionButtonColor.PrimaryDark}
118+
buttonColor={SessionButtonColor.TextPrimary}
119119
dataTestId="copy-button-account-id"
120120
buttonType={SessionButtonType.Outline}
121121
hotkey={true}

ts/components/dialog/debug/components.tsx

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,11 @@ export const AboutInfo = () => {
527527
<SpacerXS />
528528
<Flex $container={true} width="100%" $alignItems="center" $flexGap="var(--margins-xs)">
529529
<h2>About</h2>
530-
<CopyToClipboardIcon iconSize={'small'} copyContent={aboutInfo.join('\n')} />
530+
<CopyToClipboardIcon
531+
iconSize={'small'}
532+
copyContent={aboutInfo.join('\n')}
533+
buttonColor={SessionButtonColor.None}
534+
/>
531535
</Flex>
532536
<Flex
533537
$container={true}
@@ -550,7 +554,11 @@ export const AboutInfo = () => {
550554
$flexGap="var(--margins-xs)"
551555
>
552556
<p style={{ userSelect: 'text', lineHeight: 1.5 }}>{info}</p>
553-
<CopyToClipboardIcon iconSize={'small'} copyContent={info} />
557+
<CopyToClipboardIcon
558+
iconSize={'small'}
559+
copyContent={info}
560+
buttonColor={SessionButtonColor.None}
561+
/>
554562
</Flex>
555563
);
556564
})}
@@ -579,7 +587,11 @@ export const OtherInfo = () => {
579587
<Flex $container={true} width="100%" $alignItems="center" $flexGap="var(--margins-xs)">
580588
<h2>Other Info</h2>
581589
{otherInfo.value ? (
582-
<CopyToClipboardIcon iconSize={'small'} copyContent={otherInfo.value.join('\n')} />
590+
<CopyToClipboardIcon
591+
iconSize={'small'}
592+
copyContent={otherInfo.value.join('\n')}
593+
buttonColor={SessionButtonColor.None}
594+
/>
583595
) : null}
584596
</Flex>
585597
<Flex
@@ -607,7 +619,11 @@ export const OtherInfo = () => {
607619
$flexGap="var(--margins-xs)"
608620
>
609621
<p style={{ userSelect: 'text', lineHeight: 1.5 }}>{info}</p>
610-
<CopyToClipboardIcon iconSize={'small'} copyContent={info} />
622+
<CopyToClipboardIcon
623+
iconSize={'small'}
624+
copyContent={info}
625+
buttonColor={SessionButtonColor.None}
626+
/>
611627
</Flex>
612628
))
613629
: null}

ts/components/dialog/user-settings/pages/RecoveryPasswordSettingsPage.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ export function RecoveryPasswordSettingsPage(modalState: UserSettingsModalState)
171171
<CopyToClipboardButton
172172
copyContent={recoveryPhrase}
173173
buttonType={SessionButtonType.Outline}
174+
buttonColor={SessionButtonColor.TextPrimary}
174175
/>
175176
)}
176177
<SessionButton

ts/components/leftpane/ActionsPanel.tsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { useState } from 'react';
44
import { useDispatch, useSelector } from 'react-redux';
55
import useInterval from 'react-use/lib/useInterval';
66
import useTimeoutFn from 'react-use/lib/useTimeoutFn';
7+
import useKey from 'react-use/lib/useKey';
78

89
import useMount from 'react-use/lib/useMount';
910
import useThrottleFn from 'react-use/lib/useThrottleFn';
@@ -58,7 +59,7 @@ import { NetworkTime } from '../../util/NetworkTime';
5859
import { Storage } from '../../util/storage';
5960
import { getFileInfoFromFileServer } from '../../session/apis/file_server_api/FileServerApi';
6061
import { themesArray } from '../../themes/constants/colors';
61-
import { isDebugMode } from '../../shared/env_vars';
62+
import { isDebugMode, isDevProd } from '../../shared/env_vars';
6263
import { GearAvatarButton } from '../buttons/avatar/GearAvatarButton';
6364
import { useZoomShortcuts } from '../../hooks/useZoomingShortcut';
6465
import { assertUnreachable } from '../../types/sqlSharedTypes';
@@ -94,6 +95,18 @@ const Section = (props: { type: SectionType }) => {
9495
const isModalVisible = useSelector(getIsModalVisible);
9596
const isDarkTheme = useIsDarkTheme();
9697

98+
// for devs/QA, it's convenient to be able to switch themes with ctrl+t
99+
useKey(
100+
(event: KeyboardEvent) => {
101+
return event.ctrlKey && event.key === 't';
102+
},
103+
() => {
104+
if (isDevProd()) {
105+
void handleThemeSwitch();
106+
}
107+
}
108+
);
109+
97110
const handleClick = () => {
98111
if (type === SectionType.DebugMenu) {
99112
dispatch(updateDebugMenuModal({}));

0 commit comments

Comments
 (0)