pl-hooks: Work on making this an actual library
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
a4b520a13a
commit
fb34a8bf4a
59 changed files with 82 additions and 76 deletions
|
@ -1,5 +1,5 @@
|
||||||
import { PLEROMA, type UpdateNotificationSettingsParams, type Account, type CreateAccountParams, type PaginatedResponse, type Relationship } from 'pl-api';
|
import { PLEROMA, type UpdateNotificationSettingsParams, type Account, type CreateAccountParams, type PaginatedResponse, type Relationship } from 'pl-api';
|
||||||
import { importEntities } from 'pl-hooks/importer';
|
import { importEntities } from 'pl-hooks';
|
||||||
|
|
||||||
import { getClient, type PlfeResponse } from 'pl-fe/api';
|
import { getClient, type PlfeResponse } from 'pl-fe/api';
|
||||||
import { Entities } from 'pl-fe/entity-store/entities';
|
import { Entities } from 'pl-fe/entity-store/entities';
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
import { importEntities } from 'pl-hooks/importer';
|
import { importEntities } from 'pl-hooks';
|
||||||
|
|
||||||
import { fetchRelationships } from 'pl-fe/actions/accounts';
|
import { fetchRelationships } from 'pl-fe/actions/accounts';
|
||||||
import { getClient } from 'pl-fe/api';
|
import { getClient } from 'pl-fe/api';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { importEntities } from 'pl-hooks/importer';
|
import { importEntities } from 'pl-hooks';
|
||||||
import { defineMessages } from 'react-intl';
|
import { defineMessages } from 'react-intl';
|
||||||
|
|
||||||
import { getClient } from 'pl-fe/api';
|
import { getClient } from 'pl-fe/api';
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
* @see module:pl-fe/actions/security
|
* @see module:pl-fe/actions/security
|
||||||
*/
|
*/
|
||||||
import { credentialAccountSchema, PlApiClient, type CreateAccountParams, type Token } from 'pl-api';
|
import { credentialAccountSchema, PlApiClient, type CreateAccountParams, type Token } from 'pl-api';
|
||||||
import { importEntities } from 'pl-hooks/importer';
|
import { importEntities } from 'pl-hooks';
|
||||||
import { defineMessages } from 'react-intl';
|
import { defineMessages } from 'react-intl';
|
||||||
import * as v from 'valibot';
|
import * as v from 'valibot';
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { importEntities } from 'pl-hooks/importer';
|
import { importEntities } from 'pl-hooks';
|
||||||
|
|
||||||
import { getClient } from 'pl-fe/api';
|
import { getClient } from 'pl-fe/api';
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import throttle from 'lodash/throttle';
|
import throttle from 'lodash/throttle';
|
||||||
import { importEntities } from 'pl-hooks/importer';
|
import { importEntities } from 'pl-hooks';
|
||||||
import { defineMessages, IntlShape } from 'react-intl';
|
import { defineMessages, IntlShape } from 'react-intl';
|
||||||
|
|
||||||
import { getClient } from 'pl-fe/api';
|
import { getClient } from 'pl-fe/api';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { importEntities } from 'pl-hooks/importer';
|
import { importEntities } from 'pl-hooks';
|
||||||
|
|
||||||
import { getClient } from 'pl-fe/api';
|
import { getClient } from 'pl-fe/api';
|
||||||
import { isLoggedIn } from 'pl-fe/utils/auth';
|
import { isLoggedIn } from 'pl-fe/utils/auth';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { importEntities } from 'pl-hooks/importer';
|
import { importEntities } from 'pl-hooks';
|
||||||
|
|
||||||
import { getClient } from 'pl-fe/api';
|
import { getClient } from 'pl-fe/api';
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { importEntities } from 'pl-hooks/importer';
|
import { importEntities } from 'pl-hooks';
|
||||||
|
|
||||||
import { getClient } from 'pl-fe/api';
|
import { getClient } from 'pl-fe/api';
|
||||||
import { isLoggedIn } from 'pl-fe/utils/auth';
|
import { isLoggedIn } from 'pl-fe/utils/auth';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { importEntities } from 'pl-hooks/importer';
|
import { importEntities } from 'pl-hooks';
|
||||||
import { defineMessages } from 'react-intl';
|
import { defineMessages } from 'react-intl';
|
||||||
|
|
||||||
import { STATUS_FETCH_SOURCE_FAIL, STATUS_FETCH_SOURCE_REQUEST, STATUS_FETCH_SOURCE_SUCCESS } from 'pl-fe/actions/statuses';
|
import { STATUS_FETCH_SOURCE_FAIL, STATUS_FETCH_SOURCE_REQUEST, STATUS_FETCH_SOURCE_SUCCESS } from 'pl-fe/actions/statuses';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { importEntities } from 'pl-hooks/importer';
|
import { importEntities } from 'pl-hooks';
|
||||||
|
|
||||||
import { getClient } from 'pl-fe/api';
|
import { getClient } from 'pl-fe/api';
|
||||||
import { AppDispatch, RootState } from 'pl-fe/store';
|
import { AppDispatch, RootState } from 'pl-fe/store';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { importEntities } from 'pl-hooks/importer';
|
import { importEntities } from 'pl-hooks';
|
||||||
|
|
||||||
import { getClient } from 'pl-fe/api';
|
import { getClient } from 'pl-fe/api';
|
||||||
import { isLoggedIn } from 'pl-fe/utils/auth';
|
import { isLoggedIn } from 'pl-fe/utils/auth';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { importEntities } from 'pl-hooks/importer';
|
import { importEntities } from 'pl-hooks';
|
||||||
|
|
||||||
import { getClient } from 'pl-fe/api';
|
import { getClient } from 'pl-fe/api';
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { importEntities } from 'pl-hooks/importer';
|
import { importEntities } from 'pl-hooks';
|
||||||
|
|
||||||
import { getClient } from 'pl-fe/api';
|
import { getClient } from 'pl-fe/api';
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { importEntities } from 'pl-hooks/importer';
|
import { importEntities } from 'pl-hooks';
|
||||||
import { defineMessages } from 'react-intl';
|
import { defineMessages } from 'react-intl';
|
||||||
|
|
||||||
import { getClient } from 'pl-fe/api';
|
import { getClient } from 'pl-fe/api';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { importEntities } from 'pl-hooks/importer';
|
import { importEntities } from 'pl-hooks';
|
||||||
|
|
||||||
import { getClient } from 'pl-fe/api';
|
import { getClient } from 'pl-fe/api';
|
||||||
import { selectAccount } from 'pl-fe/selectors';
|
import { selectAccount } from 'pl-fe/selectors';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { importEntities } from 'pl-hooks/importer';
|
import { importEntities } from 'pl-hooks';
|
||||||
|
|
||||||
import { getClient } from 'pl-fe/api';
|
import { getClient } from 'pl-fe/api';
|
||||||
import { selectAccount } from 'pl-fe/selectors';
|
import { selectAccount } from 'pl-fe/selectors';
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import IntlMessageFormat from 'intl-messageformat';
|
import IntlMessageFormat from 'intl-messageformat';
|
||||||
import 'intl-pluralrules';
|
import 'intl-pluralrules';
|
||||||
import { importEntities } from 'pl-hooks/importer';
|
import { importEntities } from 'pl-hooks';
|
||||||
import { defineMessages } from 'react-intl';
|
import { defineMessages } from 'react-intl';
|
||||||
|
|
||||||
import { FILTER_TYPES, type FilterType } from 'pl-fe/features/notifications';
|
import { FILTER_TYPES, type FilterType } from 'pl-fe/features/notifications';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { importEntities } from 'pl-hooks/importer';
|
import { importEntities } from 'pl-hooks';
|
||||||
|
|
||||||
import { getClient } from 'pl-fe/api';
|
import { getClient } from 'pl-fe/api';
|
||||||
import { isLoggedIn } from 'pl-fe/utils/auth';
|
import { isLoggedIn } from 'pl-fe/utils/auth';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { importEntities } from 'pl-hooks/importer';
|
import { importEntities } from 'pl-hooks';
|
||||||
|
|
||||||
import { getClient } from 'pl-fe/api';
|
import { getClient } from 'pl-fe/api';
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import mapValues from 'lodash/mapValues';
|
import mapValues from 'lodash/mapValues';
|
||||||
import { importEntities } from 'pl-hooks/importer';
|
import { importEntities } from 'pl-hooks';
|
||||||
|
|
||||||
import { verifyCredentials } from './auth';
|
import { verifyCredentials } from './auth';
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { importEntities } from 'pl-hooks/importer';
|
import { importEntities } from 'pl-hooks';
|
||||||
|
|
||||||
import { getClient } from 'pl-fe/api';
|
import { getClient } from 'pl-fe/api';
|
||||||
import { useSettingsStore } from 'pl-fe/stores';
|
import { useSettingsStore } from 'pl-fe/stores';
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import { Account } from 'pl-hooks/normalizers/normalizeAccount';
|
|
||||||
import { defineMessage } from 'react-intl';
|
import { defineMessage } from 'react-intl';
|
||||||
|
|
||||||
import { patchMe } from 'pl-fe/actions/me';
|
import { patchMe } from 'pl-fe/actions/me';
|
||||||
|
@ -11,6 +10,7 @@ import toast from 'pl-fe/toast';
|
||||||
import { isLoggedIn } from 'pl-fe/utils/auth';
|
import { isLoggedIn } from 'pl-fe/utils/auth';
|
||||||
|
|
||||||
import type { AppDispatch, RootState } from 'pl-fe/store';
|
import type { AppDispatch, RootState } from 'pl-fe/store';
|
||||||
|
import type { Account } from 'pl-hooks/normalizers/normalizeAccount';
|
||||||
|
|
||||||
const FE_NAME = 'pl_fe';
|
const FE_NAME = 'pl_fe';
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { importEntities } from 'pl-hooks/importer';
|
import { importEntities } from 'pl-hooks';
|
||||||
|
|
||||||
import { getClient } from 'pl-fe/api';
|
import { getClient } from 'pl-fe/api';
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { importEntities } from 'pl-hooks/importer';
|
import { importEntities } from 'pl-hooks';
|
||||||
|
|
||||||
import { getClient } from 'pl-fe/api';
|
import { getClient } from 'pl-fe/api';
|
||||||
import { useModalsStore, useSettingsStore } from 'pl-fe/stores';
|
import { useModalsStore, useSettingsStore } from 'pl-fe/stores';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { importEntities } from 'pl-hooks/importer';
|
import { importEntities } from 'pl-hooks';
|
||||||
|
|
||||||
import { getClient } from 'pl-fe/api';
|
import { getClient } from 'pl-fe/api';
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Map as ImmutableMap } from 'immutable';
|
import { Map as ImmutableMap } from 'immutable';
|
||||||
import { importEntities } from 'pl-hooks/importer';
|
import { importEntities } from 'pl-hooks';
|
||||||
|
|
||||||
import { getLocale } from 'pl-fe/actions/settings';
|
import { getLocale } from 'pl-fe/actions/settings';
|
||||||
import { getClient } from 'pl-fe/api';
|
import { getClient } from 'pl-fe/api';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { importEntities } from 'pl-hooks/importer';
|
import { importEntities } from 'pl-hooks';
|
||||||
|
|
||||||
import { getClient } from 'pl-fe/api';
|
import { getClient } from 'pl-fe/api';
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { useStatus } from 'pl-hooks/hooks/statuses/useStatus';
|
import { useStatus } from 'pl-hooks';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { HStack, Icon, Text } from 'pl-fe/components/ui';
|
import { HStack, Icon, Text } from 'pl-fe/components/ui';
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import { useStatus } from 'pl-hooks/hooks/statuses/useStatus';
|
import { useStatus } from 'pl-hooks';
|
||||||
import React, { useEffect, useRef } from 'react';
|
import React, { useEffect, useRef } from 'react';
|
||||||
import { defineMessages, useIntl, FormattedList, FormattedMessage } from 'react-intl';
|
import { defineMessages, useIntl, FormattedList, FormattedMessage } from 'react-intl';
|
||||||
import { Link, useHistory } from 'react-router-dom';
|
import { Link, useHistory } from 'react-router-dom';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { useStatus } from 'pl-hooks/hooks/statuses/useStatus';
|
import { useStatus } from 'pl-hooks';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import Status, { IStatus } from 'pl-fe/components/status';
|
import Status, { IStatus } from 'pl-fe/components/status';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { useStatus } from 'pl-hooks/hooks/statuses/useStatus';
|
import { useStatus } from 'pl-hooks';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { useStatus } from 'pl-hooks/hooks/statuses/useStatus';
|
import { useStatus } from 'pl-hooks';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { FormattedList, FormattedMessage } from 'react-intl';
|
import { FormattedList, FormattedMessage } from 'react-intl';
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { useStatus } from 'pl-hooks/hooks/statuses/useStatus';
|
import { useStatus } from 'pl-hooks';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { cancelQuoteCompose } from 'pl-fe/actions/compose';
|
import { cancelQuoteCompose } from 'pl-fe/actions/compose';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { useStatus } from 'pl-hooks/hooks/statuses/useStatus';
|
import { useStatus } from 'pl-hooks';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { cancelReplyCompose } from 'pl-fe/actions/compose';
|
import { cancelReplyCompose } from 'pl-fe/actions/compose';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { useStatus } from 'pl-hooks/hooks/statuses/useStatus';
|
import { useStatus } from 'pl-hooks';
|
||||||
import React, { useEffect } from 'react';
|
import React, { useEffect } from 'react';
|
||||||
import { useHistory } from 'react-router-dom';
|
import { useHistory } from 'react-router-dom';
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { List as ImmutableList, OrderedSet as ImmutableOrderedSet } from 'immutable';
|
import { List as ImmutableList, OrderedSet as ImmutableOrderedSet } from 'immutable';
|
||||||
import { useStatus } from 'pl-hooks/hooks/statuses/useStatus';
|
import { useStatus } from 'pl-hooks';
|
||||||
import React, { useEffect, useRef, useState } from 'react';
|
import React, { useEffect, useRef, useState } from 'react';
|
||||||
import { FormattedMessage, useIntl } from 'react-intl';
|
import { FormattedMessage, useIntl } from 'react-intl';
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { useStatus } from 'pl-hooks/hooks/statuses/useStatus';
|
import { useStatus } from 'pl-hooks';
|
||||||
import React, { useCallback } from 'react';
|
import React, { useCallback } from 'react';
|
||||||
import { FormattedDate, FormattedMessage } from 'react-intl';
|
import { FormattedDate, FormattedMessage } from 'react-intl';
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { useStatus } from 'pl-hooks/hooks/statuses/useStatus';
|
import { useStatus } from 'pl-hooks';
|
||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import ReactSwipeableViews from 'react-swipeable-views';
|
import ReactSwipeableViews from 'react-swipeable-views';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { useNotification } from 'pl-hooks/hooks/notifications/useNotification';
|
import { useNotification } from 'pl-hooks';
|
||||||
import React, { useCallback } from 'react';
|
import React, { useCallback } from 'react';
|
||||||
import { defineMessages, useIntl, FormattedList, FormattedMessage, IntlShape, MessageDescriptor } from 'react-intl';
|
import { defineMessages, useIntl, FormattedList, FormattedMessage, IntlShape, MessageDescriptor } from 'react-intl';
|
||||||
import { Link, useHistory } from 'react-router-dom';
|
import { Link, useHistory } from 'react-router-dom';
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import debounce from 'lodash/debounce';
|
import debounce from 'lodash/debounce';
|
||||||
import { useMarker } from 'pl-hooks/hooks/markers/useMarkers';
|
import { useMarker, useNotificationList, useUpdateMarkerMutation } from 'pl-hooks';
|
||||||
import { useUpdateMarkerMutation } from 'pl-hooks/hooks/markers/useUpdateMarkerMutation';
|
|
||||||
import { useNotificationList } from 'pl-hooks/hooks/notifications/useNotificationList';
|
|
||||||
import React, { useCallback, useEffect, useRef } from 'react';
|
import React, { useCallback, useEffect, useRef } from 'react';
|
||||||
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { useStatus } from 'pl-hooks/hooks/statuses/useStatus';
|
import { useStatus } from 'pl-hooks';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import QuotedStatus from 'pl-fe/components/quoted-status';
|
import QuotedStatus from 'pl-fe/components/quoted-status';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { useStatus } from 'pl-hooks/hooks/statuses/useStatus';
|
import { useStatus } from 'pl-hooks';
|
||||||
import React, { useEffect } from 'react';
|
import React, { useEffect } from 'react';
|
||||||
import { defineMessages, useIntl } from 'react-intl';
|
import { defineMessages, useIntl } from 'react-intl';
|
||||||
import { Redirect } from 'react-router-dom';
|
import { Redirect } from 'react-router-dom';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { importEntities } from 'pl-hooks/importer';
|
import { importEntities } from 'pl-hooks';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { defineMessages, useIntl, FormattedMessage } from 'react-intl';
|
import { defineMessages, useIntl, FormattedMessage } from 'react-intl';
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { useStatus } from 'pl-hooks/hooks/statuses/useStatus';
|
import { useStatus } from 'pl-hooks';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import L from 'leaflet';
|
import L from 'leaflet';
|
||||||
import { useStatus } from 'pl-hooks/hooks/statuses/useStatus';
|
import { useStatus } from 'pl-hooks';
|
||||||
import React, { useEffect, useRef } from 'react';
|
import React, { useEffect, useRef } from 'react';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import { useStatus } from 'pl-hooks/hooks/statuses/useStatus';
|
import { useStatus } from 'pl-hooks';
|
||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import { defineMessages, useIntl, FormattedMessage } from 'react-intl';
|
import { defineMessages, useIntl, FormattedMessage } from 'react-intl';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { useStatus } from 'pl-hooks/hooks/statuses/useStatus';
|
import { useStatus } from 'pl-hooks';
|
||||||
import React, { useEffect, useRef } from 'react';
|
import React, { useEffect, useRef } from 'react';
|
||||||
import { FormattedMessage, useIntl } from 'react-intl';
|
import { FormattedMessage, useIntl } from 'react-intl';
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { useStatus } from 'pl-hooks/hooks/statuses/useStatus';
|
import { useStatus } from 'pl-hooks';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { useStatus } from 'pl-hooks/hooks/statuses/useStatus';
|
import { useStatus } from 'pl-hooks';
|
||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { useStatus } from 'pl-hooks/hooks/statuses/useStatus';
|
import { useStatus } from 'pl-hooks';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import { prefetchMarker } from 'pl-hooks/hooks/markers/useMarkers';
|
import { prefetchMarker, prefetchNotifications } from 'pl-hooks';
|
||||||
import { prefetchNotifications } from 'pl-hooks/hooks/notifications/useNotificationList';
|
|
||||||
import React, { Suspense, lazy, useEffect, useRef } from 'react';
|
import React, { Suspense, lazy, useEffect, useRef } from 'react';
|
||||||
import { Switch, useHistory, useLocation, Redirect } from 'react-router-dom';
|
import { Switch, useHistory, useLocation, Redirect } from 'react-router-dom';
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { useStatus } from 'pl-hooks/hooks/statuses/useStatus';
|
import { useStatus } from 'pl-hooks';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Helmet } from 'react-helmet-async';
|
import { Helmet } from 'react-helmet-async';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { InfiniteData, keepPreviousData, useInfiniteQuery, useMutation, useQuery } from '@tanstack/react-query';
|
import { InfiniteData, keepPreviousData, useInfiniteQuery, useMutation, useQuery } from '@tanstack/react-query';
|
||||||
import sumBy from 'lodash/sumBy';
|
import sumBy from 'lodash/sumBy';
|
||||||
import { type Chat, type ChatMessage as BaseChatMessage, type PaginatedResponse, chatMessageSchema, type Relationship } from 'pl-api';
|
import { type Chat, type ChatMessage as BaseChatMessage, type PaginatedResponse, chatMessageSchema, type Relationship } from 'pl-api';
|
||||||
import { importEntities } from 'pl-hooks/importer';
|
import { importEntities } from 'pl-hooks';
|
||||||
import * as v from 'valibot';
|
import * as v from 'valibot';
|
||||||
|
|
||||||
import { ChatWidgetScreens, useChatContext } from 'pl-fe/contexts/chat-context';
|
import { ChatWidgetScreens, useChatContext } from 'pl-fe/contexts/chat-context';
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { useMutation, keepPreviousData, useQuery } from '@tanstack/react-query';
|
import { useMutation, keepPreviousData, useQuery } from '@tanstack/react-query';
|
||||||
import { importEntities } from 'pl-hooks/importer';
|
import { importEntities } from 'pl-hooks';
|
||||||
|
|
||||||
import { fetchRelationships } from 'pl-fe/actions/accounts';
|
import { fetchRelationships } from 'pl-fe/actions/accounts';
|
||||||
import { useAppDispatch, useClient } from 'pl-fe/hooks';
|
import { useAppDispatch, useClient } from 'pl-fe/hooks';
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
export * from './contexts/api-client';
|
||||||
|
export * from './contexts/query-client';
|
||||||
|
|
||||||
|
export * from './hooks/accounts/useAccount';
|
||||||
|
export * from './hooks/accounts/useAccountRelationship';
|
||||||
|
export * from './hooks/markers/useMarkers';
|
||||||
|
export * from './hooks/markers/useUpdateMarkerMutation';
|
||||||
|
export * from './hooks/notifications/useNotification';
|
||||||
|
export * from './hooks/notifications/useNotificationList';
|
||||||
|
export * from './hooks/statuses/useStatus';
|
||||||
|
|
||||||
|
export * from './importer';
|
|
@ -1,9 +1,5 @@
|
||||||
/**
|
|
||||||
* Status normalizer:
|
|
||||||
* Converts API statuses into our internal format.
|
|
||||||
* @see {@link https://docs.joinmastodon.org/entities/status/}
|
|
||||||
*/
|
|
||||||
import { type Account as BaseAccount, type Status as BaseStatus, type MediaAttachment, mentionSchema } from 'pl-api';
|
import { type Account as BaseAccount, type Status as BaseStatus, type MediaAttachment, mentionSchema } from 'pl-api';
|
||||||
|
import * as v from 'valibot';
|
||||||
|
|
||||||
type StatusApprovalStatus = Exclude<BaseStatus['approval_status'], null>;
|
type StatusApprovalStatus = Exclude<BaseStatus['approval_status'], null>;
|
||||||
type StatusVisibility = 'public' | 'unlisted' | 'private' | 'direct' | 'group' | 'mutuals_only' | 'local';
|
type StatusVisibility = 'public' | 'unlisted' | 'private' | 'direct' | 'group' | 'mutuals_only' | 'local';
|
||||||
|
@ -23,7 +19,7 @@ const normalizeStatus = ({ account, accounts, reblog, poll, group, quote, ...sta
|
||||||
const hasSelfMention = status.mentions.some(mention => account.id === mention.id);
|
const hasSelfMention = status.mentions.some(mention => account.id === mention.id);
|
||||||
|
|
||||||
if (isSelfReply && !hasSelfMention) {
|
if (isSelfReply && !hasSelfMention) {
|
||||||
const selfMention = mentionSchema.parse(account);
|
const selfMention = v.parse(mentionSchema, account);
|
||||||
mentions = [selfMention, ...mentions];
|
mentions = [selfMention, ...mentions];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,8 +35,9 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tanstack/react-query": "^5.56.2",
|
"@tanstack/react-query": "^5.56.2",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"pl-api": "^0.0.37",
|
"pl-api": "^0.1.1",
|
||||||
"react": "^18.3.1"
|
"react": "^18.3.1",
|
||||||
|
"valibot": "^0.42.1"
|
||||||
},
|
},
|
||||||
"module": "./dist/main.es.js",
|
"module": "./dist/main.es.js",
|
||||||
"types": "dist/main.d.ts",
|
"types": "dist/main.d.ts",
|
||||||
|
|
|
@ -2138,10 +2138,10 @@ pkg-types@^1.0.3, pkg-types@^1.1.1:
|
||||||
mlly "^1.7.1"
|
mlly "^1.7.1"
|
||||||
pathe "^1.1.2"
|
pathe "^1.1.2"
|
||||||
|
|
||||||
pl-api@^0.0.37:
|
pl-api@^0.1.1:
|
||||||
version "0.0.37"
|
version "0.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/pl-api/-/pl-api-0.0.37.tgz#1475be139a3733b8a60dc3dd5fdfb00f83743eea"
|
resolved "https://registry.yarnpkg.com/pl-api/-/pl-api-0.1.1.tgz#e3465482697ea53e10bba510c5217c42b1d40ab0"
|
||||||
integrity sha512-oCeKkJtUYC5XwM5PIVt+VPdLrJT7rjvfXgiv+qrUydK++cHnO1ZiixCaBnYW3M5D1BLZ6/OS4T+mk5hlCt8+1g==
|
integrity sha512-JFao273dOG9XgrunqlfJn+e3DUr001MePCmJasQwaX3aPjM/L158hKfCnYPmoDKn1u5bfekMK6tVauBtbnkmqA==
|
||||||
dependencies:
|
dependencies:
|
||||||
blurhash "^2.0.5"
|
blurhash "^2.0.5"
|
||||||
http-link-header "^1.1.3"
|
http-link-header "^1.1.3"
|
||||||
|
@ -2149,7 +2149,7 @@ pl-api@^0.0.37:
|
||||||
object-to-formdata "^4.5.1"
|
object-to-formdata "^4.5.1"
|
||||||
query-string "^9.1.0"
|
query-string "^9.1.0"
|
||||||
semver "^7.6.3"
|
semver "^7.6.3"
|
||||||
zod "^3.23.8"
|
valibot "^0.42.1"
|
||||||
|
|
||||||
possible-typed-array-names@^1.0.0:
|
possible-typed-array-names@^1.0.0:
|
||||||
version "1.0.0"
|
version "1.0.0"
|
||||||
|
@ -2586,6 +2586,11 @@ uri-js@^4.2.2, uri-js@^4.4.1:
|
||||||
dependencies:
|
dependencies:
|
||||||
punycode "^2.1.0"
|
punycode "^2.1.0"
|
||||||
|
|
||||||
|
valibot@^0.42.1:
|
||||||
|
version "0.42.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/valibot/-/valibot-0.42.1.tgz#a31183d8e9d7552f98e22ca0977172cab8815188"
|
||||||
|
integrity sha512-3keXV29Ar5b//Hqi4MbSdV7lfVp6zuYLZuA9V1PvQUsXqogr+u5lvLPLk3A4f74VUXDnf/JfWMN6sB+koJ/FFw==
|
||||||
|
|
||||||
vite-plugin-dts@^4.2.1:
|
vite-plugin-dts@^4.2.1:
|
||||||
version "4.2.1"
|
version "4.2.1"
|
||||||
resolved "https://registry.yarnpkg.com/vite-plugin-dts/-/vite-plugin-dts-4.2.1.tgz#f8bee33b732929717ce13ef7a382696d51200c30"
|
resolved "https://registry.yarnpkg.com/vite-plugin-dts/-/vite-plugin-dts-4.2.1.tgz#f8bee33b732929717ce13ef7a382696d51200c30"
|
||||||
|
@ -2665,8 +2670,3 @@ yocto-queue@^0.1.0:
|
||||||
version "0.1.0"
|
version "0.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b"
|
resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b"
|
||||||
integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==
|
integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==
|
||||||
|
|
||||||
zod@^3.23.8:
|
|
||||||
version "3.23.8"
|
|
||||||
resolved "https://registry.yarnpkg.com/zod/-/zod-3.23.8.tgz#e37b957b5d52079769fb8097099b592f0ef4067d"
|
|
||||||
integrity sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==
|
|
||||||
|
|
Loading…
Reference in a new issue