nicolium: more moving stuff around, reuse stuff
Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
This commit is contained in:
@ -1,53 +0,0 @@
|
||||
import { useMutation } from '@tanstack/react-query';
|
||||
import React from 'react';
|
||||
import { defineMessages, useIntl } from 'react-intl';
|
||||
|
||||
import HStack from '@/components/ui/hstack';
|
||||
import IconButton from '@/components/ui/icon-button';
|
||||
import Text from '@/components/ui/text';
|
||||
import { unblockDomainMutationOptions } from '@/queries/settings/domain-blocks';
|
||||
|
||||
const messages = defineMessages({
|
||||
blockDomainConfirm: {
|
||||
id: 'confirmations.domain_block.confirm',
|
||||
defaultMessage: 'Hide entire domain',
|
||||
},
|
||||
unblockDomain: { id: 'account.unblock_domain', defaultMessage: 'Unhide {domain}' },
|
||||
});
|
||||
|
||||
interface IDomain {
|
||||
domain: string;
|
||||
}
|
||||
|
||||
const Domain: React.FC<IDomain> = ({ domain }) => {
|
||||
const intl = useIntl();
|
||||
|
||||
const { mutate: unblockDomain } = useMutation(unblockDomainMutationOptions);
|
||||
|
||||
// const onBlockDomain = () => {
|
||||
// openModal('CONFIRM', {
|
||||
// heading: <FormattedMessage id='confirmations.domain_block.heading' defaultMessage='Block {domain}' values={{ domain }} />,
|
||||
// message: <FormattedMessage id='confirmations.domain_block.message' defaultMessage='Are you really, really sure you want to block the entire {domain}? In most cases a few targeted blocks or mutes are sufficient and preferable.' values={{ domain: <strong>{domain}</strong> }} />,
|
||||
// confirm: intl.formatMessage(messages.blockDomainConfirm),
|
||||
// onConfirm: () => blockDomain(domain),
|
||||
// });
|
||||
// }
|
||||
|
||||
const handleDomainUnblock = () => {
|
||||
unblockDomain(domain);
|
||||
};
|
||||
|
||||
return (
|
||||
<HStack alignItems='center' justifyContent='between' space={1} className='p-2'>
|
||||
<Text tag='span'>{domain}</Text>
|
||||
<IconButton
|
||||
iconClassName='h-5 w-5'
|
||||
src={require('@phosphor-icons/core/regular/lock-open.svg')}
|
||||
title={intl.formatMessage(messages.unblockDomain, { domain })}
|
||||
onClick={handleDomainUnblock}
|
||||
/>
|
||||
</HStack>
|
||||
);
|
||||
};
|
||||
|
||||
export { Domain as default };
|
||||
@ -5,4 +5,4 @@ const Link = (props: LinkProps) => (
|
||||
<Comp {...props} className='text-primary-600 hover:underline dark:text-primary-400' />
|
||||
);
|
||||
|
||||
export { Link as default };
|
||||
export { Link as default, Link };
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { Link } from '@tanstack/react-router';
|
||||
import React from 'react';
|
||||
|
||||
import { Link } from '@/components/link';
|
||||
import Tooltip from '@/components/ui/tooltip';
|
||||
|
||||
import type { Mention as MentionEntity } from 'pl-api';
|
||||
@ -21,13 +21,7 @@ const Mention: React.FC<IMention> = ({ mention: { acct, username }, disabled })
|
||||
|
||||
return (
|
||||
<Tooltip text={`@${acct}`}>
|
||||
<Link
|
||||
to='/@{$username}'
|
||||
params={{ username: acct }}
|
||||
className='text-primary-600 hover:underline dark:text-primary-400'
|
||||
onClick={handleClick}
|
||||
dir='ltr'
|
||||
>
|
||||
<Link to='/@{$username}' params={{ username: acct }} onClick={handleClick} dir='ltr'>
|
||||
@{username}
|
||||
</Link>
|
||||
</Tooltip>
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-redeclare */
|
||||
import { Link } from '@tanstack/react-router';
|
||||
import parse, {
|
||||
Element,
|
||||
type HTMLReactParserOptions,
|
||||
@ -12,6 +10,8 @@ import minBy from 'lodash/minBy';
|
||||
import React from 'react';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
|
||||
/* eslint-disable no-redeclare */
|
||||
import { Link } from '@/components/link';
|
||||
import Emojify from '@/features/emoji/emojify';
|
||||
import { useSettings } from '@/stores/settings';
|
||||
import { makeEmojiMap } from '@/utils/normalizers';
|
||||
@ -268,7 +268,6 @@ function parseContent(
|
||||
<Link
|
||||
to='/@{$username}'
|
||||
params={{ username: mention.acct }}
|
||||
className='text-primary-600 hover:underline dark:text-primary-400'
|
||||
dir='ltr'
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
// ~~Shamelessly stolen~~ ported to React from Sharkey
|
||||
// https://activitypub.software/TransFem-org/Sharkey/-/blob/develop/packages/frontend/src/components/global/MkMfm.ts
|
||||
import { Link } from '@tanstack/react-router';
|
||||
import * as mfm from '@transfem-org/sfm-js';
|
||||
import clamp from 'lodash/clamp';
|
||||
import React, { type CSSProperties } from 'react';
|
||||
|
||||
// ~~Shamelessly stolen~~ ported to React from Sharkey
|
||||
// https://activitypub.software/TransFem-org/Sharkey/-/blob/develop/packages/frontend/src/components/global/MkMfm.ts
|
||||
import { Link } from '@/components/link';
|
||||
import { useSettings } from '@/stores/settings';
|
||||
import { makeEmojiMap } from '@/utils/normalizers';
|
||||
import nyaize from '@/utils/nyaize';
|
||||
@ -438,7 +438,6 @@ const ParsedMfm: React.FC<IParsedMfm> = React.memo(({ text, emojis, mentions, sp
|
||||
<Link
|
||||
to='/@{$username}'
|
||||
params={{ username: mention.acct }}
|
||||
className='text-primary-600 hover:underline dark:text-primary-400'
|
||||
dir='ltr'
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
@ -458,7 +457,6 @@ const ParsedMfm: React.FC<IParsedMfm> = React.memo(({ text, emojis, mentions, sp
|
||||
<Link
|
||||
to='/@{$username}'
|
||||
params={{ username: token.props.acct.slice(1) }}
|
||||
className='text-primary-600 hover:underline dark:text-primary-400'
|
||||
dir='ltr'
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { Link } from '@tanstack/react-router';
|
||||
import React from 'react';
|
||||
|
||||
import { Link } from '@/components/link';
|
||||
import { useAccount } from '@/queries/accounts/use-account';
|
||||
|
||||
import HoverAccountWrapper from '../accounts/hover-account-wrapper';
|
||||
@ -24,7 +24,6 @@ const StatusMention: React.FC<IStatusMention> = ({ accountId, fallback }) => {
|
||||
<Link
|
||||
to='/@{$username}'
|
||||
params={{ username: account.acct }}
|
||||
className='text-primary-600 hover:underline dark:text-primary-400'
|
||||
dir='ltr'
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
|
||||
@ -3,7 +3,7 @@ import React, { useState } from 'react';
|
||||
import { FormattedMessage, defineMessages, useIntl } from 'react-intl';
|
||||
|
||||
import { otpVerify, verifyCredentials, switchAccount } from '@/actions/auth';
|
||||
import { BigCard } from '@/components/big-card';
|
||||
import { BigCard } from '@/components/ui/big-card';
|
||||
import Button from '@/components/ui/button';
|
||||
import Card, { CardBody, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import Form from '@/components/ui/form';
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
|
||||
import { BigCard } from '@/components/big-card';
|
||||
import { BigCard } from '@/components/ui/big-card';
|
||||
import ExternalLoginForm from '@/features/external-login/components/external-login-form';
|
||||
|
||||
/** Page for logging into a remote instance */
|
||||
|
||||
@ -4,7 +4,7 @@ import { FormattedMessage } from 'react-intl';
|
||||
|
||||
import { logIn, verifyCredentials, switchAccount } from '@/actions/auth';
|
||||
import { fetchInstance } from '@/actions/instance';
|
||||
import { BigCard } from '@/components/big-card';
|
||||
import { BigCard } from '@/components/ui/big-card';
|
||||
import Button from '@/components/ui/button';
|
||||
import Stack from '@/components/ui/stack';
|
||||
import Text from '@/components/ui/text';
|
||||
|
||||
@ -3,7 +3,7 @@ import React, { useState } from 'react';
|
||||
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
||||
|
||||
import { resetPassword } from '@/actions/security';
|
||||
import { BigCard } from '@/components/big-card';
|
||||
import { BigCard } from '@/components/ui/big-card';
|
||||
import Button from '@/components/ui/button';
|
||||
import Form from '@/components/ui/form';
|
||||
import FormActions from '@/components/ui/form-actions';
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
|
||||
import { BigCard } from '@/components/big-card';
|
||||
import { BigCard } from '@/components/ui/big-card';
|
||||
import RegistrationForm from '@/features/auth-login/components/registration-form';
|
||||
import { inviteRoute } from '@/features/ui/router';
|
||||
import { useInstance } from '@/hooks/use-instance';
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
|
||||
import { BigCard } from '@/components/big-card';
|
||||
import { BigCard } from '@/components/ui/big-card';
|
||||
import Text from '@/components/ui/text';
|
||||
import RegistrationForm from '@/features/auth-login/components/registration-form';
|
||||
import { useInstance } from '@/hooks/use-instance';
|
||||
|
||||
@ -1,11 +1,15 @@
|
||||
import { useMutation } from '@tanstack/react-query';
|
||||
import { useInfiniteQuery } from '@tanstack/react-query';
|
||||
import React from 'react';
|
||||
import { defineMessages, useIntl, FormattedMessage } from 'react-intl';
|
||||
|
||||
import Domain from '@/components/domain';
|
||||
import ScrollableList from '@/components/scrollable-list';
|
||||
import Column from '@/components/ui/column';
|
||||
import HStack from '@/components/ui/hstack';
|
||||
import IconButton from '@/components/ui/icon-button';
|
||||
import Spinner from '@/components/ui/spinner';
|
||||
import Text from '@/components/ui/text';
|
||||
import { unblockDomainMutationOptions } from '@/queries/settings/domain-blocks';
|
||||
import { domainBlocksQueryOptions } from '@/queries/settings/domain-blocks';
|
||||
|
||||
const messages = defineMessages({
|
||||
@ -13,6 +17,32 @@ const messages = defineMessages({
|
||||
unblockDomain: { id: 'account.unblock_domain', defaultMessage: 'Unhide {domain}' },
|
||||
});
|
||||
|
||||
interface IDomain {
|
||||
domain: string;
|
||||
}
|
||||
|
||||
const Domain: React.FC<IDomain> = ({ domain }) => {
|
||||
const intl = useIntl();
|
||||
|
||||
const { mutate: unblockDomain } = useMutation(unblockDomainMutationOptions);
|
||||
|
||||
const handleDomainUnblock = () => {
|
||||
unblockDomain(domain);
|
||||
};
|
||||
|
||||
return (
|
||||
<HStack alignItems='center' justifyContent='between' space={1} className='p-2'>
|
||||
<Text tag='span'>{domain}</Text>
|
||||
<IconButton
|
||||
iconClassName='h-5 w-5'
|
||||
src={require('@phosphor-icons/core/regular/lock-open.svg')}
|
||||
title={intl.formatMessage(messages.unblockDomain, { domain })}
|
||||
onClick={handleDomainUnblock}
|
||||
/>
|
||||
</HStack>
|
||||
);
|
||||
};
|
||||
|
||||
const DomainBlocksPage: React.FC = () => {
|
||||
const intl = useIntl();
|
||||
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
import { Link } from '@tanstack/react-router';
|
||||
import React, { useCallback, useEffect, useRef } from 'react';
|
||||
import { defineMessages, useIntl, FormattedMessage } from 'react-intl';
|
||||
|
||||
import { fetchHomeTimeline } from '@/actions/timelines';
|
||||
import { Link } from '@/components/link';
|
||||
import PullToRefresh from '@/components/pull-to-refresh';
|
||||
import Column from '@/components/ui/column';
|
||||
import Stack from '@/components/ui/stack';
|
||||
@ -85,10 +85,7 @@ const HomeTimelinePage: React.FC = () => {
|
||||
defaultMessage='Or you can visit {public} to get started and meet other users.'
|
||||
values={{
|
||||
public: (
|
||||
<Link
|
||||
to='/timeline/local'
|
||||
className='text-primary-600 hover:underline dark:text-primary-400'
|
||||
>
|
||||
<Link to='/timeline/local'>
|
||||
<FormattedMessage
|
||||
id='empty_column.home.local_tab'
|
||||
defaultMessage='the Local tab'
|
||||
|
||||
Reference in New Issue
Block a user