nicolium: more moves
Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
This commit is contained in:
@ -1,25 +0,0 @@
|
||||
import { getClient } from '@/api';
|
||||
import { queryClient } from '@/queries/client';
|
||||
import { queryKeys } from '@/queries/keys';
|
||||
import { useComposeStore } from '@/stores/compose';
|
||||
import { useModalsStore } from '@/stores/modals';
|
||||
|
||||
const redactStatus = (statusId: string) => {
|
||||
const status = queryClient.getQueryData(queryKeys.statuses.show(statusId));
|
||||
if (!status) return;
|
||||
|
||||
const poll = status.poll_id
|
||||
? queryClient.getQueryData(queryKeys.statuses.polls.show(status.poll_id))
|
||||
: undefined;
|
||||
|
||||
return getClient()
|
||||
.statuses.getStatusSource(statusId)
|
||||
.then((source) => {
|
||||
useComposeStore
|
||||
.getState()
|
||||
.actions.setComposeToStatus(status, poll, source, false, null, null, true);
|
||||
useModalsStore.getState().actions.openModal('COMPOSE');
|
||||
});
|
||||
};
|
||||
|
||||
export { redactStatus };
|
||||
@ -1,22 +0,0 @@
|
||||
import { changeSetting } from '@/actions/settings';
|
||||
import { useSettingsStore } from '@/stores/settings';
|
||||
|
||||
const getPinnedHosts = () => {
|
||||
const { settings } = useSettingsStore.getState();
|
||||
return settings.remote_timeline.pinnedHosts;
|
||||
};
|
||||
|
||||
const pinHost = (host: string) => {
|
||||
const pinnedHosts = getPinnedHosts();
|
||||
changeSetting(['remote_timeline', 'pinnedHosts'], [...pinnedHosts, host]);
|
||||
};
|
||||
|
||||
const unpinHost = (host: string) => {
|
||||
const pinnedHosts = getPinnedHosts();
|
||||
changeSetting(
|
||||
['remote_timeline', 'pinnedHosts'],
|
||||
pinnedHosts.filter((value) => value !== host),
|
||||
);
|
||||
};
|
||||
|
||||
export { pinHost, unpinHost };
|
||||
@ -170,6 +170,24 @@ const editStatus = (statusId: string) => {
|
||||
});
|
||||
};
|
||||
|
||||
const redactStatus = (statusId: string) => {
|
||||
const status = queryClient.getQueryData(queryKeys.statuses.show(statusId));
|
||||
if (!status) return;
|
||||
|
||||
const poll = status.poll_id
|
||||
? queryClient.getQueryData(queryKeys.statuses.polls.show(status.poll_id))
|
||||
: undefined;
|
||||
|
||||
return getClient()
|
||||
.statuses.getStatusSource(statusId)
|
||||
.then((source) => {
|
||||
useComposeStore
|
||||
.getState()
|
||||
.actions.setComposeToStatus(status, poll, source, false, null, null, true);
|
||||
useModalsStore.getState().actions.openModal('COMPOSE');
|
||||
});
|
||||
};
|
||||
|
||||
const fetchStatus = (statusId: string, intl?: IntlShape) => {
|
||||
const params =
|
||||
intl && useSettingsStore.getState().settings.autoTranslate
|
||||
@ -224,6 +242,7 @@ const toggleMuteStatus = (status: Pick<Status, 'id' | 'muted'>) =>
|
||||
export {
|
||||
createStatus,
|
||||
editStatus,
|
||||
redactStatus,
|
||||
fetchStatus,
|
||||
toggleMuteStatus,
|
||||
decrementReplyCount,
|
||||
|
||||
@ -3,9 +3,8 @@ import { type Account, type CustomEmoji, GroupRoles } from 'pl-api';
|
||||
import React, { useCallback, useMemo } from 'react';
|
||||
import { defineMessages, useIntl } from 'react-intl';
|
||||
|
||||
import { redactStatus } from '@/actions/admin';
|
||||
import { changeSetting } from '@/actions/settings';
|
||||
import { editStatus, toggleMuteStatus } from '@/actions/statuses';
|
||||
import { editStatus, toggleMuteStatus, redactStatus } from '@/actions/statuses';
|
||||
import DropdownMenu from '@/components/dropdown-menu';
|
||||
import StatusActionButton from '@/components/statuses/status-action-button';
|
||||
import { useCurrentAccount } from '@/contexts/current-account-context';
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import { useIntl, defineMessages } from 'react-intl';
|
||||
|
||||
import { pinHost, unpinHost } from '@/actions/remote-timeline';
|
||||
import { changeSetting } from '@/actions/settings';
|
||||
import Widget from '@/components/ui/widget';
|
||||
import { useRemoteInstance } from '@/queries/instance/use-remote-instance';
|
||||
import { useSettings } from '@/stores/settings';
|
||||
@ -22,10 +22,22 @@ const InstanceInfoPanel: React.FC<IInstanceInfoPanel> = ({ host }) => {
|
||||
|
||||
const settings = useSettings();
|
||||
const remoteInstance = useRemoteInstance(host);
|
||||
const pinned = settings.remote_timeline.pinnedHosts.includes(host);
|
||||
const pinnedHosts = settings.remote_timeline.pinnedHosts;
|
||||
const isPinned = pinnedHosts.includes(host);
|
||||
|
||||
const pinHost = (host: string) => {
|
||||
changeSetting(['remote_timeline', 'pinnedHosts'], [...pinnedHosts, host]);
|
||||
};
|
||||
|
||||
const unpinHost = (host: string) => {
|
||||
changeSetting(
|
||||
['remote_timeline', 'pinnedHosts'],
|
||||
pinnedHosts.filter((value) => value !== host),
|
||||
);
|
||||
};
|
||||
|
||||
const handlePinHost = () => {
|
||||
if (!pinned) {
|
||||
if (!isPinned) {
|
||||
pinHost(host);
|
||||
} else {
|
||||
unpinHost(host);
|
||||
@ -39,11 +51,11 @@ const InstanceInfoPanel: React.FC<IInstanceInfoPanel> = ({ host }) => {
|
||||
title={remoteInstance.host}
|
||||
onActionClick={handlePinHost}
|
||||
actionIcon={
|
||||
pinned
|
||||
isPinned
|
||||
? require('@phosphor-icons/core/regular/push-pin-slash.svg')
|
||||
: require('@phosphor-icons/core/regular/push-pin.svg')
|
||||
}
|
||||
actionTitle={intl.formatMessage(pinned ? messages.unpinHost : messages.pinHost, { host })}
|
||||
actionTitle={intl.formatMessage(isPinned ? messages.unpinHost : messages.pinHost, { host })}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
@ -4,11 +4,11 @@ import React, { Suspense, useEffect, useRef } from 'react';
|
||||
import { Toaster } from 'react-hot-toast';
|
||||
|
||||
import { register as registerPushNotifications } from '@/actions/push-notifications/registerer';
|
||||
import { useUserStream } from '@/api/hooks/streaming/use-user-stream';
|
||||
import SidebarNavigation from '@/components/navigation/sidebar-navigation';
|
||||
import ThumbNavigation from '@/components/navigation/thumb-navigation';
|
||||
import Layout from '@/components/ui/layout';
|
||||
import { useCurrentAccount } from '@/contexts/current-account-context';
|
||||
import { useUserStream } from '@/hooks/streaming/use-user-stream';
|
||||
import { useClient } from '@/hooks/use-client';
|
||||
import { useDraggedFiles } from '@/hooks/use-dragged-files';
|
||||
import { useFeatures } from '@/hooks/use-features';
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
import React from 'react';
|
||||
import { defineMessages, useIntl } from 'react-intl';
|
||||
|
||||
import { useDirectStream } from '@/api/hooks/streaming/use-direct-stream';
|
||||
import Column from '@/components/ui/column';
|
||||
import ConversationsList from '@/features/conversations/components/conversations-list';
|
||||
import { useDirectStream } from '@/hooks/streaming/use-direct-stream';
|
||||
|
||||
const messages = defineMessages({
|
||||
title: { id: 'column.direct', defaultMessage: 'Direct messages' },
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { useCallback, useEffect, useMemo, useRef } from 'react';
|
||||
|
||||
import { useTimelineStream } from '@/api/hooks/streaming/use-timeline-stream';
|
||||
import { useTimelineStream } from '@/hooks/streaming/use-timeline-stream';
|
||||
import { importEntities } from '@/queries/utils/import-entities';
|
||||
import {
|
||||
useTimelinesStore,
|
||||
|
||||
Reference in New Issue
Block a user