Merge branch 'develop' of https://codeberg.org/mkljczk/pl-fe into develop
This commit is contained in:
@@ -5267,7 +5267,7 @@ class PlApiClient {
|
||||
public readonly events = {
|
||||
/**
|
||||
* Creates an event
|
||||
* @see {@link https://github.com/mkljczk/pl/blob/fork/docs/development/API/pleroma_api.md#apiv1pleromaevents}
|
||||
* @see {@link https://codeberg.org/mkljczk/nicolex/src/branch/develop/docs/development/API/pleroma_api.md#api-v1-pleroma-events}
|
||||
*/
|
||||
createEvent: async (params: CreateEventParams) => {
|
||||
const response = await this.request('/api/v1/pleroma/events', { method: 'POST', body: params });
|
||||
@@ -5277,7 +5277,7 @@ class PlApiClient {
|
||||
|
||||
/**
|
||||
* Edits an event
|
||||
* @see {@link https://github.com/mkljczk/pl/blob/fork/docs/development/API/pleroma_api.md#apiv1pleromaeventsid}
|
||||
* @see {@link https://codeberg.org/mkljczk/nicolex/src/branch/develop/docs/development/API/pleroma_api.md#api-v1-pleroma-events-id}
|
||||
*/
|
||||
editEvent: async (statusId: string, params: EditEventParams) => {
|
||||
const response = await this.request(`/api/v1/pleroma/events/${statusId}`, { method: 'PUT', body: params });
|
||||
@@ -5287,21 +5287,21 @@ class PlApiClient {
|
||||
|
||||
/**
|
||||
* Gets user's joined events
|
||||
* @see {@link https://github.com/mkljczk/pl/blob/fork/docs/development/API/pleroma_api.md#apiv1pleromaeventsjoined_events}
|
||||
* @see {@link https://codeberg.org/mkljczk/nicolex/src/branch/develop/docs/development/API/pleroma_api.md#api-v1-pleroma-events-joined_events}
|
||||
*/
|
||||
getJoinedEvents: async (state?: 'pending' | 'reject' | 'accept', params?: GetJoinedEventsParams) =>
|
||||
this.#paginatedGet('/api/v1/pleroma/events/joined_events', { params: { ...params, state } }, statusSchema),
|
||||
|
||||
/**
|
||||
* Gets event participants
|
||||
* @see {@link https://github.com/mkljczk/pl/blob/fork/docs/development/API/pleroma_api.md#apiv1pleromaeventsidparticipations}
|
||||
* @see {@link https://codeberg.org/mkljczk/nicolex/src/branch/develop/docs/development/API/pleroma_api.md#api-v1-pleroma-events-id-participations}
|
||||
*/
|
||||
getEventParticipations: async (statusId: string, params?: GetEventParticipationsParams) =>
|
||||
this.#paginatedGet(`/api/v1/pleroma/events/${statusId}/participations`, { params }, accountSchema),
|
||||
|
||||
/**
|
||||
* Gets event participation requests
|
||||
* @see {@link https://github.com/mkljczk/pl/blob/fork/docs/development/API/pleroma_api.md#apiv1pleromaeventsidparticipation_requests}
|
||||
* @see {@link https://codeberg.org/mkljczk/nicolex/src/branch/develop/docs/development/API/pleroma_api.md#api-v1-pleroma-events-id-participation_requests}
|
||||
*/
|
||||
getEventParticipationRequests: async (statusId: string, params?: GetEventParticipationRequestsParams) =>
|
||||
this.#paginatedGet(`/api/v1/pleroma/events/${statusId}/participation_requests`, { params }, v.object({
|
||||
@@ -5311,7 +5311,7 @@ class PlApiClient {
|
||||
|
||||
/**
|
||||
* Accepts user to the event
|
||||
* @see {@link https://github.com/mkljczk/pl/blob/fork/docs/development/API/pleroma_api.md#apiv1pleromaeventsidparticipation_requestsparticipant_idauthorize}
|
||||
* @see {@link https://codeberg.org/mkljczk/nicolex/src/branch/develop/docs/development/API/pleroma_api.md#api-v1-pleroma-events-id-participation_requests-participant_id-authorize}
|
||||
*/
|
||||
acceptEventParticipationRequest: async (statusId: string, accountId: string) => {
|
||||
const response = await this.request(`/api/v1/pleroma/events/${statusId}/participation_requests/${accountId}/authorize`, { method: 'POST' });
|
||||
@@ -5321,7 +5321,7 @@ class PlApiClient {
|
||||
|
||||
/**
|
||||
* Rejects user from the event
|
||||
* @see {@link https://github.com/mkljczk/pl/blob/fork/docs/development/API/pleroma_api.md#rejects-user-from-the-event}
|
||||
* @see {@link https://codeberg.org/mkljczk/nicolex/src/branch/develop/docs/development/API/pleroma_api.md#api-v1-pleroma-events-id-participation_requests-participant_id-reject}
|
||||
*/
|
||||
rejectEventParticipationRequest: async (statusId: string, accountId: string) => {
|
||||
const response = await this.request(`/api/v1/pleroma/events/${statusId}/participation_requests/${accountId}/reject`, { method: 'POST' });
|
||||
@@ -5331,7 +5331,7 @@ class PlApiClient {
|
||||
|
||||
/**
|
||||
* Joins the event
|
||||
* @see {@link https://github.com/mkljczk/pl/blob/fork/docs/development/API/pleroma_api.md#joins-the-event}
|
||||
* @see {@link https://codeberg.org/mkljczk/nicolex/src/branch/develop/docs/development/API/pleroma_api.md#api-v1-pleroma-events-id-join}
|
||||
*/
|
||||
joinEvent: async (statusId: string, participation_message?: string) => {
|
||||
const response = await this.request(`/api/v1/pleroma/events/${statusId}/join`, { method: 'POST', body: { participation_message } });
|
||||
@@ -5341,7 +5341,7 @@ class PlApiClient {
|
||||
|
||||
/**
|
||||
* Leaves the event
|
||||
* @see {@link https://github.com/mkljczk/pl/blob/fork/docs/development/API/pleroma_api.md#leaves-the-event}
|
||||
* @see {@link https://codeberg.org/mkljczk/nicolex/src/branch/develop/docs/development/API/pleroma_api.md#api-v1-pleroma-events-id-leave}
|
||||
*/
|
||||
leaveEvent: async (statusId: string) => {
|
||||
const response = await this.request(`/api/v1/pleroma/events/${statusId}/leave`, { method: 'POST' });
|
||||
@@ -5351,7 +5351,7 @@ class PlApiClient {
|
||||
|
||||
/**
|
||||
* Event ICS file
|
||||
* @see {@link https://github.com/mkljczk/pl/blob/fork/docs/development/API/pleroma_api.md#event-ics-file}
|
||||
* @see {@link https://codeberg.org/mkljczk/nicolex/src/branch/develop/docs/development/API/pleroma_api.md#event-ics-file}
|
||||
*/
|
||||
getEventIcs: async (statusId: string) => {
|
||||
const response = await this.request(`/api/v1/pleroma/events/${statusId}/ics`, { contentType: '' });
|
||||
|
||||
@@ -3,16 +3,13 @@ import clsx from 'clsx';
|
||||
import React, { MouseEventHandler } from 'react';
|
||||
import { defineMessages, useIntl } from 'react-intl';
|
||||
|
||||
import StatusMedia from 'pl-fe/components/status-media';
|
||||
import Stack from 'pl-fe/components/ui/stack';
|
||||
import AccountContainer from 'pl-fe/containers/account-container';
|
||||
|
||||
import EventPreview from './event-preview';
|
||||
import OutlineBox from './outline-box';
|
||||
import QuotedStatusIndicator from './quoted-status-indicator';
|
||||
import StatusContent from './status-content';
|
||||
import StatusReplyMentions from './status-reply-mentions';
|
||||
import SensitiveContentOverlay from './statuses/sensitive-content-overlay';
|
||||
|
||||
import type { SelectedStatus } from 'pl-fe/selectors';
|
||||
|
||||
@@ -108,16 +105,9 @@ const QuotedStatus: React.FC<IQuotedStatus> = ({ status, onCancel, compose }) =>
|
||||
status={status}
|
||||
collapsable
|
||||
isQuote
|
||||
withMedia
|
||||
compose={compose}
|
||||
/>
|
||||
|
||||
{status.quote_id && <QuotedStatusIndicator statusId={status.quote_id} statusUrl={status.quote_url} />}
|
||||
|
||||
{status.media_attachments.length > 0 && (
|
||||
<div className='relative'>
|
||||
<SensitiveContentOverlay status={status} />
|
||||
<StatusMedia status={status} muted={compose} />
|
||||
</div>
|
||||
)}
|
||||
</Stack>
|
||||
</Stack>
|
||||
)}
|
||||
|
||||
@@ -23,6 +23,7 @@ import OutlineBox from './outline-box';
|
||||
import { parseContent } from './parsed-content';
|
||||
import { ParsedMfm } from './parsed-mfm';
|
||||
import Poll from './polls/poll';
|
||||
import QuotedStatusIndicator from './quoted-status-indicator';
|
||||
import StatusMedia from './status-media';
|
||||
import SensitiveContentOverlay from './statuses/sensitive-content-overlay';
|
||||
import TranslateButton from './translate-button';
|
||||
@@ -72,6 +73,7 @@ interface IStatusContent {
|
||||
isQuote?: boolean;
|
||||
preview?: boolean;
|
||||
withMedia?: boolean;
|
||||
compose?: boolean;
|
||||
}
|
||||
|
||||
/** Renders the text content of a status */
|
||||
@@ -84,6 +86,7 @@ const StatusContent: React.FC<IStatusContent> = React.memo(({
|
||||
isQuote = false,
|
||||
preview,
|
||||
withMedia,
|
||||
compose = false,
|
||||
}) => {
|
||||
const { urlPrivacy, displaySpoilers, renderMfm } = useSettings();
|
||||
const { greentext } = usePlFeConfig();
|
||||
@@ -234,7 +237,11 @@ const StatusContent: React.FC<IStatusContent> = React.memo(({
|
||||
let quote;
|
||||
|
||||
if (withMedia && status.quote_id) {
|
||||
if ((status.quote_visible ?? true) === false) {
|
||||
if (isQuote) {
|
||||
quote = (
|
||||
<QuotedStatusIndicator statusId={status.quote_id} statusUrl={status.quote_url} />
|
||||
);
|
||||
} else if ((status.quote_visible ?? true) === false) {
|
||||
quote = (
|
||||
<OutlineBox>
|
||||
<p><FormattedMessage id='statuses.quote_tombstone' defaultMessage='Post is unavailable.' /></p>
|
||||
@@ -250,7 +257,7 @@ const StatusContent: React.FC<IStatusContent> = React.memo(({
|
||||
{((withMedia && status.media_attachments.length > 0) || (status.card && !quote)) && (
|
||||
<div className='relative has-[div[data-testid="sensitive-overlay"]]:min-h-24'>
|
||||
<SensitiveContentOverlay status={status} />
|
||||
{withMedia && <StatusMedia status={status} />}
|
||||
{withMedia && <StatusMedia status={status} muted={compose} />}
|
||||
</div>
|
||||
)}
|
||||
|
||||
|
||||
@@ -159,6 +159,9 @@ const Upload: React.FC<IUpload> = ({
|
||||
/>
|
||||
);
|
||||
|
||||
const backgroundImage = (mediaType === 'image' || ['.png', '.jpg', '.jpeg'].some(ext => media.preview_url.endsWith(ext))) ? `url(${media.preview_url})` : undefined;
|
||||
const hasBackgroundImage = !!(backgroundImage);
|
||||
|
||||
return (
|
||||
<div
|
||||
className='relative m-[5px] min-w-[40%] flex-1 overflow-hidden rounded'
|
||||
@@ -174,7 +177,7 @@ const Upload: React.FC<IUpload> = ({
|
||||
className={clsx('compose-form__upload-thumbnail relative h-40 w-full overflow-hidden bg-contain bg-center bg-no-repeat', mediaType)}
|
||||
style={{
|
||||
scale: styles.scale,
|
||||
backgroundImage: mediaType === 'image' ? `url(${media.preview_url})` : undefined,
|
||||
backgroundImage,
|
||||
backgroundPosition: typeof x === 'number' && typeof y === 'number' ? `${x}% ${y}%` : undefined,
|
||||
}}
|
||||
>
|
||||
@@ -226,7 +229,7 @@ const Upload: React.FC<IUpload> = ({
|
||||
)}
|
||||
</HStack>
|
||||
|
||||
<div className='absolute inset-0 z-[-1] size-full'>
|
||||
<div className={clsx('absolute inset-0 size-full', { 'z-[-1]': hasBackgroundImage })}>
|
||||
{mediaType === 'video' && (
|
||||
<video className='size-full object-cover' autoPlay playsInline muted loop>
|
||||
<source src={media.preview_url} />
|
||||
|
||||
@@ -344,7 +344,7 @@ const MediaModal: React.FC<MediaModalProps & BaseModalProps> = (props) => {
|
||||
className='relative h-[calc(100vh-120px)] w-full grow'
|
||||
>
|
||||
{hasMultipleImages && (
|
||||
<div className={clsx('absolute inset-y-0 left-5 z-10 flex items-center transition-opacity', navigationHiddenClassName)}>
|
||||
<div className={clsx('absolute left-5 top-[calc(50%-0.625rem)] z-10 flex h-fit items-center transition-opacity', navigationHiddenClassName)}>
|
||||
<button
|
||||
tabIndex={0}
|
||||
className='flex size-10 items-center justify-center rounded-full bg-gray-900 text-white'
|
||||
@@ -375,7 +375,7 @@ const MediaModal: React.FC<MediaModalProps & BaseModalProps> = (props) => {
|
||||
</div>
|
||||
|
||||
{hasMultipleImages && (
|
||||
<div className={clsx('absolute inset-y-0 right-5 z-10 flex items-center transition-opacity', navigationHiddenClassName)}>
|
||||
<div className={clsx('absolute right-5 top-[calc(50%-0.625rem)] z-10 flex h-fit items-center transition-opacity', navigationHiddenClassName)}>
|
||||
<button
|
||||
tabIndex={0}
|
||||
className='flex size-10 items-center justify-center rounded-full bg-gray-900 text-white'
|
||||
|
||||
Reference in New Issue
Block a user