Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak 2024-08-23 15:00:00 +02:00
parent 6f1c11b39f
commit ff338a06bf
11 changed files with 30 additions and 38 deletions

View file

@ -132,7 +132,7 @@
"multiselect-react-dropdown": "^2.0.25",
"object-to-formdata": "^4.5.1",
"path-browserify": "^1.0.1",
"pl-api": "^0.0.13",
"pl-api": "^0.0.14",
"postcss": "^8.4.29",
"process": "^0.11.10",
"punycode": "^2.1.1",

View file

@ -47,11 +47,11 @@ const AccountGallery = () => {
const handleScrollToBottom = () => {
if (hasMore) {
handleLoadMore(attachments.size > 0 ? attachments.last()!.status.id : null);
handleLoadMore();
}
};
const handleLoadMore = (maxId: string | null) => {
const handleLoadMore = () => {
if (account) {
dispatch(fetchAccountTimeline(account.id, { only_media: true }, true));
}

View file

@ -59,7 +59,7 @@ const AccountTimeline: React.FC<IAccountTimeline> = ({ params, withReplies = fal
}
}, [account?.id, withReplies]);
const handleLoadMore = (maxId: string) => {
const handleLoadMore = () => {
if (account) {
dispatch(fetchAccountTimeline(account.id, { exclude_replies: !withReplies }, true));
}

View file

@ -40,14 +40,10 @@ const HashtagTimeline: React.FC<IHashtagTimeline> = ({ params }) => {
useHashtagStream(tagId);
useEffect(() => {
dispatch(fetchHashtagTimeline(tagId));
dispatch(fetchHashtag(tagId));
}, [tagId]);
useEffect(() => {
dispatch(clearTimeline(`hashtag:${tagId}`));
dispatch(fetchHashtagTimeline(tagId, {}, true));
dispatch(fetchHashtag(tagId));
dispatch(fetchHashtagTimeline(tagId));
}, [tagId]);
return (

View file

@ -15,13 +15,12 @@ import QuotedStatus from 'soapbox/features/status/containers/quoted-status-conta
import StatusInteractionBar from './status-interaction-bar';
import type { Status as StatusEntity } from 'soapbox/normalizers';
import type { SelectedStatus } from 'soapbox/selectors';
interface IDetailedStatus {
status: SelectedStatus;
withMedia?: boolean;
onOpenCompareHistoryModal: (status: Pick<StatusEntity, 'id'>) => void;
onOpenCompareHistoryModal: (status: Pick<SelectedStatus, 'id'>) => void;
}
const DetailedStatus: React.FC<IDetailedStatus> = ({

View file

@ -81,14 +81,12 @@ interface IThread {
itemClassName?: string;
}
const Thread = (props: IThread) => {
const {
itemClassName,
status,
useWindowScroll = true,
withMedia = true,
} = props;
const Thread: React.FC<IThread> = ({
itemClassName,
status,
useWindowScroll = true,
withMedia = true,
}) => {
const dispatch = useAppDispatch();
const history = useHistory();
const intl = useIntl();

View file

@ -28,7 +28,7 @@ const BoostModal: React.FC<BaseModalProps & BoostModalProps> = ({ statusId, onRe
const handleReblog = () => {
onReblog(status);
onClose();
onClose('BOOST');
};
const buttonText = status.reblogged ? messages.cancel_reblog : messages.reblog;

View file

@ -57,7 +57,7 @@ const EditFederationModal: React.FC<BaseModalProps & EditFederationModalProps> =
.then(() => toast.success(intl.formatMessage(messages.success, { host })))
.catch(() => {});
onClose();
onClose('EDIT_FEDERATION');
};
const {

View file

@ -63,7 +63,7 @@ const MediaModal: React.FC<MediaModalProps & BaseModalProps> = (props) => {
const intl = useIntl();
const getStatus = useCallback(makeGetStatus(), []);
const status = useAppSelector((state) => getStatus(state, { id: statusId as string }));
const status = useAppSelector((state) => statusId ? getStatus(state, { id: statusId }) : undefined);
const [isLoaded, setIsLoaded] = useState<boolean>(!!status);
const [index, setIndex] = useState<number | null>(null);
@ -185,16 +185,15 @@ const MediaModal: React.FC<MediaModalProps & BaseModalProps> = (props) => {
return null;
});
/** Fetch the status (and context) from the API. */
const fetchData = () => dispatch(fetchStatusWithContext(status?.id as string, intl));
// Load data.
useEffect(() => {
fetchData().then(() => {
setIsLoaded(true);
}).catch(() => {
setIsLoaded(true);
});
if (status?.id) {
dispatch(fetchStatusWithContext(status.id, intl)).then(() => {
setIsLoaded(true);
}).catch(() => {
setIsLoaded(true);
});
}
}, [status?.id]);
useEffect(() => {
@ -245,7 +244,7 @@ const MediaModal: React.FC<MediaModalProps & BaseModalProps> = (props) => {
<IconButton
title={intl.formatMessage(messages.close)}
src={require('@tabler/icons/outline/x.svg')}
onClick={() => onClose()}
onClick={() => onClose('MEDIA')}
theme='dark'
className='!p-1.5 hover:scale-105 hover:bg-gray-900'
iconClassName='h-5 w-5'

View file

@ -126,7 +126,7 @@ const ReportModal = ({ onClose }: BaseModalProps) => {
const cancelAction = () => {
switch (currentStep) {
case Steps.ONE:
onClose();
onClose('REPORT');
break;
case Steps.TWO:
setCurrentStep(Steps.ONE);
@ -159,7 +159,7 @@ const ReportModal = ({ onClose }: BaseModalProps) => {
break;
case Steps.THREE:
dispatch(submitReportSuccess());
onClose();
onClose('REPORT');
break;
default:
break;

View file

@ -8385,10 +8385,10 @@ pkg-types@^1.0.3:
mlly "^1.2.0"
pathe "^1.1.0"
pl-api@^0.0.13:
version "0.0.13"
resolved "https://registry.yarnpkg.com/pl-api/-/pl-api-0.0.13.tgz#e13eb2a47ee4854cc6aa641bbefa6285f7b8d5fd"
integrity sha512-cyxMaK+IPUTQzMhODx9LZ+P/sMfLb6xu44RyZj7baJX/LSJj/YSMPqhV6xLQfjWm65HyPNOIDnz5hD6dA0v8/w==
pl-api@^0.0.14:
version "0.0.14"
resolved "https://registry.yarnpkg.com/pl-api/-/pl-api-0.0.14.tgz#71466b336482dc04739150b88b912bffa648d984"
integrity sha512-dRztsnvQDWlz3P3Rtpgi1fbMbt3SUJOwC2Pn+BnoZIc5lV84KbXQ0/LI5kfGFHATJkH3iTPtqSjVBnIxCYtTVw==
dependencies:
blurhash "^2.0.5"
http-link-header "^1.1.3"