1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-24 20:36:40 +07:00

refactored react imports

This commit is contained in:
Fedor Katurov 2023-11-20 22:35:07 +06:00
parent a9a220273f
commit 7a7b7a4bf9
253 changed files with 679 additions and 479 deletions

View file

@ -1,4 +1,4 @@
import React, { VFC } from 'react'; import { VFC } from 'react';
import NextLink from 'next/link'; import NextLink from 'next/link';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';

View file

@ -1,4 +1,4 @@
import React, { FC } from 'react'; import { FC } from 'react';
import { describeArc } from '~/utils/dom'; import { describeArc } from '~/utils/dom';
@ -11,6 +11,14 @@ interface IProps {
export const ArcProgress: FC<IProps> = ({ size, progress = 0 }) => ( export const ArcProgress: FC<IProps> = ({ size, progress = 0 }) => (
<svg className={styles.icon} width={size} height={size}> <svg className={styles.icon} width={size} height={size}>
<path d={describeArc(size / 2, size / 2, size / 2 - 2, 360 * (1 - progress), 360)} /> <path
d={describeArc(
size / 2,
size / 2,
size / 2 - 2,
360 * (1 - progress),
360,
)}
/>
</svg> </svg>
); );

View file

@ -1,4 +1,4 @@
import React, { FC } from 'react'; import { FC } from 'react';
import { observer } from 'mobx-react-lite'; import { observer } from 'mobx-react-lite';

View file

@ -1,4 +1,4 @@
import React, { forwardRef } from 'react'; import { forwardRef } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';

View file

@ -1,4 +1,4 @@
import React, { FC, MouseEventHandler, useEffect, useRef } from 'react'; import { FC, MouseEventHandler, ReactChild, useEffect, useRef } from 'react';
import { clearAllBodyScrollLocks, disableBodyScroll } from 'body-scroll-lock'; import { clearAllBodyScrollLocks, disableBodyScroll } from 'body-scroll-lock';
@ -8,7 +8,7 @@ import { LoaderCircle } from '~/components/common/LoaderCircle';
import styles from './styles.module.scss'; import styles from './styles.module.scss';
interface IProps { interface IProps {
children: React.ReactChild; children: ReactChild;
header?: JSX.Element; header?: JSX.Element;
footer?: JSX.Element; footer?: JSX.Element;
backdrop?: JSX.Element; backdrop?: JSX.Element;

View file

@ -1,4 +1,4 @@
import React, { AllHTMLAttributes, FC } from 'react'; import { AllHTMLAttributes, FC } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
@ -7,5 +7,7 @@ import styles from './styles.module.scss';
type IProps = AllHTMLAttributes<HTMLDivElement> & { is_blurred: boolean }; type IProps = AllHTMLAttributes<HTMLDivElement> & { is_blurred: boolean };
export const BlurWrapper: FC<IProps> = ({ children, is_blurred }) => ( export const BlurWrapper: FC<IProps> = ({ children, is_blurred }) => (
<div className={classNames(styles.blur, { [styles.is_blurred]: is_blurred })}>{children}</div> <div className={classNames(styles.blur, { [styles.is_blurred]: is_blurred })}>
{children}
</div>
); );

View file

@ -1,4 +1,4 @@
import React, { FC } from 'react'; import { FC } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';

View file

@ -1,4 +1,4 @@
import React, { FC, HTMLAttributes } from 'react'; import { FC, HTMLAttributes } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';

View file

@ -1,4 +1,4 @@
import React, { FC, useEffect, useRef, useState } from 'react'; import { FC, useEffect, useRef, useState } from 'react';
import Masonry from 'react-masonry-css'; import Masonry from 'react-masonry-css';

View file

@ -1,4 +1,4 @@
import React, { FC, useCallback, useEffect, useRef, useState } from 'react'; import { FC, useCallback, useEffect, useRef, useState } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';

View file

@ -1,4 +1,4 @@
import React, { FC, ReactNode } from 'react'; import { FC, ReactNode } from 'react';
import styles from './styles.module.scss'; import styles from './styles.module.scss';
@ -6,6 +6,8 @@ interface IProps {
children: ReactNode; children: ReactNode;
} }
const DialogTitle: FC<IProps> = ({ children }) => <h2 className={styles.title}>{children}</h2>; const DialogTitle: FC<IProps> = ({ children }) => (
<h2 className={styles.title}>{children}</h2>
);
export { DialogTitle }; export { DialogTitle };

View file

@ -1,4 +1,4 @@
import React, { FC } from 'react'; import { FC } from 'react';
import { SVGProps } from '~/utils/types'; import { SVGProps } from '~/utils/types';

View file

@ -1,10 +1,10 @@
import React, { FC } from 'react'; import { FC, HTMLAttributes } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import styles from './styles.module.scss'; import styles from './styles.module.scss';
type IProps = React.HTMLAttributes<HTMLDivElement>; type IProps = HTMLAttributes<HTMLDivElement>;
export const Filler: FC<IProps> = ({ className = '', ...props }) => ( export const Filler: FC<IProps> = ({ className = '', ...props }) => (
<div className={classNames(styles.filler, className)} {...props} /> <div className={classNames(styles.filler, className)} {...props} />

View file

@ -1,10 +1,10 @@
import React, { FC } from 'react'; import { FC, HTMLAttributes } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import styles from './styles.module.scss'; import styles from './styles.module.scss';
type IProps = React.HTMLAttributes<HTMLDivElement> & { type IProps = HTMLAttributes<HTMLDivElement> & {
horizontal?: boolean; horizontal?: boolean;
vertical?: boolean; vertical?: boolean;
columns?: string; columns?: string;
@ -41,7 +41,9 @@ const Grid: FC<IProps> = ({
gridTemplateColumns: square gridTemplateColumns: square
? `repeat(auto-fill, ${(columns !== 'auto' && columns) || size})` ? `repeat(auto-fill, ${(columns !== 'auto' && columns) || size})`
: columns, : columns,
gridTemplateRows: square ? `repeat(auto-fill, ${(rows !== 'auto' && rows) || size})` : rows, gridTemplateRows: square
? `repeat(auto-fill, ${(rows !== 'auto' && rows) || size})`
: rows,
gridAutoRows: rows, gridAutoRows: rows,
gridAutoColumns: columns, gridAutoColumns: columns,
gridRowGap: gap, gridRowGap: gap,

View file

@ -1,10 +1,10 @@
import React, { FC } from 'react'; import { FC, HTMLAttributes } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import styles from './styles.module.scss'; import styles from './styles.module.scss';
type IProps = React.HTMLAttributes<HTMLDivElement> & { type IProps = HTMLAttributes<HTMLDivElement> & {
horizontal?: boolean; horizontal?: boolean;
top?: boolean; top?: boolean;
bottom?: boolean; bottom?: boolean;
@ -33,7 +33,7 @@ const Group: FC<IProps> = ({
[styles.wrap]: wrap, [styles.wrap]: wrap,
[styles.seamless]: seamless, [styles.seamless]: seamless,
}, },
className className,
)} )}
{...props} {...props}
> >

View file

@ -1,4 +1,4 @@
import React, { FC, ReactNode } from 'react'; import { FC, ReactNode } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';

View file

@ -1,15 +1,13 @@
import React, { FC } from 'react'; import { FC, SVGAttributes } from 'react';
import { IIcon } from '~/types'; import { IIcon } from '~/types';
type IProps = React.SVGAttributes<SVGElement> & { type IProps = SVGAttributes<SVGElement> & {
size?: number; size?: number;
icon: IIcon; icon: IIcon;
}; };
export const Icon: FC<IProps> = ({ export const Icon: FC<IProps> = ({ size = 20, icon, style, ...props }) => (
size = 20, icon, style, ...props
}) => (
<svg <svg
width={size} width={size}
height={size} height={size}

View file

@ -1,4 +1,4 @@
import React, { import {
CSSProperties, CSSProperties,
ReactNode, ReactNode,
forwardRef, forwardRef,

View file

@ -1,7 +1,16 @@
import React, { useEffect, useRef, VFC } from 'react'; import {
DetailedHTMLProps,
ImgHTMLAttributes,
useEffect,
useRef,
VFC,
} from 'react';
interface ImgProps interface ImgProps
extends React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement> { extends DetailedHTMLProps<
ImgHTMLAttributes<HTMLImageElement>,
HTMLImageElement
> {
onLoad?: () => void; onLoad?: () => void;
} }

View file

@ -1,4 +1,4 @@
import React, { FC, HTMLAttributes, useCallback, useEffect, useRef } from 'react'; import { FC, HTMLAttributes, useCallback, useEffect, useRef } from 'react';
import styles from './styles.module.scss'; import styles from './styles.module.scss';
@ -8,7 +8,13 @@ interface IProps extends HTMLAttributes<HTMLDivElement> {
loadMore: () => void; loadMore: () => void;
} }
const InfiniteScroll: FC<IProps> = ({ children, hasMore, scrollReactPx, loadMore, ...props }) => { const InfiniteScroll: FC<IProps> = ({
children,
hasMore,
scrollReactPx,
loadMore,
...props
}) => {
const ref = useRef<HTMLDivElement>(null); const ref = useRef<HTMLDivElement>(null);
const onScrollEnd = useCallback( const onScrollEnd = useCallback(
@ -16,7 +22,7 @@ const InfiniteScroll: FC<IProps> = ({ children, hasMore, scrollReactPx, loadMore
if (!hasMore || !entries[0].isIntersecting) return; if (!hasMore || !entries[0].isIntersecting) return;
loadMore(); loadMore();
}, },
[hasMore, loadMore] [hasMore, loadMore],
); );
useEffect(() => { useEffect(() => {

View file

@ -1,4 +1,4 @@
import React, { FC } from 'react'; import { FC } from 'react';
import { useColorFromString } from '~/hooks/color/useColorFromString'; import { useColorFromString } from '~/hooks/color/useColorFromString';

View file

@ -1,4 +1,4 @@
import React, { FC, SVGAttributes } from 'react'; import { FC, SVGAttributes } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
@ -12,7 +12,12 @@ interface IProps extends SVGAttributes<SVGElement> {
} }
const LoaderCircleInner: FC<IProps> = ({ size, className, ...props }) => ( const LoaderCircleInner: FC<IProps> = ({ size, className, ...props }) => (
<svg className={classNames(styles.icon, className)} width={size} height={size} {...props}> <svg
className={classNames(styles.icon, className)}
width={size}
height={size}
{...props}
>
<path d={describeArc(size / 2, size / 2, size / 2, 0, 90)} /> <path d={describeArc(size / 2, size / 2, size / 2, 0, 90)} />
<path d={describeArc(size / 2, size / 2, size / 2, 180, 270)} /> <path d={describeArc(size / 2, size / 2, size / 2, 180, 270)} />
</svg> </svg>

View file

@ -1,4 +1,4 @@
import React, { FC } from 'react'; import { FC } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';

View file

@ -1,4 +1,4 @@
import React, { FC } from 'react'; import { FC } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';

View file

@ -1,4 +1,4 @@
import React, { Fragment, VFC } from 'react'; import { Fragment, VFC } from 'react';
import { useSSRLoadingIndicator } from '~/hooks/dom/useSSRLoadingIndicator'; import { useSSRLoadingIndicator } from '~/hooks/dom/useSSRLoadingIndicator';

View file

@ -1,4 +1,4 @@
import React, { DetailedHTMLProps, VFC, HTMLAttributes } from 'react'; import { DetailedHTMLProps, VFC, HTMLAttributes } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';

View file

@ -1,4 +1,4 @@
import React, { FC, MouseEventHandler } from 'react'; import { FC, MouseEventHandler } from 'react';
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
@ -14,7 +14,7 @@ const ModalWrapper: FC<IProps> = ({ children, onOverlayClick }) => {
<div className={styles.overlay} onClick={onOverlayClick} /> <div className={styles.overlay} onClick={onOverlayClick} />
<div className={styles.content}>{children}</div> <div className={styles.content}>{children}</div>
</div>, </div>,
document.body document.body,
); );
}; };

View file

@ -1,10 +1,10 @@
import React, { FC } from 'react'; import { FC, HTMLAttributes } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import styles from './styles.module.scss'; import styles from './styles.module.scss';
type IProps = React.HTMLAttributes<HTMLDivElement> & { type IProps = HTMLAttributes<HTMLDivElement> & {
padding?: number; padding?: number;
vertical?: boolean; vertical?: boolean;
horizontal?: boolean; horizontal?: boolean;

View file

@ -1,4 +1,4 @@
import React, { VFC } from 'react'; import { VFC } from 'react';
import Head from 'next/head'; import Head from 'next/head';

View file

@ -1,4 +1,4 @@
import React, { FC, HTMLAttributes } from 'react'; import { FC, HTMLAttributes } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
@ -9,8 +9,17 @@ type IProps = HTMLAttributes<HTMLDivElement> & {
stretchy?: boolean; stretchy?: boolean;
}; };
const Panel: FC<IProps> = ({ className, children, seamless, stretchy, ...props }) => ( const Panel: FC<IProps> = ({
<div className={classNames(styles.panel, className, { seamless, stretchy })} {...props}> className,
children,
seamless,
stretchy,
...props
}) => (
<div
className={classNames(styles.panel, className, { seamless, stretchy })}
{...props}
>
{children} {children}
</div> </div>
); );

View file

@ -1,4 +1,4 @@
import React, { FC } from 'react'; import { FC } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';

View file

@ -1,4 +1,4 @@
import React, { VFC } from 'react'; import { VFC } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';

View file

@ -1,4 +1,4 @@
import React, { forwardRef } from 'react'; import { forwardRef } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';

View file

@ -1,15 +1,24 @@
import React, { FC } from 'react'; import { FC } from 'react';
import { Placeholder } from '~/components/placeholders/Placeholder'; import { Placeholder } from '~/components/placeholders/Placeholder';
import styles from './styles.module.scss'; import styles from './styles.module.scss';
const StatsRow: FC<{ isLoading: boolean; label: string }> = ({ isLoading, label, children }) => ( const StatsRow: FC<{ isLoading: boolean; label: string }> = ({
isLoading,
label,
children,
}) => (
<li className={styles.row}> <li className={styles.row}>
{isLoading ? ( {isLoading ? (
<> <>
<Placeholder active={isLoading} loading className={styles.label} /> <Placeholder active={isLoading} loading className={styles.label} />
<Placeholder active={isLoading} loading className={styles.value} width="24px" /> <Placeholder
active={isLoading}
loading
className={styles.value}
width="24px"
/>
</> </>
) : ( ) : (
<> <>

View file

@ -1,4 +1,4 @@
import React, { DetailsHTMLAttributes, FC } from 'react'; import { DetailsHTMLAttributes, FC } from 'react';
import StickyBox from 'react-sticky-box'; import StickyBox from 'react-sticky-box';

View file

@ -1,4 +1,4 @@
import React, { FC } from 'react'; import { FC } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';

View file

@ -1,4 +1,4 @@
import React, { FC } from 'react'; import { FC } from 'react';
import { observer } from 'mobx-react-lite'; import { observer } from 'mobx-react-lite';

View file

@ -1,4 +1,4 @@
import React, { createContext, FC, useContext, useMemo, useState, VFC } from 'react'; import { createContext, FC, useContext, useMemo, useState, VFC } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
@ -20,7 +20,9 @@ const HorizontalList: VFC<TabProps> = ({ items }) => {
<div className={styles.tabs}> <div className={styles.tabs}>
{items.map((it, index) => ( {items.map((it, index) => (
<div <div
className={classNames(styles.tab, { [styles.active]: activeTab === index })} className={classNames(styles.tab, {
[styles.active]: activeTab === index,
})}
onClick={() => setActiveTab(index)} onClick={() => setActiveTab(index)}
key={it} key={it}
> >
@ -38,20 +40,27 @@ const Content: FC<any> = ({ children }) => {
return [children]; return [children];
} }
return children.filter(it => it); return children.filter((it) => it);
}, [children]); }, [children]);
if (Array.isArray(notEmptyChildren) && notEmptyChildren.length - 1 < activeTab) { if (
Array.isArray(notEmptyChildren) &&
notEmptyChildren.length - 1 < activeTab
) {
return notEmptyChildren[notEmptyChildren.length - 1]; return notEmptyChildren[notEmptyChildren.length - 1];
} }
return notEmptyChildren[activeTab]; return notEmptyChildren[activeTab];
}; };
const Tabs = function({ children }) { const Tabs = function ({ children }) {
const [activeTab, setActiveTab] = useState(0); const [activeTab, setActiveTab] = useState(0);
return <TabContext.Provider value={{ activeTab, setActiveTab }}>{children}</TabContext.Provider>; return (
<TabContext.Provider value={{ activeTab, setActiveTab }}>
{children}
</TabContext.Provider>
);
}; };
Tabs.Horizontal = HorizontalList; Tabs.Horizontal = HorizontalList;

View file

@ -1,9 +1,11 @@
import React, { FC, HTMLAttributes } from 'react'; import { FC, HTMLAttributes } from 'react';
import styles from './styles.module.scss'; import styles from './styles.module.scss';
type IProps = HTMLAttributes<HTMLDivElement> & {}; type IProps = HTMLAttributes<HTMLDivElement> & {};
const TagField: FC<IProps> = ({ children }) => <div className={styles.wrap}>{children}</div>; const TagField: FC<IProps> = ({ children }) => (
<div className={styles.wrap}>{children}</div>
);
export { TagField }; export { TagField };

View file

@ -1,4 +1,4 @@
import React, { FC } from 'react'; import { FC } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';

View file

@ -1,4 +1,4 @@
import React, { FC, useMemo } from 'react'; import { FC, useMemo } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import { transparentize } from 'color2k'; import { transparentize } from 'color2k';

View file

@ -1,4 +1,4 @@
import React, { FC, useMemo } from 'react'; import { FC, useMemo } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';

View file

@ -1,4 +1,4 @@
import React, { FC } from 'react'; import { FC } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import Image from 'next/image'; import Image from 'next/image';

View file

@ -1,4 +1,4 @@
import React, { FC } from 'react'; import { FC } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import LazyLoad from 'react-lazyload'; import LazyLoad from 'react-lazyload';

View file

@ -1,4 +1,4 @@
import React, { FC } from 'react'; import { FC } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';

View file

@ -1,4 +1,4 @@
import React, { FC, ReactElement } from 'react'; import { FC, ReactElement } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';

View file

@ -1,4 +1,4 @@
import React, { FC, Fragment } from 'react'; import { FC, Fragment } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import { observer } from 'mobx-react-lite'; import { observer } from 'mobx-react-lite';

View file

@ -1,4 +1,4 @@
import React, { FC } from 'react'; import { FC } from 'react';
import { IFlowNode } from '~/types'; import { IFlowNode } from '~/types';
@ -15,11 +15,15 @@ const FlowRecent: FC<IProps> = ({ recent, updated }) => {
return ( return (
<> <>
<div className={styles.updates}> <div className={styles.updates}>
{updated && updated.map(node => <FlowRecentItem node={node} key={node.id} has_new />)} {updated &&
updated.map((node) => (
<FlowRecentItem node={node} key={node.id} has_new />
))}
</div> </div>
<div className={styles.recent}> <div className={styles.recent}>
{recent && recent.map(node => <FlowRecentItem node={node} key={node.id} />)} {recent &&
recent.map((node) => <FlowRecentItem node={node} key={node.id} />)}
</div> </div>
</> </>
); );

View file

@ -1,4 +1,4 @@
import React, { FC } from 'react'; import { FC } from 'react';
import { Icon } from '~/components/common/Icon'; import { Icon } from '~/components/common/Icon';
import { InfiniteScroll } from '~/components/common/InfiniteScroll'; import { InfiniteScroll } from '~/components/common/InfiniteScroll';

View file

@ -1,4 +1,4 @@
import React, { FC, useCallback, useMemo, useState } from 'react'; import { FC, useCallback, useMemo, useState } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import Image from 'next/future/image'; import Image from 'next/future/image';

View file

@ -1,4 +1,4 @@
import React, { import {
ButtonHTMLAttributes, ButtonHTMLAttributes,
DetailedHTMLProps, DetailedHTMLProps,
FC, FC,

View file

@ -1,4 +1,4 @@
import React, { HTMLAttributes } from 'react'; import { HTMLAttributes } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';

View file

@ -1,4 +1,4 @@
import React, { FC, ReactNode } from 'react'; import { FC, ReactNode } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';

View file

@ -1,4 +1,4 @@
import React, { import {
ChangeEvent, ChangeEvent,
DetailedHTMLProps, DetailedHTMLProps,
FC, FC,

View file

@ -1,4 +1,4 @@
import React, { FC } from 'react'; import { FC } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
@ -11,7 +11,13 @@ interface InputWrapperProps {
notEmpty: boolean; notEmpty: boolean;
} }
const InputWrapper: FC<InputWrapperProps> = ({ children, notEmpty, title, focused, error }) => ( const InputWrapper: FC<InputWrapperProps> = ({
children,
notEmpty,
title,
focused,
error,
}) => (
<div <div
className={classNames(styles.content, { className={classNames(styles.content, {
[styles.has_error]: !!error, [styles.has_error]: !!error,

View file

@ -1,4 +1,4 @@
import React, { FC } from 'react'; import { FC } from 'react';
import { Button } from '~/components/input/Button'; import { Button } from '~/components/input/Button';
@ -10,9 +10,15 @@ interface LoadMoreButtonProps {
} }
const LoadMoreButton: FC<LoadMoreButtonProps> = ({ isLoading, onClick }) => ( const LoadMoreButton: FC<LoadMoreButtonProps> = ({ isLoading, onClick }) => (
<Button color="flat" onClick={onClick} stretchy className={styles.more} loading={isLoading}> <Button
color="flat"
onClick={onClick}
stretchy
className={styles.more}
loading={isLoading}
>
Показать ещё комментарии Показать ещё комментарии
</Button> </Button>
); );
export { LoadMoreButton } export { LoadMoreButton };

View file

@ -1,4 +1,4 @@
import React, { VFC } from 'react'; import { VFC } from 'react';
import { Icon } from '~/components/common/Icon'; import { Icon } from '~/components/common/Icon';
import { InputText, InputTextProps } from '~/components/input/InputText'; import { InputText, InputTextProps } from '~/components/input/InputText';

View file

@ -1,11 +1,11 @@
import React, { import {
ChangeEvent, ChangeEvent,
DetailedHTMLProps, DetailedHTMLProps,
forwardRef, forwardRef,
TextareaHTMLAttributes, TextareaHTMLAttributes,
useCallback, useCallback,
useEffect, useEffect,
useState useState,
} from 'react'; } from 'react';
import autosize from 'autosize'; import autosize from 'autosize';
@ -42,14 +42,14 @@ const Textarea = forwardRef<HTMLTextAreaElement, IProps>(
value, value,
...props ...props
}, },
forwardRef forwardRef,
) => { ) => {
const ref = useForwardRef(forwardRef); const ref = useForwardRef(forwardRef);
const [focused, setFocused] = useState(false); const [focused, setFocused] = useState(false);
const onInput = useCallback( const onInput = useCallback(
({ target }: ChangeEvent<HTMLTextAreaElement>) => handler(target.value), ({ target }: ChangeEvent<HTMLTextAreaElement>) => handler(target.value),
[handler] [handler],
); );
const onFocus = useCallback(() => setFocused(true), [setFocused]); const onFocus = useCallback(() => setFocused(true), [setFocused]);
@ -68,7 +68,12 @@ const Textarea = forwardRef<HTMLTextAreaElement, IProps>(
}, [ref, value, forwardRef]); }, [ref, value, forwardRef]);
return ( return (
<InputWrapper title={title} error={error} focused={focused} notEmpty={!!value}> <InputWrapper
title={title}
error={error}
focused={focused}
notEmpty={!!value}
>
<textarea <textarea
{...props} {...props}
ref={ref} ref={ref}
@ -85,7 +90,7 @@ const Textarea = forwardRef<HTMLTextAreaElement, IProps>(
/> />
</InputWrapper> </InputWrapper>
); );
} },
); );
export { Textarea }; export { Textarea };

View file

@ -1,4 +1,4 @@
import React, { FC, useCallback } from 'react'; import { FC, useCallback } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
@ -31,7 +31,7 @@ const Toggle: FC<IProps> = ({ value, handler, color = 'primary', ...rest }) => {
styles.toggle, styles.toggle,
{ [styles.active]: value }, { [styles.active]: value },
styles[color], styles[color],
rest.className rest.className,
)} )}
onClick={onClick} onClick={onClick}
/> />

View file

@ -1,4 +1,4 @@
import React, { FC } from 'react'; import { FC } from 'react';
import { NodeAudioBlock } from '~/components/node/NodeAudioBlock'; import { NodeAudioBlock } from '~/components/node/NodeAudioBlock';
import { Placeholder } from '~/components/placeholders/Placeholder'; import { Placeholder } from '~/components/placeholders/Placeholder';

View file

@ -1,4 +1,4 @@
import React, { FC } from 'react'; import { FC } from 'react';
import { Group } from '~/components/common/Group'; import { Group } from '~/components/common/Group';
import { LabSquare } from '~/components/lab/LabSquare'; import { LabSquare } from '~/components/lab/LabSquare';

View file

@ -1,4 +1,4 @@
import React, { FC, useCallback } from 'react'; import { FC, useCallback } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';

View file

@ -1,4 +1,4 @@
import React, { FC } from 'react'; import { FC } from 'react';
import { Markdown } from '~/components/common/Markdown'; import { Markdown } from '~/components/common/Markdown';
import { Paragraph } from '~/components/placeholders/Paragraph'; import { Paragraph } from '~/components/placeholders/Paragraph';

View file

@ -1,4 +1,4 @@
import React, { useRef } from 'react'; import { useRef } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';

View file

@ -1,4 +1,4 @@
import React, { FC } from 'react'; import { FC } from 'react';
import { Filler } from '~/components/common/Filler'; import { Filler } from '~/components/common/Filler';
import { SearchInput } from '~/components/input/SearchInput'; import { SearchInput } from '~/components/input/SearchInput';

View file

@ -1,4 +1,4 @@
import React, { FC, useCallback } from 'react'; import { FC, useCallback } from 'react';
import { Group } from '~/components/common/Group'; import { Group } from '~/components/common/Group';
import { Icon } from '~/components/common/Icon'; import { Icon } from '~/components/common/Icon';

View file

@ -1,4 +1,4 @@
import React, { FC } from 'react'; import { FC } from 'react';
import { Group } from '~/components/common/Group'; import { Group } from '~/components/common/Group';
import { LabHero } from '~/components/lab/LabHero'; import { LabHero } from '~/components/lab/LabHero';

View file

@ -1,4 +1,4 @@
import React, { FC } from 'react'; import { FC } from 'react';
import Image from 'next/future/image'; import Image from 'next/future/image';

View file

@ -1,4 +1,4 @@
import React, { FC } from 'react'; import { FC } from 'react';
import { NodeComponentProps } from '~/constants/node'; import { NodeComponentProps } from '~/constants/node';
import { useColorGradientFromString } from '~/hooks/color/useColorGradientFromString'; import { useColorGradientFromString } from '~/hooks/color/useColorGradientFromString';

View file

@ -1,4 +1,4 @@
import React, { VFC } from 'react'; import { VFC } from 'react';
import { Card } from '~/components/common/Card'; import { Card } from '~/components/common/Card';
import { Button } from '~/components/input/Button'; import { Button } from '~/components/input/Button';

View file

@ -1,4 +1,4 @@
import React, { FC, useMemo } from 'react'; import { FC, useMemo } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import { isAfter, parseISO } from 'date-fns'; import { isAfter, parseISO } from 'date-fns';
@ -10,7 +10,6 @@ import { INode } from '~/types';
import styles from './styles.module.scss'; import styles from './styles.module.scss';
interface IProps { interface IProps {
node: INode; node: INode;
lastSeen: string | null | undefined; lastSeen: string | null | undefined;
@ -23,8 +22,10 @@ const LabNode: FC<IProps> = ({ node, isLoading, lastSeen, commentCount }) => {
const hasNewComments = useMemo( const hasNewComments = useMemo(
() => () =>
!!node.commented_at && !!lastSeen && isAfter(parseISO(node.commented_at), parseISO(lastSeen)), !!node.commented_at &&
[node.commented_at, lastSeen] !!lastSeen &&
isAfter(parseISO(node.commented_at), parseISO(lastSeen)),
[node.commented_at, lastSeen],
); );
const background = useColorGradientFromString(node.title, 3, 2); const background = useColorGradientFromString(node.title, 3, 2);

View file

@ -1,4 +1,4 @@
import React, { FC } from 'react'; import { FC } from 'react';
import Tippy from '@tippyjs/react'; import Tippy from '@tippyjs/react';

View file

@ -1,4 +1,4 @@
import React, { FC } from 'react'; import { FC } from 'react';
import { NodeComponentProps } from '~/constants/node'; import { NodeComponentProps } from '~/constants/node';
import { useGotoNode } from '~/hooks/node/useGotoNode'; import { useGotoNode } from '~/hooks/node/useGotoNode';

View file

@ -1,4 +1,4 @@
import React, { FC } from 'react'; import { FC } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';

View file

@ -1,4 +1,4 @@
import React, { FC } from 'react'; import { FC } from 'react';
import { Placeholder } from '~/components/placeholders/Placeholder'; import { Placeholder } from '~/components/placeholders/Placeholder';
import { Tag } from '~/components/tags/Tag'; import { Tag } from '~/components/tags/Tag';
@ -27,7 +27,7 @@ const LabTags: FC<IProps> = ({ tags, isLoading }) => {
return ( return (
<div className={styles.tags}> <div className={styles.tags}>
{tags.slice(0, 10).map(tag => ( {tags.slice(0, 10).map((tag) => (
<Tag tag={tag} key={tag.ID} /> <Tag tag={tag} key={tag.ID} />
))} ))}
</div> </div>

View file

@ -1,4 +1,4 @@
import React, { FC, useMemo } from 'react'; import { FC, useMemo } from 'react';
import { Markdown } from '~/components/common/Markdown'; import { Markdown } from '~/components/common/Markdown';
import { Paragraph } from '~/components/placeholders/Paragraph'; import { Paragraph } from '~/components/placeholders/Paragraph';

View file

@ -1,4 +1,4 @@
import React, { FC } from 'react'; import { FC } from 'react';
import { NodeVideoBlock } from '~/components/node/NodeVideoBlock'; import { NodeVideoBlock } from '~/components/node/NodeVideoBlock';
import { Placeholder } from '~/components/placeholders/Placeholder'; import { Placeholder } from '~/components/placeholders/Placeholder';

View file

@ -1,4 +1,4 @@
import React, { FC, memo } from 'react'; import { FC, memo } from 'react';
import styles from './styles.module.scss'; import styles from './styles.module.scss';

View file

@ -1,10 +1,10 @@
import * as React from 'react'; import { Component } from 'react';
interface IGodRaysProps { interface IGodRaysProps {
raised?: boolean; raised?: boolean;
} }
export class GodRays extends React.Component<IGodRaysProps> { export class GodRays extends Component<IGodRaysProps> {
state = { state = {
width: 0, width: 0,
height: 0, height: 0,
@ -42,7 +42,8 @@ export class GodRays extends React.Component<IGodRaysProps> {
ctx.clearRect(0, 0, width, height + 100); // clear canvas ctx.clearRect(0, 0, width, height + 100); // clear canvas
ctx.save(); ctx.save();
rays.forEach(({ angle, iterator, weight, speed, pulsar, opacity }, index) => { rays.forEach(
({ angle, iterator, weight, speed, pulsar, opacity }, index) => {
const gradient = ctx.createLinearGradient(0, 0, 0, height * 1.3); const gradient = ctx.createLinearGradient(0, 0, 0, height * 1.3);
gradient.addColorStop(0.2, `rgba(160, 255, 60, ${opacity * 0.1})`); gradient.addColorStop(0.2, `rgba(160, 255, 60, ${opacity * 0.1})`);
gradient.addColorStop(1, 'rgba(160, 255, 60, 0)'); gradient.addColorStop(1, 'rgba(160, 255, 60, 0)');
@ -84,7 +85,8 @@ export class GodRays extends React.Component<IGodRaysProps> {
if (rays[index].opacity <= 0) rays[index].pulsar = 1; if (rays[index].opacity <= 0) rays[index].pulsar = 1;
ctx.restore(); ctx.restore();
}); },
);
setTimeout(() => window.requestAnimationFrame(this.draw), 1000 / 15); setTimeout(() => window.requestAnimationFrame(this.draw), 1000 / 15);
}; };
@ -119,7 +121,7 @@ export class GodRays extends React.Component<IGodRaysProps> {
position: 'relative', position: 'relative',
top: -100, top: -100,
}} }}
ref={el => { ref={(el) => {
this.canvas = el; this.canvas = el;
}} }}
/> />

View file

@ -1,5 +1,3 @@
import React from 'react';
import { Anchor } from '~/components/common/Anchor'; import { Anchor } from '~/components/common/Anchor';
import { URLS } from '~/constants/urls'; import { URLS } from '~/constants/urls';

View file

@ -1,4 +1,4 @@
import React, { VFC } from 'react'; import { VFC } from 'react';
interface MainPreloaderProps {} interface MainPreloaderProps {}

View file

@ -1,4 +1,4 @@
import React, { memo, useCallback, useMemo } from 'react'; import { memo, useCallback, useMemo } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';

View file

@ -1,10 +1,4 @@
import React, { import { FC, MouseEventHandler, useCallback, useMemo, useState } from 'react';
FC,
MouseEventHandler,
useCallback,
useMemo,
useState,
} from 'react';
import classNames from 'classnames'; import classNames from 'classnames';

View file

@ -1,4 +1,4 @@
import React, { useCallback, useState, VFC } from 'react'; import { useCallback, useState, VFC } from 'react';
import { MenuDots } from '~/components/menu/MenuDots'; import { MenuDots } from '~/components/menu/MenuDots';

View file

@ -1,4 +1,4 @@
import React, { PropsWithChildren } from 'react'; import { PropsWithChildren } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';

View file

@ -1,4 +1,4 @@
import React, { FC, ReactNode, useEffect, useState } from 'react'; import { FC, ReactNode, useEffect, useState } from 'react';
import { Placement } from '@popperjs/core'; import { Placement } from '@popperjs/core';
import classNames from 'classnames'; import classNames from 'classnames';

View file

@ -1,4 +1,4 @@
import React, { FC } from 'react'; import { FC } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';

View file

@ -1,4 +1,4 @@
import React, { FC } from 'react'; import { FC } from 'react';
import { Icon } from '~/components/common/Icon'; import { Icon } from '~/components/common/Icon';

View file

@ -1,4 +1,4 @@
import React, { FC, ReactNode, useMemo } from 'react'; import { FC, ReactNode, useMemo } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';

View file

@ -1,4 +1,4 @@
import React, { FC } from 'react'; import { FC } from 'react';
import { Icon } from '~/components/common/Icon'; import { Icon } from '~/components/common/Icon';
import { WithDescription } from '~/components/common/WithDescription'; import { WithDescription } from '~/components/common/WithDescription';

View file

@ -1,4 +1,4 @@
import React, { FC, useCallback } from 'react'; import { FC, useCallback } from 'react';
import { Button } from '~/components/input/Button'; import { Button } from '~/components/input/Button';
import { IComment } from '~/types'; import { IComment } from '~/types';

View file

@ -1,4 +1,4 @@
import React, { FC } from 'react'; import { FC } from 'react';
import { AudioPlayer } from '~/components/media/AudioPlayer'; import { AudioPlayer } from '~/components/media/AudioPlayer';
import { NodeComponentProps } from '~/constants/node'; import { NodeComponentProps } from '~/constants/node';

View file

@ -1,4 +1,4 @@
import React, { FC } from 'react'; import { FC } from 'react';
import { NodeComponentProps } from '~/constants/node'; import { NodeComponentProps } from '~/constants/node';
import { imagePresets } from '~/constants/urls'; import { imagePresets } from '~/constants/urls';

View file

@ -1,4 +1,4 @@
import React, { FC } from 'react'; import { FC } from 'react';
import { Avatar } from '~/components/common/Avatar'; import { Avatar } from '~/components/common/Avatar';
import { Card } from '~/components/common/Card'; import { Card } from '~/components/common/Card';

View file

@ -1,11 +1,15 @@
import React, { FC } from 'react'; import { FC } from 'react';
import styles from './styles.module.scss'; import styles from './styles.module.scss';
interface IProps {} interface IProps {}
const NodeDeletedBadge: FC<IProps> = () => { const NodeDeletedBadge: FC<IProps> = () => {
return <div className={styles.badge}>Эта ячейка заблокирована. Её не никто не увидит.</div>; return (
<div className={styles.badge}>
Эта ячейка заблокирована. Её не никто не увидит.
</div>
);
}; };
export { NodeDeletedBadge }; export { NodeDeletedBadge };

View file

@ -1,4 +1,4 @@
import React, { VFC } from 'react'; import { VFC } from 'react';
import Tippy from '@tippyjs/react'; import Tippy from '@tippyjs/react';

View file

@ -1,4 +1,4 @@
import React, { VFC } from 'react'; import { VFC } from 'react';
import Head from 'next/head'; import Head from 'next/head';
@ -20,7 +20,10 @@ const NodeHeadMetadata: VFC<NodeHeadMetadataProps> = () => {
<meta property="og:title" content={node.title} /> <meta property="og:title" content={node.title} />
<meta property="og:type" content={node.type} /> <meta property="og:type" content={node.type} />
<meta property="og:image" content={getURLFromString(node.thumbnail)} /> <meta property="og:image" content={getURLFromString(node.thumbnail)} />
<meta property="og:image:secure_url" content={getURLFromString(node.thumbnail)} /> <meta
property="og:image:secure_url"
content={getURLFromString(node.thumbnail)}
/>
<meta property="og:image:type" content="image/jpeg" /> <meta property="og:image:type" content="image/jpeg" />
<meta property="og:image:alt" content={node.description} /> <meta property="og:image:alt" content={node.description} />
<meta property="og:description" content={node.description} /> <meta property="og:description" content={node.description} />

View file

@ -1,4 +1,4 @@
import React, { FC } from 'react'; import { FC } from 'react';
import { LoaderCircle } from '~/components/common/LoaderCircle'; import { LoaderCircle } from '~/components/common/LoaderCircle';

View file

@ -1,4 +1,4 @@
import React, { FC } from 'react'; import { FC } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';

View file

@ -1,4 +1,4 @@
import React, { FC, useMemo } from 'react'; import { FC, useMemo } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';

Some files were not shown because too many files have changed in this diff Show more