mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2025-01-10 02:07:26 +03:00
Fixed no longer implicit children prop in FunctionalComponent type
This commit is contained in:
parent
d5b1dc5bff
commit
271b19a4ec
28 changed files with 86 additions and 80 deletions
|
@ -1,4 +1,6 @@
|
||||||
import { FC } from 'react';
|
import { FC, PropsWithChildren } from 'react';
|
||||||
import './NoMenuLayout.scss';
|
import './NoMenuLayout.scss';
|
||||||
|
|
||||||
export const NoMenuLayout: FC = ({ children }) => <div className="no-menu-wrapper container-xl">{children}</div>;
|
export const NoMenuLayout: FC<PropsWithChildren<unknown>> = ({ children }) => (
|
||||||
|
<div className="no-menu-wrapper container-xl">{children}</div>
|
||||||
|
);
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
import { FC } from 'react';
|
import { FC, PropsWithChildren } from 'react';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import { SimpleCard } from '../utils/SimpleCard';
|
import { SimpleCard } from '../utils/SimpleCard';
|
||||||
|
|
||||||
interface NotFoundProps {
|
type NotFoundProps = PropsWithChildren<{ to?: string }>;
|
||||||
to?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
const NotFound: FC<NotFoundProps> = ({ to = '/', children = 'Home' }) => (
|
const NotFound: FC<NotFoundProps> = ({ to = '/', children = 'Home' }) => (
|
||||||
<div className="home">
|
<div className="home">
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { FC, useEffect } from 'react';
|
import { FC, PropsWithChildren, useEffect } from 'react';
|
||||||
import { useLocation } from 'react-router-dom';
|
import { useLocation } from 'react-router-dom';
|
||||||
|
|
||||||
const ScrollToTop = (): FC => ({ children }) => {
|
const ScrollToTop = (): FC<PropsWithChildren<unknown>> => ({ children }) => {
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
import { FC } from 'react';
|
import { FC, PropsWithChildren } from 'react';
|
||||||
import { faMinusCircle as deleteIcon } from '@fortawesome/free-solid-svg-icons';
|
import { faMinusCircle as deleteIcon } from '@fortawesome/free-solid-svg-icons';
|
||||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||||
import { useToggle } from '../utils/helpers/hooks';
|
import { useToggle } from '../utils/helpers/hooks';
|
||||||
import { DeleteServerModalProps } from './DeleteServerModal';
|
import { DeleteServerModalProps } from './DeleteServerModal';
|
||||||
import { ServerWithId } from './data';
|
import { ServerWithId } from './data';
|
||||||
|
|
||||||
export interface DeleteServerButtonProps {
|
export type DeleteServerButtonProps = PropsWithChildren<{
|
||||||
server: ServerWithId;
|
server: ServerWithId;
|
||||||
className?: string;
|
className?: string;
|
||||||
textClassName?: string;
|
textClassName?: string;
|
||||||
}
|
}>;
|
||||||
|
|
||||||
const DeleteServerButton = (DeleteServerModal: FC<DeleteServerModalProps>): FC<DeleteServerButtonProps> => (
|
const DeleteServerButton = (DeleteServerModal: FC<DeleteServerModalProps>): FC<DeleteServerButtonProps> => (
|
||||||
{ server, className, children, textClassName },
|
{ server, className, children, textClassName },
|
||||||
|
|
|
@ -8,12 +8,12 @@ import { ShortUrlsTableProps } from '../short-urls/ShortUrlsTable';
|
||||||
import { boundToMercureHub } from '../mercure/helpers/boundToMercureHub';
|
import { boundToMercureHub } from '../mercure/helpers/boundToMercureHub';
|
||||||
import { CreateShortUrlProps } from '../short-urls/CreateShortUrl';
|
import { CreateShortUrlProps } from '../short-urls/CreateShortUrl';
|
||||||
import { VisitsOverview } from '../visits/reducers/visitsOverview';
|
import { VisitsOverview } from '../visits/reducers/visitsOverview';
|
||||||
import { Versions } from '../utils/helpers/version';
|
|
||||||
import { Topics } from '../mercure/helpers/Topics';
|
import { Topics } from '../mercure/helpers/Topics';
|
||||||
import { ShlinkShortUrlsListParams } from '../api/types';
|
import { ShlinkShortUrlsListParams } from '../api/types';
|
||||||
import { supportsNonOrphanVisits, supportsOrphanVisits } from '../utils/helpers/features';
|
import { supportsNonOrphanVisits, supportsOrphanVisits } from '../utils/helpers/features';
|
||||||
import { getServerId, SelectedServer } from './data';
|
import { getServerId, SelectedServer } from './data';
|
||||||
import { HighlightCard } from './helpers/HighlightCard';
|
import { HighlightCard } from './helpers/HighlightCard';
|
||||||
|
import { ForServerVersionProps } from './helpers/ForServerVersion';
|
||||||
|
|
||||||
interface OverviewConnectProps {
|
interface OverviewConnectProps {
|
||||||
shortUrlsList: ShortUrlsListState;
|
shortUrlsList: ShortUrlsListState;
|
||||||
|
@ -28,7 +28,7 @@ interface OverviewConnectProps {
|
||||||
export const Overview = (
|
export const Overview = (
|
||||||
ShortUrlsTable: FC<ShortUrlsTableProps>,
|
ShortUrlsTable: FC<ShortUrlsTableProps>,
|
||||||
CreateShortUrl: FC<CreateShortUrlProps>,
|
CreateShortUrl: FC<CreateShortUrlProps>,
|
||||||
ForServerVersion: FC<Versions>,
|
ForServerVersion: FC<ForServerVersionProps>,
|
||||||
) => boundToMercureHub(({
|
) => boundToMercureHub(({
|
||||||
shortUrlsList,
|
shortUrlsList,
|
||||||
listShortUrls,
|
listShortUrls,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { FC } from 'react';
|
import { FC, PropsWithChildren } from 'react';
|
||||||
import { ListGroup, ListGroupItem } from 'reactstrap';
|
import { ListGroup, ListGroupItem } from 'reactstrap';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
@ -7,10 +7,10 @@ import { faChevronRight as chevronIcon } from '@fortawesome/free-solid-svg-icons
|
||||||
import { ServerWithId } from './data';
|
import { ServerWithId } from './data';
|
||||||
import './ServersListGroup.scss';
|
import './ServersListGroup.scss';
|
||||||
|
|
||||||
interface ServersListGroupProps {
|
type ServersListGroupProps = PropsWithChildren<{
|
||||||
servers: ServerWithId[];
|
servers: ServerWithId[];
|
||||||
embedded?: boolean;
|
embedded?: boolean;
|
||||||
}
|
}>;
|
||||||
|
|
||||||
const ServerListItem = ({ id, name }: { id: string; name: string }) => (
|
const ServerListItem = ({ id, name }: { id: string; name: string }) => (
|
||||||
<ListGroupItem tag={Link} to={`/server/${id}`} className="servers-list__server-item">
|
<ListGroupItem tag={Link} to={`/server/${id}`} className="servers-list__server-item">
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
import { FC } from 'react';
|
import { FC, PropsWithChildren } from 'react';
|
||||||
import { versionMatch, Versions } from '../../utils/helpers/version';
|
import { versionMatch, Versions } from '../../utils/helpers/version';
|
||||||
import { isReachableServer, SelectedServer } from '../data';
|
import { isReachableServer, SelectedServer } from '../data';
|
||||||
|
|
||||||
interface ForServerVersionProps extends Versions {
|
export type ForServerVersionProps = PropsWithChildren<Versions>;
|
||||||
|
|
||||||
|
interface ForServerVersionConnectProps extends ForServerVersionProps {
|
||||||
selectedServer: SelectedServer;
|
selectedServer: SelectedServer;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ForServerVersion: FC<ForServerVersionProps> = ({ minVersion, maxVersion, selectedServer, children }) => {
|
const ForServerVersion: FC<ForServerVersionConnectProps> = ({ minVersion, maxVersion, selectedServer, children }) => {
|
||||||
if (!isReachableServer(selectedServer)) {
|
if (!isReachableServer(selectedServer)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
import { FC } from 'react';
|
import { FC, PropsWithChildren } from 'react';
|
||||||
import { Card, CardText, CardTitle } from 'reactstrap';
|
import { Card, CardText, CardTitle } from 'reactstrap';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import { faArrowAltCircleRight as linkIcon } from '@fortawesome/free-regular-svg-icons';
|
import { faArrowAltCircleRight as linkIcon } from '@fortawesome/free-regular-svg-icons';
|
||||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||||
import './HighlightCard.scss';
|
import './HighlightCard.scss';
|
||||||
|
|
||||||
export interface HighlightCardProps {
|
export type HighlightCardProps = PropsWithChildren<{
|
||||||
title: string;
|
title: string;
|
||||||
link?: string | false;
|
link?: string | false;
|
||||||
}
|
}>;
|
||||||
|
|
||||||
const buildExtraProps = (link?: string | false) => (!link ? {} : { tag: Link, to: link });
|
const buildExtraProps = (link?: string | false) => (!link ? {} : { tag: Link, to: link });
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { useRef, RefObject, ChangeEvent, MutableRefObject, useState, useEffect, FC } from 'react';
|
import { useRef, RefObject, ChangeEvent, MutableRefObject, useState, useEffect, FC, PropsWithChildren } from 'react';
|
||||||
import { Button, UncontrolledTooltip } from 'reactstrap';
|
import { Button, UncontrolledTooltip } from 'reactstrap';
|
||||||
import { complement, pipe } from 'ramda';
|
import { complement, pipe } from 'ramda';
|
||||||
import { faFileUpload as importIcon } from '@fortawesome/free-solid-svg-icons';
|
import { faFileUpload as importIcon } from '@fortawesome/free-solid-svg-icons';
|
||||||
|
@ -11,12 +11,12 @@ import './ImportServersBtn.scss';
|
||||||
|
|
||||||
type Ref<T> = RefObject<T> | MutableRefObject<T>;
|
type Ref<T> = RefObject<T> | MutableRefObject<T>;
|
||||||
|
|
||||||
export interface ImportServersBtnProps {
|
export type ImportServersBtnProps = PropsWithChildren<{
|
||||||
onImport?: () => void;
|
onImport?: () => void;
|
||||||
onImportError?: (error: Error) => void;
|
onImportError?: (error: Error) => void;
|
||||||
tooltipPlacement?: 'top' | 'bottom';
|
tooltipPlacement?: 'top' | 'bottom';
|
||||||
className?: string;
|
className?: string;
|
||||||
}
|
}>;
|
||||||
|
|
||||||
interface ImportServersBtnConnectProps extends ImportServersBtnProps {
|
interface ImportServersBtnConnectProps extends ImportServersBtnProps {
|
||||||
createServers: (servers: ServerData[]) => void;
|
createServers: (servers: ServerData[]) => void;
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
import { FC, ReactNode, useEffect, useState } from 'react';
|
import { FC, PropsWithChildren, ReactNode, useEffect, useState } from 'react';
|
||||||
import { InputFormGroup } from '../../utils/forms/InputFormGroup';
|
import { InputFormGroup } from '../../utils/forms/InputFormGroup';
|
||||||
import { handleEventPreventingDefault } from '../../utils/utils';
|
import { handleEventPreventingDefault } from '../../utils/utils';
|
||||||
import { ServerData } from '../data';
|
import { ServerData } from '../data';
|
||||||
import { SimpleCard } from '../../utils/SimpleCard';
|
import { SimpleCard } from '../../utils/SimpleCard';
|
||||||
|
|
||||||
interface ServerFormProps {
|
type ServerFormProps = PropsWithChildren<{
|
||||||
onSubmit: (server: ServerData) => void;
|
onSubmit: (server: ServerData) => void;
|
||||||
initialValues?: ServerData;
|
initialValues?: ServerData;
|
||||||
title?: ReactNode;
|
title?: ReactNode;
|
||||||
}
|
}>;
|
||||||
|
|
||||||
export const ServerForm: FC<ServerFormProps> = ({ onSubmit, initialValues, children, title }) => {
|
export const ServerForm: FC<ServerFormProps> = ({ onSubmit, initialValues, children, title }) => {
|
||||||
const [name, setName] = useState('');
|
const [name, setName] = useState('');
|
||||||
|
|
|
@ -13,16 +13,16 @@ import {
|
||||||
supportsQrErrorCorrection,
|
supportsQrErrorCorrection,
|
||||||
} from '../../utils/helpers/features';
|
} from '../../utils/helpers/features';
|
||||||
import { ImageDownloader } from '../../common/services/ImageDownloader';
|
import { ImageDownloader } from '../../common/services/ImageDownloader';
|
||||||
import { Versions } from '../../utils/helpers/version';
|
import { ForServerVersionProps } from '../../servers/helpers/ForServerVersion';
|
||||||
import { QrFormatDropdown } from './qr-codes/QrFormatDropdown';
|
import { QrFormatDropdown } from './qr-codes/QrFormatDropdown';
|
||||||
import './QrCodeModal.scss';
|
|
||||||
import { QrErrorCorrectionDropdown } from './qr-codes/QrErrorCorrectionDropdown';
|
import { QrErrorCorrectionDropdown } from './qr-codes/QrErrorCorrectionDropdown';
|
||||||
|
import './QrCodeModal.scss';
|
||||||
|
|
||||||
interface QrCodeModalConnectProps extends ShortUrlModalProps {
|
interface QrCodeModalConnectProps extends ShortUrlModalProps {
|
||||||
selectedServer: SelectedServer;
|
selectedServer: SelectedServer;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QrCodeModal = (imageDownloader: ImageDownloader, ForServerVersion: FC<Versions>) => (
|
const QrCodeModal = (imageDownloader: ImageDownloader, ForServerVersion: FC<ForServerVersionProps>) => (
|
||||||
{ shortUrl: { shortUrl, shortCode }, toggle, isOpen, selectedServer }: QrCodeModalConnectProps,
|
{ shortUrl: { shortUrl, shortCode }, toggle, isOpen, selectedServer }: QrCodeModalConnectProps,
|
||||||
) => {
|
) => {
|
||||||
const [size, setSize] = useState(300);
|
const [size, setSize] = useState(300);
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import { ChangeEvent, FC } from 'react';
|
import { ChangeEvent, FC, PropsWithChildren } from 'react';
|
||||||
import Checkbox from '../../utils/Checkbox';
|
import Checkbox from '../../utils/Checkbox';
|
||||||
import { InfoTooltip } from '../../utils/InfoTooltip';
|
import { InfoTooltip } from '../../utils/InfoTooltip';
|
||||||
|
|
||||||
interface ShortUrlFormCheckboxGroupProps {
|
type ShortUrlFormCheckboxGroupProps = PropsWithChildren<{
|
||||||
checked?: boolean;
|
checked?: boolean;
|
||||||
onChange?: (checked: boolean, e: ChangeEvent<HTMLInputElement>) => void;
|
onChange?: (checked: boolean, e: ChangeEvent<HTMLInputElement>) => void;
|
||||||
infoTooltip?: string;
|
infoTooltip?: string;
|
||||||
}
|
}>;
|
||||||
|
|
||||||
export const ShortUrlFormCheckboxGroup: FC<ShortUrlFormCheckboxGroupProps> = (
|
export const ShortUrlFormCheckboxGroup: FC<ShortUrlFormCheckboxGroupProps> = (
|
||||||
{ children, infoTooltip, checked, onChange },
|
{ children, infoTooltip, checked, onChange },
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
import { FC, MouseEventHandler } from 'react';
|
import { FC, MouseEventHandler, PropsWithChildren } from 'react';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import ColorGenerator from '../../utils/services/ColorGenerator';
|
import ColorGenerator from '../../utils/services/ColorGenerator';
|
||||||
import './Tag.scss';
|
import './Tag.scss';
|
||||||
|
|
||||||
interface TagProps {
|
type TagProps = PropsWithChildren<{
|
||||||
colorGenerator: ColorGenerator;
|
colorGenerator: ColorGenerator;
|
||||||
text: string;
|
text: string;
|
||||||
className?: string;
|
className?: string;
|
||||||
clearable?: boolean;
|
clearable?: boolean;
|
||||||
onClick?: MouseEventHandler;
|
onClick?: MouseEventHandler;
|
||||||
onClose?: MouseEventHandler;
|
onClose?: MouseEventHandler;
|
||||||
}
|
}>;
|
||||||
|
|
||||||
const Tag: FC<TagProps> = ({ text, children, clearable, className = '', colorGenerator, onClick, onClose }) => (
|
const Tag: FC<TagProps> = ({ text, children, clearable, className = '', colorGenerator, onClick, onClose }) => (
|
||||||
<span
|
<span
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
import { ChangeEvent, FC } from 'react';
|
import { ChangeEvent, FC, PropsWithChildren } from 'react';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { identity } from 'ramda';
|
import { identity } from 'ramda';
|
||||||
import { useDomId } from './helpers/hooks';
|
import { useDomId } from './helpers/hooks';
|
||||||
|
|
||||||
export interface BooleanControlProps {
|
export type BooleanControlProps = PropsWithChildren<{
|
||||||
checked?: boolean;
|
checked?: boolean;
|
||||||
onChange?: (checked: boolean, e: ChangeEvent<HTMLInputElement>) => void;
|
onChange?: (checked: boolean, e: ChangeEvent<HTMLInputElement>) => void;
|
||||||
className?: string;
|
className?: string;
|
||||||
inline?: boolean;
|
inline?: boolean;
|
||||||
}
|
}>;
|
||||||
|
|
||||||
interface BooleanControlWithTypeProps extends BooleanControlProps {
|
interface BooleanControlWithTypeProps extends BooleanControlProps {
|
||||||
type: 'switch' | 'checkbox';
|
type: 'switch' | 'checkbox';
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
import { FC } from 'react';
|
import { FC, PropsWithChildren } from 'react';
|
||||||
import { Dropdown, DropdownMenu, DropdownToggle } from 'reactstrap';
|
import { Dropdown, DropdownMenu, DropdownToggle } from 'reactstrap';
|
||||||
import { useToggle } from './helpers/hooks';
|
import { useToggle } from './helpers/hooks';
|
||||||
import './DropdownBtn.scss';
|
import './DropdownBtn.scss';
|
||||||
|
|
||||||
export interface DropdownBtnProps {
|
export type DropdownBtnProps = PropsWithChildren<{
|
||||||
text: string;
|
text: string;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
className?: string;
|
className?: string;
|
||||||
dropdownClassName?: string;
|
dropdownClassName?: string;
|
||||||
right?: boolean;
|
right?: boolean;
|
||||||
minWidth?: number;
|
minWidth?: number;
|
||||||
}
|
}>;
|
||||||
|
|
||||||
export const DropdownBtn: FC<DropdownBtnProps> = (
|
export const DropdownBtn: FC<DropdownBtnProps> = (
|
||||||
{ text, disabled = false, className = '', children, dropdownClassName, right = false, minWidth },
|
{ text, disabled = false, className = '', children, dropdownClassName, right = false, minWidth },
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
import { FC } from 'react';
|
import { FC, PropsWithChildren } from 'react';
|
||||||
import { ButtonDropdown, DropdownMenu, DropdownToggle } from 'reactstrap';
|
import { ButtonDropdown, DropdownMenu, DropdownToggle } from 'reactstrap';
|
||||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||||
import { faEllipsisV as menuIcon } from '@fortawesome/free-solid-svg-icons';
|
import { faEllipsisV as menuIcon } from '@fortawesome/free-solid-svg-icons';
|
||||||
import './DropdownBtnMenu.scss';
|
import './DropdownBtnMenu.scss';
|
||||||
|
|
||||||
export interface DropdownBtnMenuProps {
|
export type DropdownBtnMenuProps = PropsWithChildren<{
|
||||||
isOpen: boolean;
|
isOpen: boolean;
|
||||||
toggle: () => void;
|
toggle: () => void;
|
||||||
right?: boolean;
|
right?: boolean;
|
||||||
}
|
}>;
|
||||||
|
|
||||||
export const DropdownBtnMenu: FC<DropdownBtnMenuProps> = ({ isOpen, toggle, children, right = true }) => (
|
export const DropdownBtnMenu: FC<DropdownBtnMenuProps> = ({ isOpen, toggle, children, right = true }) => (
|
||||||
<ButtonDropdown toggle={toggle} isOpen={isOpen}>
|
<ButtonDropdown toggle={toggle} isOpen={isOpen}>
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
import { FC, useRef } from 'react';
|
import { FC, PropsWithChildren, useRef } from 'react';
|
||||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||||
import { faInfoCircle as infoIcon } from '@fortawesome/free-solid-svg-icons';
|
import { faInfoCircle as infoIcon } from '@fortawesome/free-solid-svg-icons';
|
||||||
import { UncontrolledTooltip } from 'reactstrap';
|
import { UncontrolledTooltip } from 'reactstrap';
|
||||||
import { Placement } from '@popperjs/core';
|
import { Placement } from '@popperjs/core';
|
||||||
|
|
||||||
interface InfoTooltipProps {
|
type InfoTooltipProps = PropsWithChildren<{
|
||||||
className?: string;
|
className?: string;
|
||||||
placement: Placement;
|
placement: Placement;
|
||||||
}
|
}>;
|
||||||
|
|
||||||
export const InfoTooltip: FC<InfoTooltipProps> = ({ className = '', placement, children }) => {
|
export const InfoTooltip: FC<InfoTooltipProps> = ({ className = '', placement, children }) => {
|
||||||
const ref = useRef<HTMLSpanElement | null>();
|
const ref = useRef<HTMLSpanElement | null>();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { FC } from 'react';
|
import { FC, PropsWithChildren } from 'react';
|
||||||
import { Card, Row } from 'reactstrap';
|
import { Card, Row } from 'reactstrap';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { faCircleNotch as preloader } from '@fortawesome/free-solid-svg-icons';
|
import { faCircleNotch as preloader } from '@fortawesome/free-solid-svg-icons';
|
||||||
|
@ -23,12 +23,12 @@ const getTextClassForType = (type: MessageType) => {
|
||||||
return map[type];
|
return map[type];
|
||||||
};
|
};
|
||||||
|
|
||||||
export interface MessageProps {
|
export type MessageProps = PropsWithChildren<{
|
||||||
className?: string;
|
className?: string;
|
||||||
loading?: boolean;
|
loading?: boolean;
|
||||||
fullWidth?: boolean;
|
fullWidth?: boolean;
|
||||||
type?: MessageType;
|
type?: MessageType;
|
||||||
}
|
}>;
|
||||||
|
|
||||||
const Message: FC<MessageProps> = ({ className, children, loading = false, type = 'default', fullWidth = false }) => {
|
const Message: FC<MessageProps> = ({ className, children, loading = false, type = 'default', fullWidth = false }) => {
|
||||||
const classes = classNames({
|
const classes = classNames({
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
import { FC, Children, isValidElement } from 'react';
|
import { FC, Children, isValidElement, PropsWithChildren } from 'react';
|
||||||
import { Card, Nav, NavLink } from 'reactstrap';
|
import { Card, Nav, NavLink } from 'reactstrap';
|
||||||
import { NavLink as RouterNavLink } from 'react-router-dom';
|
import { NavLink as RouterNavLink } from 'react-router-dom';
|
||||||
import './NavPills.scss';
|
import './NavPills.scss';
|
||||||
|
|
||||||
interface NavPillsProps {
|
type NavPillsProps = PropsWithChildren<{
|
||||||
fill?: boolean;
|
fill?: boolean;
|
||||||
className?: string;
|
className?: string;
|
||||||
}
|
}>;
|
||||||
|
|
||||||
interface NavPillProps {
|
type NavPillProps = PropsWithChildren<{
|
||||||
to: string;
|
to: string;
|
||||||
replace?: boolean;
|
replace?: boolean;
|
||||||
}
|
}>;
|
||||||
|
|
||||||
export const NavPillItem: FC<NavPillProps> = ({ children, ...rest }) => (
|
export const NavPillItem: FC<NavPillProps> = ({ children, ...rest }) => (
|
||||||
<NavLink className="nav-pills__nav-link" tag={RouterNavLink} {...rest}>
|
<NavLink className="nav-pills__nav-link" tag={RouterNavLink} {...rest}>
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
import { FC } from 'react';
|
import { FC, PropsWithChildren } from 'react';
|
||||||
import { Row } from 'reactstrap';
|
import { Row } from 'reactstrap';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { SimpleCard } from './SimpleCard';
|
import { SimpleCard } from './SimpleCard';
|
||||||
|
|
||||||
export type ResultType = 'success' | 'error' | 'warning';
|
export type ResultType = 'success' | 'error' | 'warning';
|
||||||
|
|
||||||
export interface ResultProps {
|
export type ResultProps = PropsWithChildren<{
|
||||||
type: ResultType;
|
type: ResultType;
|
||||||
className?: string;
|
className?: string;
|
||||||
small?: boolean;
|
small?: boolean;
|
||||||
}
|
}>;
|
||||||
|
|
||||||
export const Result: FC<ResultProps> = ({ children, type, className, small = false }) => (
|
export const Result: FC<ResultProps> = ({ children, type, className, small = false }) => (
|
||||||
<Row className={className}>
|
<Row className={className}>
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
import { FC, useRef } from 'react';
|
import { FC, PropsWithChildren, useRef } from 'react';
|
||||||
import { UncontrolledTooltip, UncontrolledTooltipProps } from 'reactstrap';
|
import { UncontrolledTooltip, UncontrolledTooltipProps } from 'reactstrap';
|
||||||
import { BooleanControlProps } from './BooleanControl';
|
import { BooleanControlProps } from './BooleanControl';
|
||||||
import ToggleSwitch from './ToggleSwitch';
|
import ToggleSwitch from './ToggleSwitch';
|
||||||
|
|
||||||
export type TooltipToggleSwitchProps = BooleanControlProps & { tooltip?: Omit<UncontrolledTooltipProps, 'target'> };
|
export type TooltipToggleSwitchProps = BooleanControlProps & PropsWithChildren<{
|
||||||
|
tooltip?: Omit<UncontrolledTooltipProps, 'target'>;
|
||||||
|
}>;
|
||||||
|
|
||||||
export const TooltipToggleSwitch: FC<TooltipToggleSwitchProps> = ({ children, tooltip = {}, ...rest }) => {
|
export const TooltipToggleSwitch: FC<TooltipToggleSwitchProps> = ({ children, tooltip = {}, ...rest }) => {
|
||||||
const ref = useRef<HTMLSpanElement>();
|
const ref = useRef<HTMLSpanElement>();
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
import { FC } from 'react';
|
import { FC, PropsWithChildren } from 'react';
|
||||||
|
|
||||||
export const FormText: FC = ({ children }) => <small className="form-text text-muted d-block">{children}</small>;
|
export const FormText: FC<PropsWithChildren<unknown>> = ({ children }) => (
|
||||||
|
<small className="form-text text-muted d-block">{children}</small>
|
||||||
|
);
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { FC } from 'react';
|
import { FC, PropsWithChildren } from 'react';
|
||||||
import { InputType } from 'reactstrap/types/lib/Input';
|
import { InputType } from 'reactstrap/types/lib/Input';
|
||||||
import { LabeledFormGroup } from './LabeledFormGroup';
|
import { LabeledFormGroup } from './LabeledFormGroup';
|
||||||
|
|
||||||
export interface InputFormGroupProps {
|
export type InputFormGroupProps = PropsWithChildren<{
|
||||||
value: string;
|
value: string;
|
||||||
onChange: (newValue: string) => void;
|
onChange: (newValue: string) => void;
|
||||||
type?: InputType;
|
type?: InputType;
|
||||||
|
@ -10,7 +10,7 @@ export interface InputFormGroupProps {
|
||||||
placeholder?: string;
|
placeholder?: string;
|
||||||
className?: string;
|
className?: string;
|
||||||
labelClassName?: string;
|
labelClassName?: string;
|
||||||
}
|
}>;
|
||||||
|
|
||||||
export const InputFormGroup: FC<InputFormGroupProps> = (
|
export const InputFormGroup: FC<InputFormGroupProps> = (
|
||||||
{ children, value, onChange, type, required, placeholder, className, labelClassName },
|
{ children, value, onChange, type, required, placeholder, className, labelClassName },
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import { FC, ReactNode } from 'react';
|
import { FC, PropsWithChildren, ReactNode } from 'react';
|
||||||
|
|
||||||
interface LabeledFormGroupProps {
|
type LabeledFormGroupProps = PropsWithChildren<{
|
||||||
label: ReactNode;
|
label: ReactNode;
|
||||||
noMargin?: boolean;
|
noMargin?: boolean;
|
||||||
className?: string;
|
className?: string;
|
||||||
labelClassName?: string;
|
labelClassName?: string;
|
||||||
}
|
}>;
|
||||||
|
|
||||||
/* eslint-disable jsx-a11y/label-has-associated-control */
|
/* eslint-disable jsx-a11y/label-has-associated-control */
|
||||||
export const LabeledFormGroup: FC<LabeledFormGroupProps> = (
|
export const LabeledFormGroup: FC<LabeledFormGroupProps> = (
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { useState, useRef, EffectCallback, DependencyList, useEffect } from 'react';
|
import { useState, useRef, EffectCallback, DependencyList, useEffect } from 'react';
|
||||||
import { useSwipeable as useReactSwipeable } from 'react-swipeable';
|
import { useSwipeable as useReactSwipeable } from 'react-swipeable';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
import { parseQuery, stringifyQuery } from './query';
|
|
||||||
import { v4 as uuid } from 'uuid';
|
import { v4 as uuid } from 'uuid';
|
||||||
|
import { parseQuery, stringifyQuery } from './query';
|
||||||
|
|
||||||
const DEFAULT_DELAY = 2000;
|
const DEFAULT_DELAY = 2000;
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
import { Button, Card } from 'reactstrap';
|
import { Button, Card } from 'reactstrap';
|
||||||
import { FC, ReactNode } from 'react';
|
import { FC, PropsWithChildren, ReactNode } from 'react';
|
||||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||||
import { faArrowLeft } from '@fortawesome/free-solid-svg-icons';
|
import { faArrowLeft } from '@fortawesome/free-solid-svg-icons';
|
||||||
import ShortUrlVisitsCount from '../short-urls/helpers/ShortUrlVisitsCount';
|
import ShortUrlVisitsCount from '../short-urls/helpers/ShortUrlVisitsCount';
|
||||||
import { ShortUrl } from '../short-urls/data';
|
import { ShortUrl } from '../short-urls/data';
|
||||||
import { Visit } from './types';
|
import { Visit } from './types';
|
||||||
|
|
||||||
interface VisitsHeaderProps {
|
type VisitsHeaderProps = PropsWithChildren<{
|
||||||
visits: Visit[];
|
visits: Visit[];
|
||||||
goBack: () => void;
|
goBack: () => void;
|
||||||
title: ReactNode;
|
title: ReactNode;
|
||||||
shortUrl?: ShortUrl;
|
shortUrl?: ShortUrl;
|
||||||
}
|
}>;
|
||||||
|
|
||||||
const VisitsHeader: FC<VisitsHeaderProps> = ({ visits, goBack, shortUrl, children, title }) => (
|
const VisitsHeader: FC<VisitsHeaderProps> = ({ visits, goBack, shortUrl, children, title }) => (
|
||||||
<header>
|
<header>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { isEmpty, propEq, values } from 'ramda';
|
import { isEmpty, propEq, values } from 'ramda';
|
||||||
import { useState, useEffect, useMemo, FC, useRef } from 'react';
|
import { useState, useEffect, useMemo, FC, useRef, PropsWithChildren } from 'react';
|
||||||
import { Button, Progress, Row } from 'reactstrap';
|
import { Button, Progress, Row } from 'reactstrap';
|
||||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||||
import { faCalendarAlt, faMapMarkedAlt, faList, faChartPie } from '@fortawesome/free-solid-svg-icons';
|
import { faCalendarAlt, faMapMarkedAlt, faList, faChartPie } from '@fortawesome/free-solid-svg-icons';
|
||||||
|
@ -27,7 +27,7 @@ import { HighlightableProps, highlightedVisitsToStats } from './types/helpers';
|
||||||
import { DoughnutChartCard } from './charts/DoughnutChartCard';
|
import { DoughnutChartCard } from './charts/DoughnutChartCard';
|
||||||
import { SortableBarChartCard } from './charts/SortableBarChartCard';
|
import { SortableBarChartCard } from './charts/SortableBarChartCard';
|
||||||
|
|
||||||
export interface VisitsStatsProps {
|
export type VisitsStatsProps = PropsWithChildren<{
|
||||||
getVisits: (params: VisitsParams, doIntervalFallback?: boolean) => void;
|
getVisits: (params: VisitsParams, doIntervalFallback?: boolean) => void;
|
||||||
visitsInfo: VisitsInfo;
|
visitsInfo: VisitsInfo;
|
||||||
settings: Settings;
|
settings: Settings;
|
||||||
|
@ -36,7 +36,7 @@ export interface VisitsStatsProps {
|
||||||
domain?: string;
|
domain?: string;
|
||||||
exportCsv: (visits: NormalizedVisit[]) => void;
|
exportCsv: (visits: NormalizedVisit[]) => void;
|
||||||
isOrphanVisits?: boolean;
|
isOrphanVisits?: boolean;
|
||||||
}
|
}>;
|
||||||
|
|
||||||
interface VisitsNavLinkProps {
|
interface VisitsNavLinkProps {
|
||||||
title: string;
|
title: string;
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import { Card, CardHeader, CardBody, CardFooter } from 'reactstrap';
|
import { Card, CardHeader, CardBody, CardFooter } from 'reactstrap';
|
||||||
import { FC, ReactNode } from 'react';
|
import { FC, PropsWithChildren, ReactNode } from 'react';
|
||||||
import './ChartCard.scss';
|
import './ChartCard.scss';
|
||||||
|
|
||||||
interface ChartCardProps {
|
type ChartCardProps = PropsWithChildren<{
|
||||||
title: Function | string;
|
title: Function | string;
|
||||||
footer?: ReactNode;
|
footer?: ReactNode;
|
||||||
}
|
}>;
|
||||||
|
|
||||||
export const ChartCard: FC<ChartCardProps> = ({ title, footer, children }) => (
|
export const ChartCard: FC<ChartCardProps> = ({ title, footer, children }) => (
|
||||||
<Card>
|
<Card>
|
||||||
|
|
Loading…
Reference in a new issue