Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak 2024-08-24 12:41:08 +02:00
parent e3b4741041
commit fcce5e1c36
18 changed files with 31 additions and 32 deletions

View file

@ -105,9 +105,7 @@ const QuotedStatus: React.FC<IQuotedStatus> = ({ status, onCancel, compose }) =>
{status.quote_id && <QuotedStatusIndicator statusId={status.quote_id} />}
<div className='relative'>
<SensitiveContentOverlay
status={status}
/>
<SensitiveContentOverlay status={status} />
{status.media_attachments.length > 0 && (
<StatusMedia status={status} muted={compose} />
)}

View file

@ -52,7 +52,7 @@ const ScrollTopButton: React.FC<IScrollTopButton> = ({
setScrolled(scrollTop > threshold);
setScrolledTop(scrollTop <= autoloadThreshold);
}, 150, { trailing: true }), [threshold, autoloadThreshold]);
}, 40, { trailing: true }), [threshold, autoloadThreshold]);
/** Scroll to top and trigger `onClick`. */
const handleClick: React.MouseEventHandler = useCallback(() => {
@ -82,7 +82,7 @@ const ScrollTopButton: React.FC<IScrollTopButton> = ({
}
return (
<div className='fixed left-1/2 top-20 z-50 -translate-x-1/2'>
<div className='fixed left-1/2 top-2 z-50 -translate-x-1/2'>
<button
className='flex cursor-pointer items-center space-x-1.5 whitespace-nowrap rounded-full bg-primary-600 px-4 py-2 text-white transition-transform hover:scale-105 hover:bg-primary-700 active:scale-100'
onClick={handleClick}

View file

@ -167,6 +167,10 @@ const StatusContent: React.FC<IStatusContent> = React.memo(({
},
};
const spoilerText = status.spoilerMapHtml && status.currentLanguage
? status.spoilerMapHtml[status.currentLanguage] || status.spoilerHtml
: status.spoilerHtml;
const content = parse(parsedHtml, options);
const direction = getTextDirection(status.search_index);
@ -177,10 +181,6 @@ const StatusContent: React.FC<IStatusContent> = React.memo(({
'leading-normal big-emoji': onlyEmoji,
});
const spoilerText = status.spoilerMapHtml && status.currentLanguage
? status.spoilerMapHtml[status.currentLanguage] || status.spoilerHtml
: status.spoilerHtml;
const expandable = !displaySpoilers;
const expanded = !withSpoiler || status.expanded || false;

View file

@ -265,7 +265,7 @@ const ComposeForm = <ID extends string>({ id, shouldCondense, autoFocus, clickab
<ComposeEditor
key={modifiedLanguage}
ref={editorRef}
className='mt-2'
className='rounded-md border-gray-400 px-3 py-2 ring-2 focus-within:border-primary-500 focus-within:ring-primary-500 dark:border-gray-800 dark:ring-gray-800 dark:focus-within:border-primary-500 dark:focus-within:ring-primary-500'
composeId={id}
condensed={condensed}
eventDiscussion={!!event}
@ -276,9 +276,10 @@ const ComposeForm = <ID extends string>({ id, shouldCondense, autoFocus, clickab
onPaste={onPaste}
/>
</Suspense>
{composeModifiers}
</div>
{composeModifiers}
<QuotedStatusContainer composeId={id} />
<div

View file

@ -7,7 +7,6 @@ import { useAppDispatch, useCompose } from 'soapbox/hooks';
const messages = defineMessages({
placeholder: { id: 'compose_form.spoiler_placeholder', defaultMessage: 'Subject (optional)' },
});
interface ISpoilerInput extends Pick<IAutosuggestInput, 'onSuggestionsFetchRequested' | 'onSuggestionsClearRequested' | 'onSuggestionSelected'> {

View file

@ -184,12 +184,14 @@ const ComposeEditor = React.forwardRef<LexicalEditor, IComposeEditor>(({
contentEditable={
<div onFocus={onFocus} onPaste={handlePaste} ref={onRef}>
<ContentEditable
className={clsx('relative z-10 text-[1rem] outline-none transition-[min-height] motion-reduce:transition-none',
className={clsx(
'relative z-10 text-[1rem] outline-none transition-[min-height] motion-reduce:transition-none',
editableClassName,
{
'min-h-[39px]': condensed,
'min-h-[99px]': !condensed,
})}
},
)}
/>
</div>
}

View file

@ -1,7 +1,7 @@
/**
* This source code is derived from code from Meta Platforms, Inc.
* and affiliates, licensed under the MIT license located in the
* LICENSE file in the /app/soapbox/features/compose/editor directory.
* LICENSE file in the /src/features/compose/editor directory.
*/
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
@ -306,7 +306,7 @@ const ImageComponent = ({
return (
<Suspense fallback={null}>
<>
<div className='relative' draggable={draggable} onMouseEnter={handleMouseEnter} onMouseLeave={handleMouseLeave} onClick={handleClick} role='button'>
<div className='relative' draggable={draggable} onMouseEnter={handleMouseEnter} onMouseLeave={handleMouseLeave} onClick={handleClick} role='button'>
<HStack className='absolute right-2 top-2 z-10' space={2}>
<IconButton
onClick={previewImage}

View file

@ -1,7 +1,7 @@
/**
* This source code is derived from code from Meta Platforms, Inc.
* and affiliates, licensed under the MIT license located in the
* LICENSE file in the /app/soapbox/features/compose/editor directory.
* LICENSE file in the /src/features/compose/editor directory.
*/
import { $applyNodeReplacement, DecoratorNode } from 'lexical';

View file

@ -1,7 +1,7 @@
/**
* This source code is derived from code from Meta Platforms, Inc.
* and affiliates, licensed under the MIT license located in the
* LICENSE file in the /app/soapbox/features/compose/editor directory.
* LICENSE file in the /src/features/compose/editor directory.
*/
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';

View file

@ -1,7 +1,7 @@
/**
* This source code is derived from code from Meta Platforms, Inc.
* and affiliates, licensed under the MIT license located in the
* LICENSE file in the /app/soapbox/features/compose/editor directory.
* LICENSE file in the /src/features/compose/editor directory.
*/
import { $isAutoLinkNode, $isLinkNode, TOGGLE_LINK_COMMAND } from '@lexical/link';

View file

@ -1,7 +1,7 @@
/**
* This source code is derived from code from Meta Platforms, Inc.
* and affiliates, licensed under the MIT license located in the
* LICENSE file in the /app/soapbox/features/compose/editor directory.
* LICENSE file in the /src/features/compose/editor directory.
*/
import { $createCodeNode, $isCodeHighlightNode } from '@lexical/code';

View file

@ -19,8 +19,8 @@ interface IStatePlugin {
}
const StatePlugin: React.FC<IStatePlugin> = ({ composeId, isWysiwyg }) => {
const dispatch = useAppDispatch();
const intl = useIntl();
const dispatch = useAppDispatch();
const [editor] = useLexicalComposerContext();
const features = useFeatures();

View file

@ -29,8 +29,8 @@ interface IEventDiscussion {
}
const EventDiscussion: React.FC<IEventDiscussion> = (props) => {
const dispatch = useAppDispatch();
const intl = useIntl();
const dispatch = useAppDispatch();
const getStatus = useCallback(makeGetStatus(), []);
const status = useAppSelector(state => getStatus(state, { id: props.params.statusId }));

View file

@ -3,7 +3,7 @@ import { FormattedMessage, MessageDescriptor, useIntl } from 'react-intl';
import List, { ListItem } from 'soapbox/components/list';
import { Button, FileInput, Form, FormActions, FormGroup, Text, Toggle } from 'soapbox/components/ui';
import { useAppDispatch, useFeatures } from 'soapbox/hooks';
import { useAppDispatch } from 'soapbox/hooks';
import type { AppDispatch, RootState } from 'soapbox/store';
@ -13,7 +13,7 @@ interface IDataImporter {
input_hint: MessageDescriptor;
submit: MessageDescriptor;
};
action: (list: File | string, overwrite?: boolean) => (dispatch: AppDispatch, getState: () => RootState) => Promise<void>;
action: (list: File, overwrite?: boolean) => (dispatch: AppDispatch, getState: () => RootState) => Promise<void>;
accept?: string;
allowOverwrite?: boolean;
}
@ -21,7 +21,6 @@ interface IDataImporter {
const DataImporter: React.FC<IDataImporter> = ({ messages, action, accept = '.csv,text/csv', allowOverwrite }) => {
const dispatch = useAppDispatch();
const intl = useIntl();
const features = useFeatures();
const [isLoading, setIsLoading] = useState(false);
const [file, setFile] = useState<File | null | undefined>(null);
@ -56,7 +55,7 @@ const DataImporter: React.FC<IDataImporter> = ({ messages, action, accept = '.cs
/>
</FormGroup>
{features.importOverwrite && (
{allowOverwrite && (
<List>
<ListItem
label={<FormattedMessage id='import_data.overwrite' defaultMessage='Overwrite instead of appending' />}

View file

@ -40,8 +40,8 @@ const ImportData = () => {
return (
<Column label={intl.formatMessage(messages.heading)}>
{features.importFollows && <DataImporter action={importFollows} messages={followMessages} allowOverwrite />}
{features.importBlocks && <DataImporter action={importBlocks} messages={blockMessages} allowOverwrite />}
{features.importFollows && <DataImporter action={importFollows} messages={followMessages} allowOverwrite={features.importOverwrite} />}
{features.importBlocks && <DataImporter action={importBlocks} messages={blockMessages} allowOverwrite={features.importOverwrite} />}
{features.importMutes && <DataImporter action={importMutes} messages={muteMessages} />}
</Column>
);

View file

@ -269,7 +269,7 @@ const ComposeEventModal: React.FC<BaseModalProps> = ({ onClose }) => {
onChange={onChangeHasEndTime}
/>
<Text tag='span' theme='muted'>
<FormattedMessage id='compose_event.fields.has_end_time' defaultMessage='The event has end date' />
<FormattedMessage id='compose_event.fields.has_end_time' defaultMessage='The event has an end date' />
</Text>
</HStack>
{endTime && (

View file

@ -12,7 +12,7 @@ import type { Domain } from 'soapbox/schemas';
const messages = defineMessages({
save: { id: 'admin.edit_domain.save', defaultMessage: 'Save' },
domainPlaceholder: { id: 'admin.edit_domain.fields.domain_placeholder', defaultMessage: 'Identity domain name' },
domainPlaceholder: { id: 'admin.edit_domain.fields.domain_placeholder', defaultMessage: 'Domain name' },
domainCreateSuccess: { id: 'admin.edit_domain.created', defaultMessage: 'Domain created' },
domainUpdateSuccess: { id: 'admin.edit_domain.updated', defaultMessage: 'Domain edited' },
});

View file

@ -134,7 +134,7 @@
"admin.edit_domain.created": "Domain created",
"admin.edit_domain.deleted": "Domain deleted",
"admin.edit_domain.fields.domain_label": "Domain",
"admin.edit_domain.fields.domain_placeholder": "Identity domain name",
"admin.edit_domain.fields.domain_placeholder": "Domain name",
"admin.edit_domain.fields.public_hint": "When checked, everyone can sign up for an username with this domain",
"admin.edit_domain.fields.public_label": "Public",
"admin.edit_domain.save": "Save",
@ -437,7 +437,7 @@
"compose_event.fields.description_placeholder": "Description",
"compose_event.fields.end_time_label": "Event end date",
"compose_event.fields.end_time_placeholder": "Event ends on…",
"compose_event.fields.has_end_time": "The event has end date",
"compose_event.fields.has_end_time": "The event has an end date",
"compose_event.fields.location_label": "Event location",
"compose_event.fields.name_label": "Event name",
"compose_event.fields.name_placeholder": "Name",