[Glitch] Profile redesign: Remove feature flag
Port ca5c0a144ade4bff7bd10446a39d86116879884e to glitch-soc Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
parent
c315d27f3c
commit
73caee93c2
@ -6,7 +6,6 @@ import classNames from 'classnames';
|
||||
import { Link } from 'react-router-dom';
|
||||
|
||||
import { useIdentity } from '@/flavours/glitch/identity_context';
|
||||
import { isServerFeatureEnabled } from '@/flavours/glitch/utils/environment';
|
||||
import {
|
||||
fetchRelationships,
|
||||
followAccount,
|
||||
@ -171,23 +170,10 @@ export const FollowButton: React.FC<{
|
||||
'button--compact': compact,
|
||||
});
|
||||
|
||||
if (isServerFeatureEnabled('profile_redesign')) {
|
||||
return (
|
||||
<Link to='/profile/edit' className={buttonClasses}>
|
||||
{label}
|
||||
</Link>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<a
|
||||
href='/settings/profile'
|
||||
target='_blank'
|
||||
rel='noopener'
|
||||
className={buttonClasses}
|
||||
>
|
||||
<Link to='/profile/edit' className={buttonClasses}>
|
||||
{label}
|
||||
</a>
|
||||
</Link>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -7,7 +7,6 @@ import { useHistory } from 'react-router';
|
||||
import { List as ImmutableList } from 'immutable';
|
||||
|
||||
import { useAccount } from '@/flavours/glitch/hooks/useAccount';
|
||||
import { isServerFeatureEnabled } from '@/flavours/glitch/utils/environment';
|
||||
import { fetchEndorsedAccounts } from 'flavours/glitch/actions/accounts';
|
||||
import { fetchFeaturedTags } from 'flavours/glitch/actions/featured_tags';
|
||||
import { Account } from 'flavours/glitch/components/account';
|
||||
@ -49,11 +48,7 @@ const AccountFeatured: React.FC<{ multiColumn: boolean }> = ({
|
||||
|
||||
const history = useHistory();
|
||||
useEffect(() => {
|
||||
if (
|
||||
account &&
|
||||
!account.show_featured &&
|
||||
isServerFeatureEnabled('profile_redesign')
|
||||
) {
|
||||
if (account && !account.show_featured) {
|
||||
history.push(`/@${account.acct}`);
|
||||
}
|
||||
}, [account, history]);
|
||||
@ -111,8 +106,7 @@ const AccountFeatured: React.FC<{ multiColumn: boolean }> = ({
|
||||
);
|
||||
}
|
||||
|
||||
const noTags =
|
||||
featuredTags.isEmpty() || isServerFeatureEnabled('profile_redesign');
|
||||
const noTags = featuredTags.isEmpty();
|
||||
|
||||
if (
|
||||
noTags &&
|
||||
|
||||
@ -4,7 +4,6 @@ import { FormattedMessage, useIntl, defineMessages } from 'react-intl';
|
||||
|
||||
import { List as ImmutableList, isList } from 'immutable';
|
||||
|
||||
import { isServerFeatureEnabled } from '@/flavours/glitch/utils/environment';
|
||||
import PersonIcon from '@/material-icons/400-24px/person.svg?react';
|
||||
import { openModal } from 'flavours/glitch/actions/modal';
|
||||
import { expandAccountMediaTimeline } from 'flavours/glitch/actions/timelines';
|
||||
@ -31,8 +30,6 @@ const messages = defineMessages({
|
||||
|
||||
const emptyList = ImmutableList<MediaAttachment>();
|
||||
|
||||
const redesignEnabled = isServerFeatureEnabled('profile_redesign');
|
||||
|
||||
const selectGalleryTimeline = createAppSelector(
|
||||
[
|
||||
(_state, accountId?: string | null) => accountId,
|
||||
@ -62,7 +59,7 @@ const selectGalleryTimeline = createAppSelector(
|
||||
|
||||
const { show_media, show_media_replies } = account;
|
||||
// If the account disabled showing media, don't display anything.
|
||||
if (!show_media && redesignEnabled) {
|
||||
if (!show_media) {
|
||||
return {
|
||||
items,
|
||||
hasMore: false,
|
||||
@ -71,7 +68,7 @@ const selectGalleryTimeline = createAppSelector(
|
||||
};
|
||||
}
|
||||
|
||||
const withReplies = show_media_replies && redesignEnabled;
|
||||
const withReplies = show_media_replies;
|
||||
const timeline = timelines.get(
|
||||
`account:${accountId}:media${withReplies ? ':with_replies' : ''}`,
|
||||
);
|
||||
|
||||
@ -1,9 +1,4 @@
|
||||
import type { AccountFieldShape } from '@/flavours/glitch/models/account';
|
||||
import { isServerFeatureEnabled } from '@/flavours/glitch/utils/environment';
|
||||
|
||||
export function isRedesignEnabled() {
|
||||
return isServerFeatureEnabled('profile_redesign');
|
||||
}
|
||||
|
||||
export interface AccountField extends AccountFieldShape {
|
||||
nameHasEmojis: boolean;
|
||||
|
||||
@ -7,7 +7,6 @@ import { openModal } from '@/flavours/glitch/actions/modal';
|
||||
import { AccountBio } from '@/flavours/glitch/components/account_bio';
|
||||
import { Avatar } from '@/flavours/glitch/components/avatar';
|
||||
import { AnimateEmojiProvider } from '@/flavours/glitch/components/emoji/context';
|
||||
import { AccountNote } from '@/flavours/glitch/features/account/components/account_note';
|
||||
import FollowRequestNoteContainer from '@/flavours/glitch/features/account/containers/follow_request_note_container';
|
||||
import { useLayout } from '@/flavours/glitch/hooks/useLayout';
|
||||
import { useVisibility } from '@/flavours/glitch/hooks/useVisibility';
|
||||
@ -20,9 +19,6 @@ import type { Account } from '@/flavours/glitch/models/account';
|
||||
import { getAccountHidden } from '@/flavours/glitch/selectors/accounts';
|
||||
import { useAppSelector, useAppDispatch } from '@/flavours/glitch/store';
|
||||
|
||||
import { ActionBar } from '../../account/components/action_bar';
|
||||
import { isRedesignEnabled } from '../common';
|
||||
|
||||
import { AccountName } from './account_name';
|
||||
import { AccountSubscriptionForm } from './account_subscription_form';
|
||||
import { AccountBadges } from './badges';
|
||||
@ -33,6 +29,7 @@ import { AccountInfo } from './info';
|
||||
import { MemorialNote } from './memorial_note';
|
||||
import { MovedNote } from './moved_note';
|
||||
import { AccountNote as AccountNoteRedesign } from './note';
|
||||
import { AccountNumberFields } from './number_fields';
|
||||
import redesignClasses from './redesign.module.scss';
|
||||
import { AccountTabs } from './tabs';
|
||||
|
||||
@ -52,8 +49,6 @@ export const AccountHeader: React.FC<{
|
||||
accountId: string;
|
||||
hideTabs?: boolean;
|
||||
}> = ({ accountId, hideTabs }) => {
|
||||
const isRedesign = isRedesignEnabled();
|
||||
|
||||
const dispatch = useAppDispatch();
|
||||
const account = useAppSelector((state) => state.accounts.get(accountId));
|
||||
const relationship = useAppSelector((state) =>
|
||||
@ -120,7 +115,7 @@ export const AccountHeader: React.FC<{
|
||||
<div
|
||||
className={classNames(
|
||||
'account__header__image',
|
||||
isRedesign && redesignClasses.header,
|
||||
redesignClasses.header,
|
||||
)}
|
||||
>
|
||||
{me !== account.id && relationship && (
|
||||
@ -139,13 +134,13 @@ export const AccountHeader: React.FC<{
|
||||
<div
|
||||
className={classNames(
|
||||
'account__header__bar',
|
||||
isRedesign && redesignClasses.barWrapper,
|
||||
redesignClasses.barWrapper,
|
||||
)}
|
||||
>
|
||||
<div
|
||||
className={classNames(
|
||||
'account__header__tabs',
|
||||
isRedesign && redesignClasses.avatarWrapper,
|
||||
redesignClasses.avatarWrapper,
|
||||
)}
|
||||
>
|
||||
<a
|
||||
@ -157,33 +152,24 @@ export const AccountHeader: React.FC<{
|
||||
>
|
||||
<Avatar
|
||||
account={suspendedOrHidden ? undefined : account}
|
||||
size={isRedesign ? 80 : 92}
|
||||
size={80}
|
||||
/>
|
||||
</a>
|
||||
|
||||
{!isRedesign && (
|
||||
<AccountButtons
|
||||
accountId={accountId}
|
||||
className='account__header__buttons--desktop'
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div
|
||||
className={classNames(
|
||||
'account__header__tabs__name',
|
||||
isRedesign && redesignClasses.nameWrapper,
|
||||
redesignClasses.nameWrapper,
|
||||
)}
|
||||
>
|
||||
<AccountName accountId={accountId} />
|
||||
{isRedesign && (
|
||||
<AccountButtons
|
||||
accountId={accountId}
|
||||
className={redesignClasses.buttonsDesktop}
|
||||
noShare={!isMe || 'share' in navigator}
|
||||
forceMenu={'share' in navigator}
|
||||
/>
|
||||
)}
|
||||
<AccountButtons
|
||||
accountId={accountId}
|
||||
className={redesignClasses.buttonsDesktop}
|
||||
noShare={!isMe || 'share' in navigator}
|
||||
forceMenu={'share' in navigator}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<AccountBadges accountId={accountId} />
|
||||
@ -192,58 +178,45 @@ export const AccountHeader: React.FC<{
|
||||
<FamiliarFollowers accountId={accountId} />
|
||||
)}
|
||||
|
||||
{!isRedesign && (
|
||||
<AccountButtons
|
||||
className='account__header__buttons--mobile'
|
||||
accountId={accountId}
|
||||
noShare
|
||||
/>
|
||||
)}
|
||||
|
||||
{!suspendedOrHidden && (
|
||||
<div className='account__header__extra'>
|
||||
<div className='account__header__bio'>
|
||||
{me &&
|
||||
account.id !== me &&
|
||||
(isRedesign ? (
|
||||
<AccountNoteRedesign accountId={accountId} />
|
||||
) : (
|
||||
<AccountNote accountId={accountId} />
|
||||
))}
|
||||
{me && account.id !== me && (
|
||||
<AccountNoteRedesign accountId={accountId} />
|
||||
)}
|
||||
|
||||
<AccountBio
|
||||
showDropdown
|
||||
accountId={accountId}
|
||||
className={classNames(
|
||||
'account__header__content',
|
||||
isRedesign && redesignClasses.bio,
|
||||
redesignClasses.bio,
|
||||
)}
|
||||
/>
|
||||
|
||||
<AccountHeaderFields accountId={accountId} />
|
||||
</div>
|
||||
|
||||
{!me && account.email_subscriptions && (
|
||||
<AccountSubscriptionForm accountId={accountId} />
|
||||
)}
|
||||
|
||||
<AccountNumberFields accountId={accountId} />
|
||||
</div>
|
||||
)}
|
||||
|
||||
{isRedesign && (
|
||||
<AccountButtons
|
||||
className={classNames(
|
||||
redesignClasses.buttonsMobile,
|
||||
!isIntersecting && redesignClasses.buttonsMobileIsStuck,
|
||||
)}
|
||||
accountId={accountId}
|
||||
noShare
|
||||
/>
|
||||
)}
|
||||
<AccountButtons
|
||||
className={classNames(
|
||||
redesignClasses.buttonsMobile,
|
||||
!isIntersecting && redesignClasses.buttonsMobileIsStuck,
|
||||
)}
|
||||
accountId={accountId}
|
||||
noShare
|
||||
/>
|
||||
</div>
|
||||
</AnimateEmojiProvider>
|
||||
|
||||
<ActionBar account={account} />
|
||||
|
||||
{!hideTabs && !hidden && <AccountTabs acct={account.acct} />}
|
||||
{!hideTabs && !hidden && <AccountTabs />}
|
||||
<div ref={observedRef} />
|
||||
|
||||
<Helmet>
|
||||
|
||||
@ -14,10 +14,6 @@ import { useAppSelector } from '@/flavours/glitch/store';
|
||||
import AtIcon from '@/material-icons/400-24px/alternate_email.svg?react';
|
||||
import HelpIcon from '@/material-icons/400-24px/help.svg?react';
|
||||
import DomainIcon from '@/material-icons/400-24px/language.svg?react';
|
||||
import LockIcon from '@/material-icons/400-24px/lock.svg?react';
|
||||
|
||||
import { DomainPill } from '../../account/components/domain_pill';
|
||||
import { isRedesignEnabled } from '../common';
|
||||
|
||||
import classes from './redesign.module.scss';
|
||||
|
||||
@ -34,7 +30,6 @@ const messages = defineMessages({
|
||||
});
|
||||
|
||||
export const AccountName: FC<{ accountId: string }> = ({ accountId }) => {
|
||||
const intl = useIntl();
|
||||
const account = useAccount(accountId);
|
||||
const me = useAppSelector((state) => state.meta.get('me') as string);
|
||||
const localDomain = useAppSelector(
|
||||
@ -47,32 +42,6 @@ export const AccountName: FC<{ accountId: string }> = ({ accountId }) => {
|
||||
|
||||
const [username = '', domain = localDomain] = account.acct.split('@');
|
||||
|
||||
if (!isRedesignEnabled()) {
|
||||
return (
|
||||
<h1>
|
||||
<DisplayName account={account} variant='simple' />
|
||||
<small>
|
||||
<span>
|
||||
@{username}
|
||||
<span className='invisible'>@{domain}</span>
|
||||
</span>
|
||||
<DomainPill
|
||||
username={username}
|
||||
domain={domain}
|
||||
isSelf={me === account.id}
|
||||
/>
|
||||
{account.locked && (
|
||||
<Icon
|
||||
id='lock'
|
||||
icon={LockIcon}
|
||||
aria-label={intl.formatMessage(messages.lockedInfo)}
|
||||
/>
|
||||
)}
|
||||
</small>
|
||||
</h1>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={classes.name}>
|
||||
<h1>
|
||||
|
||||
@ -20,8 +20,6 @@ import type { AccountRole } from '@/flavours/glitch/models/account';
|
||||
import { useAppDispatch, useAppSelector } from '@/flavours/glitch/store';
|
||||
import IconPinned from '@/images/icons/icon_pinned.svg?react';
|
||||
|
||||
import { isRedesignEnabled } from '../common';
|
||||
|
||||
import classes from './redesign.module.scss';
|
||||
|
||||
export const AccountBadges: FC<{ accountId: string }> = ({ accountId }) => {
|
||||
@ -46,9 +44,6 @@ export const AccountBadges: FC<{ accountId: string }> = ({ accountId }) => {
|
||||
return null;
|
||||
}
|
||||
|
||||
const isRedesign = isRedesignEnabled();
|
||||
const className = isRedesign ? classes.badge : '';
|
||||
|
||||
const domain = account.acct.includes('@')
|
||||
? account.acct.split('@')[1]
|
||||
: localDomain;
|
||||
@ -58,7 +53,7 @@ export const AccountBadges: FC<{ accountId: string }> = ({ accountId }) => {
|
||||
<AdminBadge
|
||||
key={role.id}
|
||||
label={role.name}
|
||||
className={className}
|
||||
className={classes.badge}
|
||||
domain={`(${domain})`}
|
||||
roleId={role.id}
|
||||
/>,
|
||||
@ -68,8 +63,8 @@ export const AccountBadges: FC<{ accountId: string }> = ({ accountId }) => {
|
||||
<Badge
|
||||
key={role.id}
|
||||
label={role.name}
|
||||
className={className}
|
||||
domain={isRedesign ? `(${domain})` : domain}
|
||||
className={classes.badge}
|
||||
domain={`(${domain})`}
|
||||
roleId={role.id}
|
||||
/>,
|
||||
);
|
||||
@ -77,17 +72,17 @@ export const AccountBadges: FC<{ accountId: string }> = ({ accountId }) => {
|
||||
});
|
||||
|
||||
if (account.bot) {
|
||||
badges.push(<AutomatedBadge key='bot-badge' className={className} />);
|
||||
badges.push(<AutomatedBadge key='bot-badge' className={classes.badge} />);
|
||||
}
|
||||
if (account.group) {
|
||||
badges.push(<GroupBadge key='group-badge' className={className} />);
|
||||
badges.push(<GroupBadge key='group-badge' className={classes.badge} />);
|
||||
}
|
||||
if (isRedesign && relationship) {
|
||||
if (relationship) {
|
||||
if (relationship.blocking) {
|
||||
badges.push(
|
||||
<BlockedBadge
|
||||
key='blocking'
|
||||
className={classNames(className, classes.badgeBlocked)}
|
||||
className={classNames(classes.badge, classes.badgeBlocked)}
|
||||
/>,
|
||||
);
|
||||
}
|
||||
@ -95,7 +90,7 @@ export const AccountBadges: FC<{ accountId: string }> = ({ accountId }) => {
|
||||
badges.push(
|
||||
<BlockedBadge
|
||||
key='domain-blocking'
|
||||
className={classNames(className, classes.badgeBlocked)}
|
||||
className={classNames(classes.badge, classes.badgeBlocked)}
|
||||
domain={domain}
|
||||
label={
|
||||
<FormattedMessage
|
||||
@ -110,7 +105,7 @@ export const AccountBadges: FC<{ accountId: string }> = ({ accountId }) => {
|
||||
badges.push(
|
||||
<MutedBadge
|
||||
key='muted-badge'
|
||||
className={classNames(className, classes.badgeMuted)}
|
||||
className={classNames(classes.badge, classes.badgeMuted)}
|
||||
expiresAt={relationship.muting_expires_at}
|
||||
/>,
|
||||
);
|
||||
@ -136,5 +131,5 @@ export const PinnedBadge: FC = () => (
|
||||
|
||||
function isAdminBadge(role: AccountRole) {
|
||||
const name = role.name.toLowerCase();
|
||||
return isRedesignEnabled() && (name === 'admin' || name === 'owner');
|
||||
return name === 'admin' || name === 'owner';
|
||||
}
|
||||
|
||||
@ -16,8 +16,6 @@ import NotificationsIcon from '@/material-icons/400-24px/notifications.svg?react
|
||||
import NotificationsActiveIcon from '@/material-icons/400-24px/notifications_active-fill.svg?react';
|
||||
import ShareIcon from '@/material-icons/400-24px/share.svg?react';
|
||||
|
||||
import { isRedesignEnabled } from '../common';
|
||||
|
||||
import { AccountMenu } from './menu';
|
||||
|
||||
const messages = defineMessages({
|
||||
@ -97,7 +95,6 @@ const AccountButtonsOther: FC<
|
||||
accountId={accountId}
|
||||
className='account__header__follow-button'
|
||||
labelLength='long'
|
||||
withUnmute={!isRedesignEnabled()}
|
||||
/>
|
||||
)}
|
||||
{isFollowing && (
|
||||
|
||||
@ -1,68 +1,30 @@
|
||||
import { useCallback, useMemo, useRef, useState } from 'react';
|
||||
import type { FC } from 'react';
|
||||
|
||||
import { defineMessage, FormattedMessage, useIntl } from 'react-intl';
|
||||
import { defineMessage, useIntl } from 'react-intl';
|
||||
|
||||
import classNames from 'classnames';
|
||||
|
||||
import { openModal } from '@/flavours/glitch/actions/modal';
|
||||
import { AccountFields } from '@/flavours/glitch/components/account_fields';
|
||||
import { CustomEmojiProvider } from '@/flavours/glitch/components/emoji/context';
|
||||
import type { EmojiHTMLProps } from '@/flavours/glitch/components/emoji/html';
|
||||
import { EmojiHTML } from '@/flavours/glitch/components/emoji/html';
|
||||
import { FormattedDateWrapper } from '@/flavours/glitch/components/formatted_date';
|
||||
import { Icon } from '@/flavours/glitch/components/icon';
|
||||
import { IconButton } from '@/flavours/glitch/components/icon_button';
|
||||
import { MiniCard } from '@/flavours/glitch/components/mini_card';
|
||||
import { useElementHandledLink } from '@/flavours/glitch/components/status/handled_link';
|
||||
import { useAccount } from '@/flavours/glitch/hooks/useAccount';
|
||||
import { useResizeObserver } from '@/flavours/glitch/hooks/useObserver';
|
||||
import type { Account } from '@/flavours/glitch/models/account';
|
||||
import { useAppDispatch } from '@/flavours/glitch/store';
|
||||
import IconVerified from '@/images/icons/icon_verified.svg?react';
|
||||
import MoreIcon from '@/material-icons/400-24px/more_horiz.svg?react';
|
||||
|
||||
import { cleanExtraEmojis } from '../../emoji/normalize';
|
||||
import type { AccountField } from '../common';
|
||||
import { isRedesignEnabled } from '../common';
|
||||
import { useFieldHtml } from '../hooks/useFieldHtml';
|
||||
|
||||
import classes from './redesign.module.scss';
|
||||
|
||||
export const AccountHeaderFields: FC<{ accountId: string }> = ({
|
||||
accountId,
|
||||
}) => {
|
||||
const account = useAccount(accountId);
|
||||
|
||||
if (!account) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (isRedesignEnabled()) {
|
||||
return <RedesignAccountHeaderFields account={account} />;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className='account__header__fields'>
|
||||
<dl>
|
||||
<dt>
|
||||
<FormattedMessage id='account.joined_short' defaultMessage='Joined' />
|
||||
</dt>
|
||||
<dd>
|
||||
<FormattedDateWrapper
|
||||
value={account.created_at}
|
||||
year='numeric'
|
||||
month='short'
|
||||
day='2-digit'
|
||||
/>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<AccountFields fields={account.fields} emojis={account.emojis} />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
const verifyMessage = defineMessage({
|
||||
id: 'account.link_verified_on',
|
||||
defaultMessage: 'Ownership of this link was checked on {date}',
|
||||
@ -75,13 +37,22 @@ const dateFormatOptions: Intl.DateTimeFormatOptions = {
|
||||
minute: '2-digit',
|
||||
};
|
||||
|
||||
const RedesignAccountHeaderFields: FC<{ account: Account }> = ({ account }) => {
|
||||
export const AccountHeaderFields: FC<{ accountId: string }> = ({
|
||||
accountId,
|
||||
}) => {
|
||||
const account = useAccount(accountId);
|
||||
|
||||
const emojis = useMemo(
|
||||
() => cleanExtraEmojis(account.emojis),
|
||||
[account.emojis],
|
||||
() => cleanExtraEmojis(account?.emojis),
|
||||
[account?.emojis],
|
||||
);
|
||||
const accountFields = account?.fields;
|
||||
const fields: AccountField[] = useMemo(() => {
|
||||
const fields = account.fields.toJS();
|
||||
const fields = accountFields?.toJS();
|
||||
if (!fields) {
|
||||
return [];
|
||||
}
|
||||
|
||||
if (!emojis) {
|
||||
return fields.map((field) => ({
|
||||
...field,
|
||||
@ -102,10 +73,10 @@ const RedesignAccountHeaderFields: FC<{ account: Account }> = ({ account }) => {
|
||||
field.value_plain?.includes(`:${code}:`),
|
||||
),
|
||||
}));
|
||||
}, [account.fields, emojis]);
|
||||
}, [accountFields, emojis]);
|
||||
|
||||
const htmlHandlers = useElementHandledLink({
|
||||
hashtagAccountId: account.id,
|
||||
hashtagAccountId: account?.id,
|
||||
});
|
||||
|
||||
const { wrapperRef } = useColumnWrap();
|
||||
|
||||
@ -4,13 +4,9 @@ import { FormattedMessage } from 'react-intl';
|
||||
|
||||
import type { Relationship } from '@/flavours/glitch/models/relationship';
|
||||
|
||||
import { isRedesignEnabled } from '../common';
|
||||
|
||||
export const AccountInfo: FC<{ relationship?: Relationship }> = ({
|
||||
relationship,
|
||||
}) => {
|
||||
const isRedesign = isRedesignEnabled();
|
||||
|
||||
if (!relationship) {
|
||||
return null;
|
||||
}
|
||||
@ -21,17 +17,17 @@ export const AccountInfo: FC<{ relationship?: Relationship }> = ({
|
||||
<AccountInfoFollower relationship={relationship} />
|
||||
</span>
|
||||
)}
|
||||
{!isRedesign && relationship.blocking && (
|
||||
{relationship.blocking && (
|
||||
<span className='relationship-tag'>
|
||||
<FormattedMessage id='account.blocking' defaultMessage='Blocking' />
|
||||
</span>
|
||||
)}
|
||||
{!isRedesign && relationship.muting && (
|
||||
{relationship.muting && (
|
||||
<span key='muting' className='relationship-tag'>
|
||||
<FormattedMessage id='account.muting' defaultMessage='Muting' />
|
||||
</span>
|
||||
)}
|
||||
{!isRedesign && relationship.domain_blocking && (
|
||||
{relationship.domain_blocking && (
|
||||
<span key='domain_blocking' className='relationship-tag'>
|
||||
<FormattedMessage
|
||||
id='account.domain_blocking'
|
||||
|
||||
@ -43,8 +43,6 @@ import PersonRemoveIcon from '@/material-icons/400-24px/person_remove.svg?react'
|
||||
import ReportIcon from '@/material-icons/400-24px/report.svg?react';
|
||||
import ShareIcon from '@/material-icons/400-24px/share.svg?react';
|
||||
|
||||
import { isRedesignEnabled } from '../common';
|
||||
|
||||
import classes from './redesign.module.scss';
|
||||
|
||||
export const AccountMenu: FC<{ accountId: string }> = ({ accountId }) => {
|
||||
@ -66,19 +64,9 @@ export const AccountMenu: FC<{ accountId: string }> = ({ accountId }) => {
|
||||
return [];
|
||||
}
|
||||
|
||||
if (isRedesignEnabled()) {
|
||||
return redesignMenuItems({
|
||||
account,
|
||||
signedIn: !isMe && signedIn,
|
||||
permissions,
|
||||
intl,
|
||||
relationship,
|
||||
dispatch,
|
||||
});
|
||||
}
|
||||
return currentMenuItems({
|
||||
return redesignMenuItems({
|
||||
account,
|
||||
signedIn,
|
||||
signedIn: !isMe && signedIn,
|
||||
permissions,
|
||||
intl,
|
||||
relationship,
|
||||
@ -181,270 +169,6 @@ const messages = defineMessages({
|
||||
},
|
||||
});
|
||||
|
||||
function currentMenuItems({
|
||||
account,
|
||||
signedIn,
|
||||
permissions,
|
||||
intl,
|
||||
relationship,
|
||||
dispatch,
|
||||
}: MenuItemsParams): MenuItem[] {
|
||||
const items: MenuItem[] = [];
|
||||
const isRemote = account.acct !== account.username;
|
||||
|
||||
if (signedIn && !account.suspended) {
|
||||
items.push(
|
||||
{
|
||||
text: intl.formatMessage(messages.mention, {
|
||||
name: account.username,
|
||||
}),
|
||||
action: () => {
|
||||
dispatch(mentionCompose(account));
|
||||
},
|
||||
},
|
||||
{
|
||||
text: intl.formatMessage(messages.direct, {
|
||||
name: account.username,
|
||||
}),
|
||||
action: () => {
|
||||
dispatch(directCompose(account));
|
||||
},
|
||||
},
|
||||
null,
|
||||
);
|
||||
}
|
||||
|
||||
if (isRemote) {
|
||||
items.push({
|
||||
text: intl.formatMessage(messages.openOriginalPage),
|
||||
href: account.url,
|
||||
});
|
||||
|
||||
if (signedIn) {
|
||||
items.push(null);
|
||||
}
|
||||
}
|
||||
|
||||
if (!signedIn) {
|
||||
return items;
|
||||
}
|
||||
|
||||
if (relationship?.following) {
|
||||
// Timeline options
|
||||
if (!relationship.muting) {
|
||||
if (relationship.showing_reblogs) {
|
||||
items.push({
|
||||
text: intl.formatMessage(messages.hideReblogs, {
|
||||
name: account.username,
|
||||
}),
|
||||
action: () => {
|
||||
dispatch(followAccount(account.id, { reblogs: false }));
|
||||
},
|
||||
});
|
||||
} else {
|
||||
items.push({
|
||||
text: intl.formatMessage(messages.showReblogs, {
|
||||
name: account.username,
|
||||
}),
|
||||
action: () => {
|
||||
dispatch(followAccount(account.id, { reblogs: true }));
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
items.push(
|
||||
{
|
||||
text: intl.formatMessage(messages.languages),
|
||||
action: () => {
|
||||
dispatch(
|
||||
openModal({
|
||||
modalType: 'SUBSCRIBED_LANGUAGES',
|
||||
modalProps: {
|
||||
accountId: account.id,
|
||||
},
|
||||
}),
|
||||
);
|
||||
},
|
||||
},
|
||||
null,
|
||||
);
|
||||
}
|
||||
|
||||
items.push(
|
||||
{
|
||||
text: intl.formatMessage(
|
||||
relationship.endorsed ? messages.unendorse : messages.endorse,
|
||||
),
|
||||
action: () => {
|
||||
if (relationship.endorsed) {
|
||||
dispatch(unpinAccount(account.id));
|
||||
} else {
|
||||
dispatch(pinAccount(account.id));
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
text: intl.formatMessage(messages.add_or_remove_from_list),
|
||||
action: () => {
|
||||
dispatch(
|
||||
openModal({
|
||||
modalType: 'LIST_ADDER',
|
||||
modalProps: {
|
||||
accountId: account.id,
|
||||
},
|
||||
}),
|
||||
);
|
||||
},
|
||||
},
|
||||
null,
|
||||
);
|
||||
}
|
||||
|
||||
if (relationship?.followed_by) {
|
||||
const handleRemoveFromFollowers = () => {
|
||||
dispatch(
|
||||
openModal({
|
||||
modalType: 'CONFIRM',
|
||||
modalProps: {
|
||||
title: intl.formatMessage(messages.confirmRemoveFromFollowersTitle),
|
||||
message: intl.formatMessage(
|
||||
messages.confirmRemoveFromFollowersMessage,
|
||||
{ name: <strong>{account.acct}</strong> },
|
||||
),
|
||||
confirm: intl.formatMessage(
|
||||
messages.confirmRemoveFromFollowersButton,
|
||||
),
|
||||
onConfirm: () => {
|
||||
void dispatch(
|
||||
removeAccountFromFollowers({ accountId: account.id }),
|
||||
);
|
||||
},
|
||||
},
|
||||
}),
|
||||
);
|
||||
};
|
||||
|
||||
items.push({
|
||||
text: intl.formatMessage(messages.removeFromFollowers, {
|
||||
name: account.username,
|
||||
}),
|
||||
action: handleRemoveFromFollowers,
|
||||
dangerous: true,
|
||||
});
|
||||
}
|
||||
|
||||
if (relationship?.muting) {
|
||||
items.push({
|
||||
text: intl.formatMessage(messages.unmute, {
|
||||
name: account.username,
|
||||
}),
|
||||
action: () => {
|
||||
dispatch(unmuteAccount(account.id));
|
||||
},
|
||||
});
|
||||
} else {
|
||||
items.push({
|
||||
text: intl.formatMessage(messages.mute, {
|
||||
name: account.username,
|
||||
}),
|
||||
action: () => {
|
||||
dispatch(initMuteModal(account));
|
||||
},
|
||||
dangerous: true,
|
||||
});
|
||||
}
|
||||
|
||||
if (relationship?.blocking) {
|
||||
items.push({
|
||||
text: intl.formatMessage(messages.unblock, {
|
||||
name: account.username,
|
||||
}),
|
||||
action: () => {
|
||||
dispatch(unblockAccount(account.id));
|
||||
},
|
||||
});
|
||||
} else {
|
||||
items.push({
|
||||
text: intl.formatMessage(messages.block, {
|
||||
name: account.username,
|
||||
}),
|
||||
action: () => {
|
||||
dispatch(blockAccount(account.id));
|
||||
},
|
||||
dangerous: true,
|
||||
});
|
||||
}
|
||||
|
||||
if (!account.suspended) {
|
||||
items.push({
|
||||
text: intl.formatMessage(messages.report, {
|
||||
name: account.username,
|
||||
}),
|
||||
action: () => {
|
||||
dispatch(initReport(account));
|
||||
},
|
||||
dangerous: true,
|
||||
});
|
||||
}
|
||||
|
||||
const remoteDomain = isRemote ? account.acct.split('@')[1] : null;
|
||||
if (remoteDomain) {
|
||||
items.push(null);
|
||||
|
||||
if (relationship?.domain_blocking) {
|
||||
items.push({
|
||||
text: intl.formatMessage(messages.unblockDomain, {
|
||||
domain: remoteDomain,
|
||||
}),
|
||||
action: () => {
|
||||
dispatch(unblockDomain(remoteDomain));
|
||||
},
|
||||
});
|
||||
} else {
|
||||
items.push({
|
||||
text: intl.formatMessage(messages.blockDomain, {
|
||||
domain: remoteDomain,
|
||||
}),
|
||||
action: () => {
|
||||
dispatch(initDomainBlockModal(account));
|
||||
},
|
||||
dangerous: true,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
(permissions & PERMISSION_MANAGE_USERS) === PERMISSION_MANAGE_USERS ||
|
||||
(isRemote &&
|
||||
(permissions & PERMISSION_MANAGE_FEDERATION) ===
|
||||
PERMISSION_MANAGE_FEDERATION)
|
||||
) {
|
||||
items.push(null);
|
||||
if ((permissions & PERMISSION_MANAGE_USERS) === PERMISSION_MANAGE_USERS) {
|
||||
items.push({
|
||||
text: intl.formatMessage(messages.admin_account, {
|
||||
name: account.username,
|
||||
}),
|
||||
href: `/admin/accounts/${account.id}`,
|
||||
});
|
||||
}
|
||||
if (
|
||||
isRemote &&
|
||||
(permissions & PERMISSION_MANAGE_FEDERATION) ===
|
||||
PERMISSION_MANAGE_FEDERATION
|
||||
) {
|
||||
items.push({
|
||||
text: intl.formatMessage(messages.admin_domain, {
|
||||
domain: remoteDomain,
|
||||
}),
|
||||
href: `/admin/instances/${remoteDomain}`,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
const redesignMessages = defineMessages({
|
||||
share: { id: 'account.menu.share', defaultMessage: 'Share…' },
|
||||
copy: { id: 'account.menu.copy', defaultMessage: 'Copy link' },
|
||||
|
||||
@ -3,13 +3,6 @@ import type { FC } from 'react';
|
||||
|
||||
import { FormattedMessage, useIntl } from 'react-intl';
|
||||
|
||||
import { NavLink } from 'react-router-dom';
|
||||
|
||||
import {
|
||||
FollowersCounter,
|
||||
FollowingCounter,
|
||||
StatusesCounter,
|
||||
} from '@/flavours/glitch/components/counters';
|
||||
import { FormattedDateWrapper } from '@/flavours/glitch/components/formatted_date';
|
||||
import {
|
||||
NumberFields,
|
||||
@ -18,54 +11,9 @@ import {
|
||||
import { ShortNumber } from '@/flavours/glitch/components/short_number';
|
||||
import { useAccount } from '@/flavours/glitch/hooks/useAccount';
|
||||
|
||||
import { isRedesignEnabled } from '../common';
|
||||
|
||||
const LegacyNumberFields: FC<{ accountId: string }> = ({ accountId }) => {
|
||||
const intl = useIntl();
|
||||
const account = useAccount(accountId);
|
||||
|
||||
if (!account) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className='account__header__extra__links'>
|
||||
<NavLink
|
||||
to={`/@${account.acct}`}
|
||||
title={intl.formatNumber(account.statuses_count)}
|
||||
>
|
||||
<ShortNumber
|
||||
value={account.statuses_count}
|
||||
renderer={StatusesCounter}
|
||||
/>
|
||||
</NavLink>
|
||||
|
||||
<NavLink
|
||||
exact
|
||||
to={`/@${account.acct}/following`}
|
||||
title={intl.formatNumber(account.following_count)}
|
||||
>
|
||||
<ShortNumber
|
||||
value={account.following_count}
|
||||
renderer={FollowingCounter}
|
||||
/>
|
||||
</NavLink>
|
||||
|
||||
<NavLink
|
||||
exact
|
||||
to={`/@${account.acct}/followers`}
|
||||
title={intl.formatNumber(account.followers_count)}
|
||||
>
|
||||
<ShortNumber
|
||||
value={account.followers_count}
|
||||
renderer={FollowersCounter}
|
||||
/>
|
||||
</NavLink>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
const RedesignNumberFields: FC<{ accountId: string }> = ({ accountId }) => {
|
||||
export const AccountNumberFields: FC<{ accountId: string }> = ({
|
||||
accountId,
|
||||
}) => {
|
||||
const intl = useIntl();
|
||||
const account = useAccount(accountId);
|
||||
const createdThisYear = useMemo(
|
||||
@ -125,7 +73,3 @@ const RedesignNumberFields: FC<{ accountId: string }> = ({ accountId }) => {
|
||||
</NumberFields>
|
||||
);
|
||||
};
|
||||
|
||||
export const AccountNumberFields = isRedesignEnabled()
|
||||
? RedesignNumberFields
|
||||
: LegacyNumberFields;
|
||||
|
||||
@ -8,40 +8,13 @@ import { NavLink } from 'react-router-dom';
|
||||
import { useAccount } from '@/flavours/glitch/hooks/useAccount';
|
||||
import { useAccountId } from '@/flavours/glitch/hooks/useAccountId';
|
||||
|
||||
import { isRedesignEnabled } from '../common';
|
||||
|
||||
import classes from './redesign.module.scss';
|
||||
|
||||
export const AccountTabs: FC<{ acct: string }> = ({ acct }) => {
|
||||
if (isRedesignEnabled()) {
|
||||
return <RedesignTabs />;
|
||||
}
|
||||
return (
|
||||
<div className='account__section-headline'>
|
||||
<NavLink exact to={`/@${acct}/featured`}>
|
||||
<FormattedMessage id='account.featured' defaultMessage='Featured' />
|
||||
</NavLink>
|
||||
<NavLink exact to={`/@${acct}`}>
|
||||
<FormattedMessage id='account.posts' defaultMessage='Posts' />
|
||||
</NavLink>
|
||||
<NavLink exact to={`/@${acct}/with_replies`}>
|
||||
<FormattedMessage
|
||||
id='account.posts_with_replies'
|
||||
defaultMessage='Posts and replies'
|
||||
/>
|
||||
</NavLink>
|
||||
<NavLink exact to={`/@${acct}/media`}>
|
||||
<FormattedMessage id='account.media' defaultMessage='Media' />
|
||||
</NavLink>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
const isActive: Required<NavLinkProps>['isActive'] = (match, location) =>
|
||||
match?.url === location.pathname ||
|
||||
(!!match?.url && location.pathname.startsWith(`${match.url}/tagged/`));
|
||||
|
||||
const RedesignTabs: FC = () => {
|
||||
export const AccountTabs: FC = () => {
|
||||
const accountId = useAccountId();
|
||||
const account = useAccount(accountId);
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@ export const AccountFilters: FC = () => {
|
||||
}
|
||||
return (
|
||||
<>
|
||||
<AccountTabs acct={acct} />
|
||||
<AccountTabs />
|
||||
<div className={classes.filtersWrapper}>
|
||||
<FilterDropdown />
|
||||
</div>
|
||||
|
||||
@ -18,7 +18,6 @@ import { selectTimelineByKey } from '@/flavours/glitch/selectors/timelines';
|
||||
import { useAppDispatch, useAppSelector } from '@/flavours/glitch/store';
|
||||
import IconPinned from '@/images/icons/icon_pinned.svg?react';
|
||||
|
||||
import { isRedesignEnabled } from '../common';
|
||||
import { PinnedBadge } from '../components/badges';
|
||||
|
||||
import { useAccountContext } from './context';
|
||||
@ -88,10 +87,6 @@ export const renderPinnedStatusHeader: StatusHeaderRenderFn = ({
|
||||
export const PinnedShowAllButton: FC = () => {
|
||||
const { onShowAllPinned } = useAccountContext();
|
||||
|
||||
if (!isRedesignEnabled()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<Button
|
||||
onClick={onShowAllPinned}
|
||||
|
||||
@ -27,7 +27,6 @@ import { layoutFromWindow } from 'flavours/glitch/is_mobile';
|
||||
import { selectUnreadNotificationGroupsCount } from 'flavours/glitch/selectors/notifications';
|
||||
import { WithRouterPropTypes } from 'flavours/glitch/utils/react_router';
|
||||
import { checkAnnualReport } from '@/flavours/glitch/reducers/slices/annual_report';
|
||||
import { isServerFeatureEnabled } from '@/flavours/glitch/utils/environment';
|
||||
|
||||
import { uploadCompose, resetCompose, changeComposeSpoilerness } from '../../actions/compose';
|
||||
import { clearHeight } from '../../actions/height_cache';
|
||||
@ -190,20 +189,6 @@ class SwitchingColumnsArea extends PureComponent {
|
||||
rootRedirect = '/about';
|
||||
}
|
||||
|
||||
const profileRedesignRoutes = [];
|
||||
if (isServerFeatureEnabled('profile_redesign')) {
|
||||
profileRedesignRoutes.push(
|
||||
<WrappedRoute key="edit" path='/profile/edit' component={AccountEdit} content={children} />,
|
||||
<WrappedRoute key="featured_tags" path='/profile/featured_tags' component={AccountEditFeaturedTags} content={children} />
|
||||
)
|
||||
} else {
|
||||
// If profile editing is not enabled, redirect to the home timeline as the current editing pages are outside React Router.
|
||||
profileRedesignRoutes.push(
|
||||
<Redirect key="edit-redirect" from='/profile/edit' to='/' exact />,
|
||||
<Redirect key="featured-tags-redirect" from='/profile/featured_tags' to='/' exact />,
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<ColumnsContextProvider multiColumn={!singleColumn}>
|
||||
<ColumnsArea ref={this.setRef} singleColumn={singleColumn}>
|
||||
@ -250,7 +235,8 @@ class SwitchingColumnsArea extends PureComponent {
|
||||
<WrappedRoute path='/search' component={Search} content={children} />
|
||||
<WrappedRoute path={['/publish', '/statuses/new']} component={Compose} content={children} />
|
||||
|
||||
{...profileRedesignRoutes}
|
||||
<WrappedRoute path='/profile/edit' component={AccountEdit} content={children} />
|
||||
<WrappedRoute path='/profile/featured_tags' component={AccountEditFeaturedTags} content={children} />
|
||||
|
||||
<WrappedRoute path={['/@:acct', '/accounts/:id']} exact component={AccountTimeline} content={children} />
|
||||
<WrappedRoute path={['/@:acct/featured', '/accounts/:id/featured']} component={AccountFeatured} content={children} />
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
import { isServerFeatureEnabled } from '@/flavours/glitch/utils/environment';
|
||||
|
||||
export function EmojiPicker () {
|
||||
return import('../../emoji/emoji_picker');
|
||||
}
|
||||
@ -79,10 +77,7 @@ export function PinnedStatuses () {
|
||||
}
|
||||
|
||||
export function AccountTimeline () {
|
||||
if (isServerFeatureEnabled('profile_redesign')) {
|
||||
return import('../../account_timeline/v2');
|
||||
}
|
||||
return import('../../account_timeline');
|
||||
return import('../../account_timeline/v2');
|
||||
}
|
||||
|
||||
export function AccountGallery () {
|
||||
|
||||
@ -12,7 +12,7 @@ export function isProduction() {
|
||||
else return import.meta.env.PROD;
|
||||
}
|
||||
|
||||
export type ServerFeatures = 'fasp' | 'collections' | 'profile_redesign';
|
||||
export type ServerFeatures = 'fasp' | 'collections';
|
||||
|
||||
export function isServerFeatureEnabled(feature: ServerFeatures) {
|
||||
return initialState?.features.includes(feature) ?? false;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user