mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(post options): link sage warning to FAQ
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import { Fragment } from 'react';
|
||||
import { HashLink } from 'react-router-hash-link';
|
||||
import { Link } from 'react-router-dom';
|
||||
import type { DirectoryCommunity } from '../../hooks/use-directories';
|
||||
import type { PostOptionsValidationError } from '../../lib/utils/post-options-utils';
|
||||
import { SAGE_FAQ_LINK_LABEL, SAGE_FAQ_PATH, SAGE_OPTION, type PostOptionsValidationError } from '../../lib/utils/post-options-utils';
|
||||
|
||||
interface PostOptionsErrorMessageProps {
|
||||
directories?: DirectoryCommunity[];
|
||||
@@ -33,10 +34,33 @@ const DirectoryLinks = ({ codes, directories }: { codes: string[]; directories:
|
||||
</>
|
||||
);
|
||||
|
||||
const UnsupportedOption = ({ option }: { option: string }) => (
|
||||
<>
|
||||
{option}
|
||||
{option === SAGE_OPTION && (
|
||||
<>
|
||||
{' '}
|
||||
[<HashLink to={SAGE_FAQ_PATH}>{SAGE_FAQ_LINK_LABEL}</HashLink>]
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
|
||||
const UnsupportedOptions = ({ options }: { options: string[] }) => (
|
||||
<>
|
||||
{options.map((option, index) => (
|
||||
<Fragment key={`${option}-${index}`}>
|
||||
{index === 0 ? '' : ', '}
|
||||
<UnsupportedOption option={option} />
|
||||
</Fragment>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
|
||||
const PostOptionsErrorMessage = ({ directories = EMPTY_DIRECTORIES, error }: PostOptionsErrorMessageProps) => {
|
||||
return (
|
||||
<>
|
||||
Unsupported options: {error.unsupportedOptions.join(', ')}.
|
||||
Unsupported options: <UnsupportedOptions options={error.unsupportedOptions} />.
|
||||
{error.supportedDirectoryCodesByOption.map(({ option, directoryCodes }) => (
|
||||
<Fragment key={option}>
|
||||
{' '}
|
||||
|
||||
Reference in New Issue
Block a user