Fix remaining dependencies from shlink-web-component into main app

This commit is contained in:
Alejandro Celaya 2023-08-06 17:19:59 +02:00
parent 75fed53ba4
commit c3b6ce34ba
11 changed files with 15 additions and 14 deletions

View file

@ -4,7 +4,6 @@ import { pipe } from 'ramda';
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
import { useLocation, useParams } from 'react-router-dom'; import { useLocation, useParams } from 'react-router-dom';
import { Card } from 'reactstrap'; import { Card } from 'reactstrap';
import { DEFAULT_SHORT_URLS_ORDERING } from '../../../src/settings/reducers/settings';
import type { ShlinkShortUrlsListParams, ShlinkShortUrlsOrder } from '../api-contract'; import type { ShlinkShortUrlsListParams, ShlinkShortUrlsOrder } from '../api-contract';
import { boundToMercureHub } from '../mercure/helpers/boundToMercureHub'; import { boundToMercureHub } from '../mercure/helpers/boundToMercureHub';
import { Topics } from '../mercure/helpers/Topics'; import { Topics } from '../mercure/helpers/Topics';
@ -23,6 +22,11 @@ interface ShortUrlsListProps {
listShortUrls: (params: ShlinkShortUrlsListParams) => void; listShortUrls: (params: ShlinkShortUrlsListParams) => void;
} }
const DEFAULT_SHORT_URLS_ORDERING: ShortUrlsOrder = {
field: 'dateCreated',
dir: 'DESC',
};
export const ShortUrlsList = ( export const ShortUrlsList = (
ShortUrlsTable: ShortUrlsTableType, ShortUrlsTable: ShortUrlsTableType,
ShortUrlsFilteringBar: ShortUrlsFilteringBarType, ShortUrlsFilteringBar: ShortUrlsFilteringBarType,

View file

@ -1,9 +1,9 @@
import type { FC } from 'react'; import type { FC } from 'react';
import { useEffect, useRef } from 'react'; import { useEffect, useRef } from 'react';
import { ExternalLink } from 'react-external-link'; import { ExternalLink } from 'react-external-link';
import type { TimeoutToggle } from '../../../../src/utils/helpers/hooks';
import { CopyToClipboardIcon } from '../../utils/components/CopyToClipboardIcon'; import { CopyToClipboardIcon } from '../../utils/components/CopyToClipboardIcon';
import { Time } from '../../utils/dates/Time'; import { Time } from '../../utils/dates/Time';
import type { TimeoutToggle } from '../../utils/helpers/hooks';
import type { ColorGenerator } from '../../utils/services/ColorGenerator'; import type { ColorGenerator } from '../../utils/services/ColorGenerator';
import { useSetting } from '../../utils/settings'; import { useSetting } from '../../utils/settings';
import type { ShortUrl } from '../data'; import type { ShortUrl } from '../data';

View file

@ -1,6 +1,5 @@
import { fromPartial } from '@total-typescript/shoehorn'; import { fromPartial } from '@total-typescript/shoehorn';
import type { ShlinkApiClient } from '../../../../src/api/services/ShlinkApiClient'; import type { ShlinkApiClient, ShlinkDomainRedirects } from '../../../src/api-contract';
import type { ShlinkDomainRedirects } from '../../../src/api-contract';
import { editDomainRedirects } from '../../../src/domains/reducers/domainRedirects'; import { editDomainRedirects } from '../../../src/domains/reducers/domainRedirects';
describe('domainRedirectsReducer', () => { describe('domainRedirectsReducer', () => {

View file

@ -2,7 +2,6 @@ import { screen } from '@testing-library/react';
import type { UserEvent } from '@testing-library/user-event/setup/setup'; import type { UserEvent } from '@testing-library/user-event/setup/setup';
import { fromPartial } from '@total-typescript/shoehorn'; import { fromPartial } from '@total-typescript/shoehorn';
import { formatISO } from 'date-fns'; import { formatISO } from 'date-fns';
import type { OptionalString } from '../../../src/utils/utils';
import type { Mode } from '../../src/short-urls/ShortUrlForm'; import type { Mode } from '../../src/short-urls/ShortUrlForm';
import { ShortUrlForm as createShortUrlForm } from '../../src/short-urls/ShortUrlForm'; import { ShortUrlForm as createShortUrlForm } from '../../src/short-urls/ShortUrlForm';
import { parseDate } from '../../src/utils/dates/helpers/date'; import { parseDate } from '../../src/utils/dates/helpers/date';
@ -12,7 +11,7 @@ import { renderWithEvents } from '../__helpers__/setUpTest';
describe('<ShortUrlForm />', () => { describe('<ShortUrlForm />', () => {
const createShortUrl = vi.fn(async () => Promise.resolve()); const createShortUrl = vi.fn(async () => Promise.resolve());
const ShortUrlForm = createShortUrlForm(() => <span>TagsSelector</span>, () => <span>DomainSelector</span>); const ShortUrlForm = createShortUrlForm(() => <span>TagsSelector</span>, () => <span>DomainSelector</span>);
const setUp = (withDeviceLongUrls = false, mode: Mode = 'create', title?: OptionalString) => const setUp = (withDeviceLongUrls = false, mode: Mode = 'create', title?: string | null) =>
renderWithEvents( renderWithEvents(
<FeaturesProvider value={fromPartial({ deviceLongUrls: withDeviceLongUrls })}> <FeaturesProvider value={fromPartial({ deviceLongUrls: withDeviceLongUrls })}>
<ShortUrlForm <ShortUrlForm

View file

@ -1,8 +1,8 @@
import { screen } from '@testing-library/react'; import { screen } from '@testing-library/react';
import { fromPartial } from '@total-typescript/shoehorn'; import { fromPartial } from '@total-typescript/shoehorn';
import type { TimeoutToggle } from '../../../../src/utils/helpers/hooks';
import { CreateShortUrlResult as createResult } from '../../../src/short-urls/helpers/CreateShortUrlResult'; import { CreateShortUrlResult as createResult } from '../../../src/short-urls/helpers/CreateShortUrlResult';
import type { ShortUrlCreation } from '../../../src/short-urls/reducers/shortUrlCreation'; import type { ShortUrlCreation } from '../../../src/short-urls/reducers/shortUrlCreation';
import type { TimeoutToggle } from '../../../src/utils/helpers/hooks';
import { renderWithEvents } from '../../__helpers__/setUpTest'; import { renderWithEvents } from '../../__helpers__/setUpTest';
describe('<CreateShortUrlResult />', () => { describe('<CreateShortUrlResult />', () => {

View file

@ -1,6 +1,5 @@
import { fromPartial } from '@total-typescript/shoehorn'; import { fromPartial } from '@total-typescript/shoehorn';
import type { ShlinkApiClient } from '../../../../src/api/services/ShlinkApiClient'; import type { ProblemDetailsError, ShlinkApiClient } from '../../../src/api-contract';
import type { ProblemDetailsError } from '../../../src/api-contract';
import { import {
deleteShortUrl as deleteShortUrlCreator, deleteShortUrl as deleteShortUrlCreator,
shortUrlDeletionReducerCreator, shortUrlDeletionReducerCreator,

View file

@ -1,11 +1,11 @@
import { fromPartial } from '@total-typescript/shoehorn'; import { fromPartial } from '@total-typescript/shoehorn';
import { addDays, formatISO, subDays } from 'date-fns'; import { addDays, formatISO, subDays } from 'date-fns';
import { rangeOf } from '../../../../src/utils/utils';
import type { ShlinkApiClient, ShlinkVisits } from '../../../src/api-contract'; import type { ShlinkApiClient, ShlinkVisits } from '../../../src/api-contract';
import type { RootState } from '../../../src/container/store'; import type { RootState } from '../../../src/container/store';
import type { ShortUrl } from '../../../src/short-urls/data'; import type { ShortUrl } from '../../../src/short-urls/data';
import { formatIsoDate } from '../../../src/utils/dates/helpers/date'; import { formatIsoDate } from '../../../src/utils/dates/helpers/date';
import type { DateInterval } from '../../../src/utils/dates/helpers/dateIntervals'; import type { DateInterval } from '../../../src/utils/dates/helpers/dateIntervals';
import { rangeOf } from '../../../src/utils/helpers';
import type { import type {
DomainVisits, LoadDomainVisits, DomainVisits, LoadDomainVisits,
} from '../../../src/visits/reducers/domainVisits'; } from '../../../src/visits/reducers/domainVisits';

View file

@ -1,10 +1,10 @@
import { fromPartial } from '@total-typescript/shoehorn'; import { fromPartial } from '@total-typescript/shoehorn';
import { addDays, formatISO, subDays } from 'date-fns'; import { addDays, formatISO, subDays } from 'date-fns';
import { rangeOf } from '../../../../src/utils/utils';
import type { ShlinkApiClient, ShlinkVisits } from '../../../src/api-contract'; import type { ShlinkApiClient, ShlinkVisits } from '../../../src/api-contract';
import type { RootState } from '../../../src/container/store'; import type { RootState } from '../../../src/container/store';
import { formatIsoDate } from '../../../src/utils/dates/helpers/date'; import { formatIsoDate } from '../../../src/utils/dates/helpers/date';
import type { DateInterval } from '../../../src/utils/dates/helpers/dateIntervals'; import type { DateInterval } from '../../../src/utils/dates/helpers/dateIntervals';
import { rangeOf } from '../../../src/utils/helpers';
import { import {
getNonOrphanVisits as getNonOrphanVisitsCreator, getNonOrphanVisits as getNonOrphanVisitsCreator,
nonOrphanVisitsReducerCreator, nonOrphanVisitsReducerCreator,

View file

@ -1,10 +1,10 @@
import { fromPartial } from '@total-typescript/shoehorn'; import { fromPartial } from '@total-typescript/shoehorn';
import { addDays, formatISO, subDays } from 'date-fns'; import { addDays, formatISO, subDays } from 'date-fns';
import { rangeOf } from '../../../../src/utils/utils';
import type { ShlinkApiClient, ShlinkVisits } from '../../../src/api-contract'; import type { ShlinkApiClient, ShlinkVisits } from '../../../src/api-contract';
import type { RootState } from '../../../src/container/store'; import type { RootState } from '../../../src/container/store';
import { formatIsoDate } from '../../../src/utils/dates/helpers/date'; import { formatIsoDate } from '../../../src/utils/dates/helpers/date';
import type { DateInterval } from '../../../src/utils/dates/helpers/dateIntervals'; import type { DateInterval } from '../../../src/utils/dates/helpers/dateIntervals';
import { rangeOf } from '../../../src/utils/helpers';
import { import {
getOrphanVisits as getOrphanVisitsCreator, getOrphanVisits as getOrphanVisitsCreator,
orphanVisitsReducerCreator, orphanVisitsReducerCreator,

View file

@ -1,10 +1,10 @@
import { fromPartial } from '@total-typescript/shoehorn'; import { fromPartial } from '@total-typescript/shoehorn';
import { addDays, formatISO, subDays } from 'date-fns'; import { addDays, formatISO, subDays } from 'date-fns';
import { rangeOf } from '../../../../src/utils/utils';
import type { ShlinkApiClient, ShlinkVisits } from '../../../src/api-contract'; import type { ShlinkApiClient, ShlinkVisits } from '../../../src/api-contract';
import type { RootState } from '../../../src/container/store'; import type { RootState } from '../../../src/container/store';
import { formatIsoDate } from '../../../src/utils/dates/helpers/date'; import { formatIsoDate } from '../../../src/utils/dates/helpers/date';
import type { DateInterval } from '../../../src/utils/dates/helpers/dateIntervals'; import type { DateInterval } from '../../../src/utils/dates/helpers/dateIntervals';
import { rangeOf } from '../../../src/utils/helpers';
import type { import type {
ShortUrlVisits } from '../../../src/visits/reducers/shortUrlVisits'; ShortUrlVisits } from '../../../src/visits/reducers/shortUrlVisits';
import { import {

View file

@ -1,10 +1,10 @@
import { fromPartial } from '@total-typescript/shoehorn'; import { fromPartial } from '@total-typescript/shoehorn';
import { addDays, formatISO, subDays } from 'date-fns'; import { addDays, formatISO, subDays } from 'date-fns';
import { rangeOf } from '../../../../src/utils/utils';
import type { ShlinkApiClient, ShlinkVisits } from '../../../src/api-contract'; import type { ShlinkApiClient, ShlinkVisits } from '../../../src/api-contract';
import type { RootState } from '../../../src/container/store'; import type { RootState } from '../../../src/container/store';
import { formatIsoDate } from '../../../src/utils/dates/helpers/date'; import { formatIsoDate } from '../../../src/utils/dates/helpers/date';
import type { DateInterval } from '../../../src/utils/dates/helpers/dateIntervals'; import type { DateInterval } from '../../../src/utils/dates/helpers/dateIntervals';
import { rangeOf } from '../../../src/utils/helpers';
import type { import type {
TagVisits } from '../../../src/visits/reducers/tagVisits'; TagVisits } from '../../../src/visits/reducers/tagVisits';
import { import {