Skip to content

Commit 6b615fd

Browse files
authored
Merge pull request #1660 from session-foundation/feat/pro-settings
Merge pro-settings to pro-libsession
2 parents 55b5fd9 + 3559633 commit 6b615fd

File tree

19 files changed

+539
-233
lines changed

19 files changed

+539
-233
lines changed

ts/components/SessionWrapperModal.tsx

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,20 @@ type WithShowExitIcon = { showExitIcon?: boolean };
3737
const StyledModalHeader = styled(Flex)<{
3838
bigHeader?: boolean;
3939
scrolled: boolean;
40+
floatingHeader?: boolean;
4041
}>`
41-
position: relative;
42+
position: ${props => (props.floatingHeader ? 'absolute' : 'relative')};
4243
font-family: var(--font-default);
4344
font-size: ${props => (props.bigHeader ? 'var(--font-size-h4)' : 'var(--font-size-xl)')};
4445
font-weight: 500;
4546
text-align: center;
4647
line-height: 18px;
47-
48+
background-color: ${props =>
49+
props.floatingHeader && !props.scrolled
50+
? 'var(--transparent-color)'
51+
: 'var(--modal-background-content-color)'};
52+
width: ${props => (props.floatingHeader ? '-webkit-fill-available' : 'auto')};
53+
transition-duration: var(--default-duration);
4854
z-index: 3;
4955
5056
&::after {
@@ -54,15 +60,12 @@ const StyledModalHeader = styled(Flex)<{
5460
bottom: -16px; // bottom and height have to match for the border to be correctly placed
5561
height: 16px; // bottom and height have to match for the border to be correctly placed
5662
width: 100%;
57-
${props =>
58-
props.scrolled
59-
? 'background: linear-gradient(to bottom, var(--modal-shadow-color), transparent)'
60-
: ''};
63+
transition-duration: var(--default-duration);
64+
background: linear-gradient(to bottom, var(--modal-shadow-color), transparent);
65+
6166
pointer-events: none;
67+
opacity: ${props => (!props.scrolled ? '0' : '1')};
6268
}
63-
64-
border-bottom: ${props =>
65-
props.scrolled ? '1px solid var(--border-color)' : '1px solid var(--transparent-color)'};
6669
`;
6770

6871
export enum WrapperModalWidth {
@@ -309,28 +312,28 @@ export const ModalBasicHeader = ({
309312
bigHeader,
310313
modalHeaderDataTestId,
311314
extraRightButton,
315+
floatingHeader,
312316
}: WithShowExitIcon &
313317
WithExtraRightButton &
314318
WithExtraLeftButton & {
315319
title?: ReactNode;
316320
bigHeader?: boolean;
321+
floatingHeader?: boolean;
317322
modalHeaderDataTestId?: SessionDataTestId;
318323
}) => {
319-
const htmlDirection = useHTMLDirection();
320-
321324
const onClose = useOnModalClose();
322325
const scrolled = useIsModalScrolled();
323326

324327
return (
325328
<StyledModalHeader
326329
data-testid={modalHeaderDataTestId}
327-
dir={htmlDirection}
328330
$container={true}
329331
$flexDirection={'row'}
330332
$justifyContent={'space-between'}
331333
$alignItems={'center'}
332-
padding={'var(--margins-lg) var(--margins-sm) var(--margins-sm) var(--margins-lg)'}
334+
padding={'var(--margins-lg) var(--margins-lg) var(--margins-sm) var(--margins-lg)'}
333335
bigHeader={bigHeader}
336+
floatingHeader={floatingHeader}
334337
scrolled={scrolled}
335338
>
336339
<Flex
@@ -410,6 +413,7 @@ export const SessionWrapperModal = (props: SessionWrapperModalType & { onClose?:
410413
const [scrolled, setScrolled] = useState(false);
411414
const modalRef = useRef<HTMLDivElement>(null);
412415

416+
const htmlDirection = useHTMLDirection();
413417
const isTopModal = useIsTopModal(modalId);
414418

415419
useKey((event: KeyboardEvent) => {
@@ -440,6 +444,7 @@ export const SessionWrapperModal = (props: SessionWrapperModalType & { onClose?:
440444
onMouseDown={handleClick}
441445
role="dialog"
442446
data-testid={modalDataTestId}
447+
dir={htmlDirection}
443448
>
444449
<StyledModal
445450
$contentMaxWidth={$contentMaxWidth}

ts/components/basic/SessionButton.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export enum SessionButtonShape {
1919
export enum SessionButtonColor {
2020
TextPrimary = 'text-primary',
2121
Tertiary = 'background-tertiary',
22+
Primary = 'primary',
2223
PrimaryDark = 'renderer-span-primary', // use primary in dark modes only since it has poor contrast in light mode
2324
Danger = 'danger',
2425
Disabled = 'button-simple-disabled',
@@ -110,16 +111,13 @@ const StyledOutlineButton = styled(StyledBaseButton)`
110111
const StyledSolidButton = styled(StyledBaseButton)<{ isDarkTheme: boolean }>`
111112
outline: none;
112113
background-color: ${props =>
113-
props.color ? `var(--${props.color}-color)` : `var(--button-solid-background-color)`};
114+
props.color ? `var(--${props.color}-color)` : `var(--primary-color)`};
114115
color: ${props =>
115-
props.color &&
116-
((props.color !== SessionButtonColor.PrimaryDark && !props.isDarkTheme) ||
117-
(props.isDarkTheme && props.color === SessionButtonColor.Tertiary))
116+
props.color === SessionButtonColor.Tertiary
118117
? 'var(--text-primary-color)'
119-
: `var(--button-solid-text-color)`};
118+
: `var(--black-color)`};
120119
border: 1px solid
121-
${props =>
122-
props.color ? `var(--${props.color}-color)` : `var(--button-solid-background-color)`};
120+
${props => (props.color ? `var(--${props.color}-color)` : `var(--primary-color)`)};
123121
124122
&.disabled {
125123
background-color: var(--transparent-color);

ts/components/basic/SessionIdNotEditable.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export const SessionIDNotEditable = ({
4545
const pointerStyle = onClick ? { cursor: 'pointer' } : {};
4646

4747
const style = tooltipNode
48-
? { ...providedStyle, ...pointerStyle, marginLeft: 'var(--margins-lg)' }
48+
? { ...providedStyle, ...pointerStyle, marginStart: 'var(--margins-lg)' }
4949
: { ...providedStyle, ...pointerStyle };
5050

5151
if (displayType === 'blinded') {

ts/components/conversation/composition/CompositionBox.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ import { useShowBlockUnblock } from '../../menuAndSettingsHooks/useShowBlockUnbl
6161
import { showLocalizedPopupDialog } from '../../dialog/LocalizedPopupDialog';
6262
import { formatNumber } from '../../../util/i18n/formatting/generics';
6363
import { getFeatureFlag } from '../../../state/ducks/types/releasedFeaturesReduxTypes';
64-
import { SessionProInfoVariant, showSessionProInfoDialog } from '../../dialog/SessionProInfoModal';
64+
import { ProCTAVariant, showSessionProInfoDialog } from '../../dialog/SessionProInfoModal';
6565
import { tStripped } from '../../../localization/localeTools';
6666
import type { ProcessedLinkPreviewThumbnailType } from '../../../webworker/workers/node/image_processor/image_processor';
6767
import { selectWeAreProUser } from '../../../hooks/useParamSelector';
@@ -746,7 +746,7 @@ class CompositionBoxInner extends Component<Props, State> {
746746
const dispatch = window.inboxStore?.dispatch;
747747
if (dispatch) {
748748
if (isProAvailable && !hasPro) {
749-
showSessionProInfoDialog(SessionProInfoVariant.MESSAGE_CHARACTER_LIMIT, dispatch);
749+
showSessionProInfoDialog(ProCTAVariant.MESSAGE_CHARACTER_LIMIT, dispatch);
750750
} else {
751751
showLocalizedPopupDialog(
752752
{

ts/components/dialog/EditProfilePictureModal.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,7 @@ import {
2626
} from '../SessionWrapperModal';
2727
import { useIsProAvailable } from '../../hooks/useIsProAvailable';
2828
import { SpacerLG, SpacerSM } from '../basic/Text';
29-
import {
30-
SessionProInfoVariant,
31-
useShowSessionProInfoDialogCbWithVariant,
32-
} from './SessionProInfoModal';
29+
import { ProCTAVariant, useShowSessionProInfoDialogCbWithVariant } from './SessionProInfoModal';
3330
import { AvatarSize } from '../avatar/Avatar';
3431
import { ProIconButton } from '../buttons/ProButton';
3532
import { useProBadgeOnClickCb } from '../menuAndSettingsHooks/useProBadgeOnClickCb';
@@ -202,7 +199,7 @@ export const EditProfilePictureModal = ({ conversationId }: EditProfilePictureMo
202199
* All of those are taken care of as part of the `isProUser` check in the conversation model
203200
*/
204201
if (isProAvailable && !userHasPro && isNewAvatarAnimated && !isCommunity) {
205-
handleShowProInfoModal(SessionProInfoVariant.PROFILE_PICTURE_ANIMATED);
202+
handleShowProInfoModal(ProCTAVariant.ANIMATED_DISPLAY_PICTURE);
206203
window.log.debug('Attempted to upload an animated profile picture without pro!');
207204
return;
208205
}

0 commit comments

Comments
 (0)