Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blocked list inaccessiable on smaller screens #3131

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions ts/components/MemberListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,15 @@ const StyledInfo = styled.div`
min-width: 0;
`;

const StyledName = styled.span`
const StyledName = styled.span<{ maxNameWidth?: string }>`
font-weight: bold;
margin-inline-start: var(--margins-md);
margin-inline-end: var(--margins-md);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;

${props => props.maxNameWidth && `max-width: ${props.maxNameWidth};`}
`;

const StyledCheckContainer = styled.div`
Expand All @@ -74,6 +76,7 @@ export const MemberListItem = (props: {
isZombie?: boolean;
inMentions?: boolean; // set to true if we are rendering members but in the Mentions picker
disableBg?: boolean;
maxNameWidth?: string;
isAdmin?: boolean; // if true, we add a small crown on top of their avatar
onSelect?: (pubkey: string) => void;
onUnselect?: (pubkey: string) => void;
Expand All @@ -88,6 +91,7 @@ export const MemberListItem = (props: {
onUnselect,
inMentions,
disableBg,
maxNameWidth,
dataTestId,
} = props;

Expand All @@ -114,7 +118,7 @@ export const MemberListItem = (props: {
>
<StyledInfo>
<AvatarItem memberPubkey={pubkey} isAdmin={isAdmin || false} />
<StyledName>{memberName}</StyledName>
<StyledName maxNameWidth={maxNameWidth}>{memberName}</StyledName>
Bilb marked this conversation as resolved.
Show resolved Hide resolved
</StyledInfo>

{!inMentions && (
Expand Down
45 changes: 17 additions & 28 deletions ts/components/settings/BlockedList.tsx
Bilb marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -6,57 +6,42 @@ import { useSet } from '../../hooks/useSet';
import { ToastUtils } from '../../session/utils';
import { BlockedNumberController } from '../../util';
import { SessionButton, SessionButtonColor } from '../basic/SessionButton';
import { SpacerLG } from '../basic/Text';
import { SpacerLG, SpacerSM } from '../basic/Text';
import { SessionIconButton } from '../icon';
import { MemberListItem } from '../MemberListItem';
import { SettingsTitleAndDescription } from './SessionSettingListItem';
import { SessionSettingsItemWrapper, SettingsTitleAndDescription } from './SessionSettingListItem';

const BlockedEntriesContainer = styled.div`
flex-shrink: 1;
overflow: auto;
min-height: 40px;
max-height: 100%;
display: flex;
flex-direction: column;
flex: 1;
width: 100%;
`;

const BlockedEntriesRoundedContainer = styled.div`
overflow: hidden;
background: var(--background-secondary-color);
border: 1px solid var(--border-color);
border-radius: 16px;
padding: var(--margins-lg);
margin: 0 var(--margins-lg);
`;

const BlockedContactsSection = styled.div`
display: flex;
flex-direction: column;
min-height: 80px;

background: var(--settings-tab-background-color);
color: var(--settings-tab-text-color);
border-top: 1px solid var(--border-color);
border-bottom: 1px solid var(--border-color);

margin-bottom: var(--margins-lg);
`;

const BlockedContactListTitle = styled.div`
display: flex;
justify-content: space-between;
min-height: 45px;
align-items: center;
`;

const BlockedContactListTitleButtons = styled.div`
display: flex;
align-items: center;
min-height: 34px; // height of the unblock button
`;

export const StyledBlockedSettingItem = styled.div<{ clickable: boolean }>`
export const StyledBlockedSettingItem = styled.div<{ clickable: boolean; expanded: boolean }>`
font-size: var(--font-size-md);
padding: var(--margins-lg);

cursor: ${props => (props.clickable ? 'pointer' : 'unset')};
${props => props.expanded && 'padding-bottom: var(--margins-lg);'}
`;

const BlockedEntries = (props: {
Expand All @@ -78,6 +63,7 @@ const BlockedEntries = (props: {
onSelect={addToSelected}
onUnselect={removeFromSelected}
disableBg={true}
maxNameWidth={'33vw'}
yougotwill marked this conversation as resolved.
Show resolved Hide resolved
/>
);
})}
Expand Down Expand Up @@ -121,8 +107,11 @@ export const BlockedContactsList = () => {
}

return (
<BlockedContactsSection>
<StyledBlockedSettingItem clickable={!noBlockedNumbers}>
<SessionSettingsItemWrapper inline={false}>
<StyledBlockedSettingItem
clickable={!noBlockedNumbers}
expanded={!noBlockedNumbers && expanded}
>
<BlockedContactListTitle onClick={toggleUnblockList}>
<SettingsTitleAndDescription title={window.i18n('blockedSettingsTitle')} />
{noBlockedNumbers ? (
Expand Down Expand Up @@ -157,9 +146,9 @@ export const BlockedContactsList = () => {
addToSelected={addToSelected}
removeFromSelected={removeFromSelected}
/>
<SpacerLG />
<SpacerSM />
</>
) : null}
</BlockedContactsSection>
</SessionSettingsItemWrapper>
);
};