Merge branch 'fix-anchor-used-as-button' into 'main'
Fix warning about anchor See merge request soapbox-pub/soapbox!3184
This commit is contained in:
commit
6be7209cbc
|
@ -233,7 +233,7 @@ export default class AutosuggestInput extends PureComponent<IAutosuggestInput> {
|
||||||
}
|
}
|
||||||
|
|
||||||
return menu.map((item, i) => (
|
return menu.map((item, i) => (
|
||||||
<a
|
<a // eslint-disable-line jsx-a11y/anchor-is-valid
|
||||||
className={clsx('flex cursor-pointer items-center space-x-2 px-4 py-2.5 text-sm text-gray-700 hover:bg-gray-100 focus:bg-gray-100 dark:text-gray-500 dark:hover:bg-gray-800 dark:focus:bg-primary-800', { selected: suggestions.size - selectedSuggestion === i })}
|
className={clsx('flex cursor-pointer items-center space-x-2 px-4 py-2.5 text-sm text-gray-700 hover:bg-gray-100 focus:bg-gray-100 dark:text-gray-500 dark:hover:bg-gray-800 dark:focus:bg-primary-800', { selected: suggestions.size - selectedSuggestion === i })}
|
||||||
href='#'
|
href='#'
|
||||||
role='button'
|
role='button'
|
||||||
|
|
|
@ -147,11 +147,13 @@ const SidebarMenu: React.FC = (): JSX.Element | null => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const renderAccount = (account: AccountEntity) => (
|
const renderAccount = (account: AccountEntity) => (
|
||||||
<a href='#' className='block py-2' onClick={handleSwitchAccount(account)} key={account.id}>
|
<Link to={'/'} className='inline-flex'>
|
||||||
<div className='pointer-events-none'>
|
<button className='!block space-x-2 !border-none !p-0 !py-2 !text-primary-600 hover:!underline focus:!ring-transparent focus:!ring-offset-0 dark:!text-accent-blue rtl:space-x-reverse' onClick={handleSwitchAccount(account)} key={account.id}>
|
||||||
|
<div className='pointer-events-none max-w-[288px]'>
|
||||||
<Account account={account} showProfileHoverCard={false} withRelationship={false} withLinkToProfile={false} />
|
<Account account={account} showProfileHoverCard={false} withRelationship={false} withLinkToProfile={false} />
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</button>
|
||||||
|
</Link>
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
import { useParams } from 'react-router-dom';
|
import { Link, useParams } from 'react-router-dom';
|
||||||
|
|
||||||
import { fetchAboutPage } from 'soapbox/actions/about.ts';
|
import { fetchAboutPage } from 'soapbox/actions/about.ts';
|
||||||
import { Navlinks } from 'soapbox/components/navlinks.tsx';
|
import { Navlinks } from 'soapbox/components/navlinks.tsx';
|
||||||
|
@ -44,18 +44,22 @@ const AboutPage: React.FC = () => {
|
||||||
{' '} {/* eslint-disable-line formatjs/no-literal-string-in-jsx */}
|
{' '} {/* eslint-disable-line formatjs/no-literal-string-in-jsx */}
|
||||||
<ul className='inline list-none p-0'>
|
<ul className='inline list-none p-0'>
|
||||||
<li className="inline after:content-['_·_']">
|
<li className="inline after:content-['_·_']">
|
||||||
<a href='#' onClick={() => setLocale(defaultLocale)}>
|
<Link to={'/'} className='inline-flex'>
|
||||||
|
<button className='space-x-2 !border-none !p-0 !text-primary-600 hover:!underline focus:!ring-transparent focus:!ring-offset-0 dark:!text-accent-blue rtl:space-x-reverse' onClick={() => setLocale(defaultLocale)}>
|
||||||
{/* @ts-ignore */}
|
{/* @ts-ignore */}
|
||||||
{languages[defaultLocale] || defaultLocale}
|
{languages[defaultLocale] || defaultLocale}
|
||||||
</a>
|
</button>
|
||||||
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
{
|
{
|
||||||
pageLocales?.map(locale => (
|
pageLocales?.map(locale => (
|
||||||
<li className="inline after:content-['_·_'] last:after:content-none" key={locale}>
|
<li className="inline after:content-['_·_'] last:after:content-none" key={locale}>
|
||||||
<a href='#' onClick={() => setLocale(locale)}>
|
<Link to={'/'} className='inline-flex'>
|
||||||
|
<button className='space-x-2 !border-none !p-0 !text-primary-600 hover:!underline focus:!ring-transparent focus:!ring-offset-0 dark:!text-accent-blue rtl:space-x-reverse' onClick={() => setLocale(locale)}>
|
||||||
{/* @ts-ignore */}
|
{/* @ts-ignore */}
|
||||||
{languages[locale] || locale}
|
{languages[locale] || locale}
|
||||||
</a>
|
</button>
|
||||||
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { FormattedDate, defineMessages, useIntl } from 'react-intl';
|
import { FormattedDate, defineMessages, useIntl } from 'react-intl';
|
||||||
|
import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
import { fetchBackups, createBackup } from 'soapbox/actions/backups.ts';
|
import { fetchBackups, createBackup } from 'soapbox/actions/backups.ts';
|
||||||
import Button from 'soapbox/components/ui/button.tsx';
|
import Button from 'soapbox/components/ui/button.tsx';
|
||||||
|
@ -86,11 +87,13 @@ const Backups = () => {
|
||||||
<Card variant='rounded' size='lg'>
|
<Card variant='rounded' size='lg'>
|
||||||
{intl.formatMessage(messages.emptyMessage, {
|
{intl.formatMessage(messages.emptyMessage, {
|
||||||
action: (
|
action: (
|
||||||
<a href='#' onClick={handleCreateBackup}>
|
<Link to={'/'} className='inline-flex'>
|
||||||
|
<button className='space-x-2 !border-none !p-0 !text-primary-600 hover:!underline focus:!ring-transparent focus:!ring-offset-0 dark:!text-accent-blue rtl:space-x-reverse' onClick={handleCreateBackup}>
|
||||||
<Text tag='span' theme='primary' size='sm' className='hover:underline'>
|
<Text tag='span' theme='primary' size='sm' className='hover:underline'>
|
||||||
{intl.formatMessage(messages.emptyMessageAction)}
|
{intl.formatMessage(messages.emptyMessageAction)}
|
||||||
</Text>
|
</Text>
|
||||||
</a>
|
</button>
|
||||||
|
</Link>
|
||||||
),
|
),
|
||||||
})}
|
})}
|
||||||
</Card>
|
</Card>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { useCallback } from 'react';
|
import { useCallback } from 'react';
|
||||||
import { FormattedList, FormattedMessage } from 'react-intl';
|
import { FormattedList, FormattedMessage } from 'react-intl';
|
||||||
|
import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
import { openModal } from 'soapbox/actions/modals.ts';
|
import { openModal } from 'soapbox/actions/modals.ts';
|
||||||
import { useAppDispatch } from 'soapbox/hooks/useAppDispatch.ts';
|
import { useAppDispatch } from 'soapbox/hooks/useAppDispatch.ts';
|
||||||
|
@ -33,7 +34,7 @@ const ReplyMentions: React.FC<IReplyMentions> = ({ composeId }) => {
|
||||||
|
|
||||||
const parentTo = status && statusToMentionsAccountIdsArray(status, account!);
|
const parentTo = status && statusToMentionsAccountIdsArray(status, account!);
|
||||||
|
|
||||||
const handleClick = (e: React.MouseEvent<HTMLAnchorElement>) => {
|
const handleClick = (e: React.MouseEvent<HTMLButtonElement>) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
dispatch(openModal('REPLY_MENTIONS', {
|
dispatch(openModal('REPLY_MENTIONS', {
|
||||||
|
@ -47,19 +48,21 @@ const ReplyMentions: React.FC<IReplyMentions> = ({ composeId }) => {
|
||||||
|
|
||||||
if (to.size === 0) {
|
if (to.size === 0) {
|
||||||
return (
|
return (
|
||||||
<a href='#' className='reply-mentions' onClick={handleClick}>
|
<Link to={'/'} className='inline-flex'>
|
||||||
|
<button className='mb-1 cursor-pointer space-x-2 !border-none !bg-transparent !p-0 text-sm !text-gray-700 dark:!text-gray-600 rtl:space-x-reverse' onClick={handleClick}>
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
id='reply_mentions.reply_empty'
|
id='reply_mentions.reply_empty'
|
||||||
defaultMessage='Replying to post'
|
defaultMessage='Replying to post'
|
||||||
/>
|
/>
|
||||||
</a>
|
</button>
|
||||||
|
</Link>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const accounts = to.slice(0, 2).map((acct: string) => {
|
const accounts = to.slice(0, 2).map((acct: string) => {
|
||||||
const username = acct.split('@')[0];
|
const username = acct.split('@')[0];
|
||||||
return (
|
return (
|
||||||
<span className='reply-mentions__account'> {/* eslint-disable-line formatjs/no-literal-string-in-jsx */}
|
<span className='inline-block text-primary-600 no-underline hover:text-primary-700 hover:underline dark:text-accent-blue dark:hover:text-accent-blue'>{/* eslint-disable-line formatjs/no-literal-string-in-jsx */}
|
||||||
@{shortenNostr(username)}
|
@{shortenNostr(username)}
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
|
@ -72,7 +75,8 @@ const ReplyMentions: React.FC<IReplyMentions> = ({ composeId }) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<a href='#' className='reply-mentions' onClick={handleClick}>
|
<Link to={'/'} className='inline-flex'>
|
||||||
|
<button className='mb-1 cursor-pointer space-x-2 !border-none !p-0 text-sm !text-gray-700 focus:!ring-transparent focus:ring-offset-0 dark:!text-gray-600 rtl:space-x-reverse' onClick={handleClick}>
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
id='reply_mentions.reply'
|
id='reply_mentions.reply'
|
||||||
defaultMessage='Replying to {accounts}'
|
defaultMessage='Replying to {accounts}'
|
||||||
|
@ -80,7 +84,8 @@ const ReplyMentions: React.FC<IReplyMentions> = ({ composeId }) => {
|
||||||
accounts: <FormattedList type='conjunction' value={accounts} />,
|
accounts: <FormattedList type='conjunction' value={accounts} />,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</a>
|
</button>
|
||||||
|
</Link>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
import externalLinkIcon from '@tabler/icons/outline/external-link.svg';
|
import externalLinkIcon from '@tabler/icons/outline/external-link.svg';
|
||||||
import qrcodeIcon from '@tabler/icons/outline/qrcode.svg';
|
import qrcodeIcon from '@tabler/icons/outline/qrcode.svg';
|
||||||
|
import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
import { openModal } from 'soapbox/actions/modals.ts';
|
import { openModal } from 'soapbox/actions/modals.ts';
|
||||||
import CopyableInput from 'soapbox/components/copyable-input.tsx';
|
import CopyableInput from 'soapbox/components/copyable-input.tsx';
|
||||||
import HStack from 'soapbox/components/ui/hstack.tsx';
|
import HStack from 'soapbox/components/ui/hstack.tsx';
|
||||||
import Icon from 'soapbox/components/ui/icon.tsx';
|
|
||||||
import Stack from 'soapbox/components/ui/stack.tsx';
|
import Stack from 'soapbox/components/ui/stack.tsx';
|
||||||
|
import SvgIcon from 'soapbox/components/ui/svg-icon.tsx';
|
||||||
import Text from 'soapbox/components/ui/text.tsx';
|
import Text from 'soapbox/components/ui/text.tsx';
|
||||||
import { useAppDispatch } from 'soapbox/hooks/useAppDispatch.ts';
|
import { useAppDispatch } from 'soapbox/hooks/useAppDispatch.ts';
|
||||||
|
|
||||||
|
@ -45,13 +46,15 @@ const CryptoAddress: React.FC<ICryptoAddress> = (props): JSX.Element => {
|
||||||
<Text weight='bold'>{title || ticker.toUpperCase()}</Text>
|
<Text weight='bold'>{title || ticker.toUpperCase()}</Text>
|
||||||
|
|
||||||
<HStack alignItems='center' className='ml-auto'>
|
<HStack alignItems='center' className='ml-auto'>
|
||||||
<a className='ml-1 text-gray-500 rtl:ml-0 rtl:mr-1' href='#' onClick={handleModalClick}>
|
<Link to={'/'} className='inline-flex'>
|
||||||
<Icon src={qrcodeIcon} size={20} />
|
<button className='!ml-1 space-x-2 !border-none !p-0 !text-gray-500 focus:!ring-transparent focus:ring-offset-0 rtl:ml-0 rtl:mr-1 rtl:space-x-reverse' onClick={handleModalClick}>
|
||||||
</a>
|
<SvgIcon src={qrcodeIcon} size={20} />
|
||||||
|
</button>
|
||||||
|
</Link>
|
||||||
|
|
||||||
{explorerUrl && (
|
{explorerUrl && (
|
||||||
<a className='ml-1 text-gray-500 rtl:ml-0 rtl:mr-1' href={explorerUrl} target='_blank'>
|
<a className='ml-1 text-gray-500 rtl:ml-0 rtl:mr-1' href={explorerUrl} target='_blank'>
|
||||||
<Icon src={externalLinkIcon} size={20} />
|
<SvgIcon src={externalLinkIcon} size={20} />
|
||||||
</a>
|
</a>
|
||||||
)}
|
)}
|
||||||
</HStack>
|
</HStack>
|
||||||
|
|
|
@ -35,7 +35,6 @@ import { deleteStatusModal, toggleStatusSensitivityModal } from 'soapbox/actions
|
||||||
import { initMuteModal } from 'soapbox/actions/mutes.ts';
|
import { initMuteModal } from 'soapbox/actions/mutes.ts';
|
||||||
import { initReport, ReportableEntities } from 'soapbox/actions/reports.ts';
|
import { initReport, ReportableEntities } from 'soapbox/actions/reports.ts';
|
||||||
import { deleteStatus } from 'soapbox/actions/statuses.ts';
|
import { deleteStatus } from 'soapbox/actions/statuses.ts';
|
||||||
import Icon from 'soapbox/components/icon.tsx';
|
|
||||||
import StillImage from 'soapbox/components/still-image.tsx';
|
import StillImage from 'soapbox/components/still-image.tsx';
|
||||||
import Button from 'soapbox/components/ui/button.tsx';
|
import Button from 'soapbox/components/ui/button.tsx';
|
||||||
import HStack from 'soapbox/components/ui/hstack.tsx';
|
import HStack from 'soapbox/components/ui/hstack.tsx';
|
||||||
|
@ -451,7 +450,7 @@ const EventHeader: React.FC<IEventHeader> = ({ status }) => {
|
||||||
|
|
||||||
<Stack space={1}>
|
<Stack space={1}>
|
||||||
<HStack alignItems='center' space={2}>
|
<HStack alignItems='center' space={2}>
|
||||||
<Icon src={flag3Icon} />
|
<SvgIcon src={flag3Icon} />
|
||||||
<span>
|
<span>
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
id='event.organized_by'
|
id='event.organized_by'
|
||||||
|
@ -471,8 +470,9 @@ const EventHeader: React.FC<IEventHeader> = ({ status }) => {
|
||||||
</HStack>
|
</HStack>
|
||||||
|
|
||||||
<HStack alignItems='center' space={2}>
|
<HStack alignItems='center' space={2}>
|
||||||
<Icon src={usersIcon} />
|
<SvgIcon src={usersIcon} />
|
||||||
<a href='#' className='hover:underline' onClick={handleParticipantsClick}>
|
<Link to={'/'} className='inline-flex'>
|
||||||
|
<button className='space-x-2 !border-none !p-0 !text-primary-600 hover:!underline focus:!ring-transparent focus:!ring-offset-0 dark:!text-accent-blue rtl:space-x-reverse' onClick={handleParticipantsClick}>
|
||||||
<span>
|
<span>
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
id='event.participants'
|
id='event.participants'
|
||||||
|
@ -483,14 +483,15 @@ const EventHeader: React.FC<IEventHeader> = ({ status }) => {
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</button>
|
||||||
|
</Link>
|
||||||
</HStack>
|
</HStack>
|
||||||
|
|
||||||
<EventDate status={status} />
|
<EventDate status={status} />
|
||||||
|
|
||||||
{event.location && (
|
{event.location && (
|
||||||
<HStack alignItems='center' space={2}>
|
<HStack alignItems='center' space={2}>
|
||||||
<Icon src={mapPinIcon} />
|
<SvgIcon src={mapPinIcon} />
|
||||||
<span>
|
<span>
|
||||||
{event.location.get('name')}
|
{event.location.get('name')}
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -3,6 +3,7 @@ import linkIcon from '@tabler/icons/outline/link.svg';
|
||||||
import mapPinIcon from '@tabler/icons/outline/map-pin.svg';
|
import mapPinIcon from '@tabler/icons/outline/map-pin.svg';
|
||||||
import { Fragment, useCallback, useEffect, useState } from 'react';
|
import { Fragment, useCallback, useEffect, useState } from 'react';
|
||||||
import { FormattedDate, FormattedMessage } from 'react-intl';
|
import { FormattedDate, FormattedMessage } from 'react-intl';
|
||||||
|
import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
import { openModal } from 'soapbox/actions/modals.ts';
|
import { openModal } from 'soapbox/actions/modals.ts';
|
||||||
import { fetchStatus } from 'soapbox/actions/statuses.ts';
|
import { fetchStatus } from 'soapbox/actions/statuses.ts';
|
||||||
|
@ -56,7 +57,7 @@ const EventInformation: React.FC<IEventInformation> = ({ params }) => {
|
||||||
setShowMedia(!showMedia);
|
setShowMedia(!showMedia);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleShowMap: React.MouseEventHandler<HTMLAnchorElement> = (e) => {
|
const handleShowMap: React.MouseEventHandler<HTMLButtonElement> = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
dispatch(openModal('EVENT_MAP', {
|
dispatch(openModal('EVENT_MAP', {
|
||||||
|
@ -98,9 +99,11 @@ const EventInformation: React.FC<IEventInformation> = ({ params }) => {
|
||||||
text.push(
|
text.push(
|
||||||
<Fragment key='event-map'>
|
<Fragment key='event-map'>
|
||||||
<br />
|
<br />
|
||||||
<a href='#' className='text-primary-600 hover:underline dark:text-accent-blue' onClick={handleShowMap}>
|
<Link to={'/'} className='inline-flex'>
|
||||||
|
<button className='space-x-2 !border-none !p-0 !text-primary-600 hover:!underline focus:!ring-transparent focus:ring-offset-0 dark:!text-accent-blue rtl:space-x-reverse' onClick={handleShowMap}>
|
||||||
<FormattedMessage id='event.show_on_map' defaultMessage='Show on map' />
|
<FormattedMessage id='event.show_on_map' defaultMessage='Show on map' />
|
||||||
</a>
|
</button>
|
||||||
|
</Link>
|
||||||
</Fragment>,
|
</Fragment>,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,9 @@ import caretDownIcon from '@tabler/icons/outline/caret-down.svg';
|
||||||
import caretRightIcon from '@tabler/icons/outline/caret-right.svg';
|
import caretRightIcon from '@tabler/icons/outline/caret-right.svg';
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
|
import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
import Icon from 'soapbox/components/icon.tsx';
|
import SvgIcon from 'soapbox/components/ui/svg-icon.tsx';
|
||||||
import { useAppSelector } from 'soapbox/hooks/useAppSelector.ts';
|
import { useAppSelector } from 'soapbox/hooks/useAppSelector.ts';
|
||||||
import { makeGetRemoteInstance } from 'soapbox/selectors/index.ts';
|
import { makeGetRemoteInstance } from 'soapbox/selectors/index.ts';
|
||||||
|
|
||||||
|
@ -20,19 +21,21 @@ const RestrictedInstance: React.FC<IRestrictedInstance> = ({ host }) => {
|
||||||
|
|
||||||
const [expanded, setExpanded] = useState(false);
|
const [expanded, setExpanded] = useState(false);
|
||||||
|
|
||||||
const toggleExpanded: React.MouseEventHandler<HTMLAnchorElement> = e => {
|
const toggleExpanded: React.MouseEventHandler<HTMLButtonElement> = e => {
|
||||||
setExpanded((value) => !value);
|
setExpanded((value) => !value);
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<a href='#' className='flex items-center gap-1 py-2.5 no-underline' onClick={toggleExpanded}>
|
<Link to={'/'} className='inline-flex'>
|
||||||
<Icon src={expanded ? caretDownIcon : caretRightIcon} />
|
<button className='flex items-center gap-1 space-x-2 !border-none !px-0 !py-2.5 !text-primary-600 no-underline focus:!ring-transparent focus:!ring-offset-0 dark:!text-accent-blue rtl:space-x-reverse' onClick={toggleExpanded}>
|
||||||
|
<SvgIcon src={expanded ? caretDownIcon : caretRightIcon} />
|
||||||
<div className={clsx({ 'line-through': remoteInstance.federation.reject })}>
|
<div className={clsx({ 'line-through': remoteInstance.federation.reject })}>
|
||||||
{remoteInstance.host}
|
{remoteInstance.host}
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</button>
|
||||||
|
</Link>
|
||||||
<div
|
<div
|
||||||
className={clsx({
|
className={clsx({
|
||||||
'h-0 overflow-hidden': !expanded,
|
'h-0 overflow-hidden': !expanded,
|
||||||
|
|
Loading…
Reference in New Issue