From efbaf13151658873fd3344d52406f4ddeebc606b Mon Sep 17 00:00:00 2001 From: Fedor Katurov Date: Wed, 22 Nov 2023 19:59:17 +0600 Subject: [PATCH] refactor main components and IProps --- src/components/common/ArcProgress/index.tsx | 4 ++-- src/components/common/Authorized/index.tsx | 4 ++-- .../common/BetterScrollDialog/index.tsx | 4 ++-- src/components/common/BlurWrapper/index.tsx | 4 ++-- .../common/BottomContainer/index.tsx | 11 +++++++++++ .../BottomContainer/styles.module.scss | 0 src/components/common/CellGrid/index.tsx | 4 ++-- .../common}/Container/index.tsx | 4 ++-- .../common}/Container/styles.module.scss | 0 src/components/common/CoverBackdrop/index.tsx | 4 ++-- src/components/common/DialogTitle/index.tsx | 4 ++-- src/components/common/Filler/index.tsx | 4 ++-- .../{main => common}/Footer/index.tsx | 4 ++-- .../Footer/styles.module.scss | 0 .../{main => common}/GodRays/index.tsx | 0 src/components/common/Grid/index.tsx | 4 ++-- src/components/common/Group/index.tsx | 4 ++-- src/components/common/Icon/index.tsx | 4 ++-- .../common/InfiniteScroll/index.tsx | 4 ++-- .../components/LoaderCircleInner/index.tsx | 4 ++-- src/components/common/LoaderCircle/index.tsx | 4 ++-- .../{main => common}/Logo/index.tsx | 0 .../{main => common}/Logo/styles.module.scss | 0 .../{main => common}/MainPreloader/index.tsx | 0 .../MainPreloader/styles.module.scss | 0 src/components/common/Markdown/index.tsx | 4 ++-- src/components/common/ModalWrapper/index.tsx | 4 ++-- src/components/common/Padder/index.tsx | 4 ++-- src/components/common/Panel/index.tsx | 4 ++-- src/components/common/Sticky/index.tsx | 4 ++-- src/components/common/Superpower/index.tsx | 4 ++-- src/components/common/TagField/index.tsx | 4 ++-- src/components/input/ButtonGroup/index.tsx | 4 ++-- src/components/input/Textarea/index.tsx | 4 ++-- src/components/input/Toggle/index.tsx | 4 ++-- src/components/node/CommendDeleted/index.tsx | 4 ++-- src/components/node/NodeAudioBlock/index.tsx | 4 ++-- .../node/NodeAudioImageBlock/index.tsx | 4 ++-- .../node/NodeDeletedBadge/index.tsx | 4 ++-- .../node/NodeImageSwiperBlock/index.tsx | 4 ++-- src/components/node/NodeNoComments/index.tsx | 4 ++-- src/components/node/NodeRelated/index.tsx | 4 ++-- .../node/NodeRelated/placeholder.tsx | 4 ++-- .../node/NodeRelatedBlock/index.tsx | 4 ++-- src/components/node/NodeTags/index.tsx | 4 ++-- src/components/node/NodeTagsBlock/index.tsx | 4 ++-- .../node/NodeTagsPlaceholder/index.tsx | 4 ++-- src/components/node/NodeTextBlock/index.tsx | 4 ++-- src/components/node/NodeTitle/index.tsx | 4 ++-- src/components/node/NodeVideoBlock/index.tsx | 4 ++-- .../profile/ProfileAccountsError/index.tsx | 4 ++-- .../profile/ProfileSidebarSettings/index.tsx | 4 ++-- .../sidebar/SidebarWrapper/index.tsx | 4 ++-- .../sidebar/TagSidebarList/index.tsx | 4 ++-- src/components/tags/Tag/index.tsx | 4 ++-- .../tags/TagAutocompleteRow/index.tsx | 9 ++------- src/components/tags/TagWrapper/index.tsx | 4 ++-- src/components/upload/AudioUpload/index.tsx | 10 ++-------- src/components/upload/ImageUpload/index.tsx | 10 ++-------- .../upload/UploadDropzone/index.tsx | 4 ++-- src/components/welcome/PersonsSlide/index.tsx | 2 +- src/components/welcome/WelcomeSlide/index.tsx | 2 +- .../components/LoginDialogButtons/index.tsx | 4 ++-- .../LoginSocialRegisterButtons/index.tsx | 4 ++-- .../components/BorisSuperpowers/index.tsx | 4 ++-- src/containers/boris/BorisComments/index.tsx | 2 +- .../components/BorisStatsBackend/index.tsx | 4 ++-- .../components/BorisStatsGit/index.tsx | 4 ++-- .../components/BorisStatsGitCard/index.tsx | 4 ++-- .../components/BorisStats/index.tsx | 4 ++-- .../CommentFormAttachButtons/index.tsx | 4 ++-- .../CommentFormFormatButtons/index.tsx | 4 ++-- .../components/CommentFormTextarea/index.tsx | 4 ++-- src/containers/comments/CommentForm/index.tsx | 4 ++-- .../comments/CommentWrapper/index.tsx | 4 ++-- .../components/AudioGrid/index.tsx | 4 ++-- .../EditorAudioUploadButton/index.tsx | 4 ++-- .../components/EditorFiller/index.tsx | 4 ++-- .../EditorImageUploadButton/index.tsx | 4 ++-- .../components/EditorPublicSwitch/index.tsx | 4 ++-- .../components/EditorUploadButton/index.tsx | 4 ++-- .../EditorUploadCoverButton/index.tsx | 4 ++-- .../components/EditorConfirmClose/index.tsx | 4 ++-- .../components/ImageEditor/index.tsx | 4 ++-- .../components/ImageGrid/index.tsx | 4 ++-- .../components/TextEditor/index.tsx | 4 ++-- .../components/VideoEditor/index.tsx | 4 ++-- src/containers/dialogs/Modal/index.tsx | 4 ++-- src/containers/dialogs/TestDialog/index.tsx | 4 ++-- .../FlowStamp/components/FlowRecent/index.tsx | 4 ++-- .../components/FlowSearchResults/index.tsx | 4 ++-- src/containers/flow/FlowStamp/index.tsx | 4 ++-- .../LabNode/components/LabImage/index.tsx | 4 ++-- src/containers/lab/LabGrid/index.tsx | 4 ++-- src/containers/lab/LabHead/index.tsx | 4 ++-- .../LabBanner/components/LabSquare/index.tsx | 4 ++-- .../LabStats/components/LabHeroes/index.tsx | 4 ++-- .../lab/LabStats/components/LabTags/index.tsx | 4 ++-- src/containers/lab/LabStats/index.tsx | 4 ++-- src/containers/main/BottomContainer/index.tsx | 19 ------------------- src/containers/main/Header/index.tsx | 2 +- src/containers/main/MainRouter/index.tsx | 4 ++-- src/containers/main/SubmitBarRouter/index.tsx | 4 ++-- .../components}/UserButton/index.tsx | 4 ++-- .../components}/UserButton/styles.module.scss | 0 .../UserButtonWithNotifications/index.tsx | 3 ++- src/containers/node/NodeBottomBlock/index.tsx | 4 ++-- .../components/CommentMenu/index.tsx | 4 ++-- .../components/CommentTextBlock/index.tsx | 4 ++-- .../components/CommentContent/index.tsx | 4 ++-- src/containers/node/NodeComments/index.tsx | 4 ++-- src/containers/profile/ProfileInfo/index.tsx | 4 ++-- .../profile/ProfileLoader/index.tsx | 4 ++-- .../profile/ProfilePageLeft/index.tsx | 4 ++-- src/containers/profile/ProfileTabs/index.tsx | 4 ++-- src/containers/tags/TagInput/index.tsx | 4 ++-- src/containers/tags/Tags/index.tsx | 4 ++-- src/layouts/BorisLayout/index.tsx | 6 +++--- src/layouts/LabLayout/index.tsx | 6 +++--- src/layouts/NodeLayout/index.tsx | 4 ++-- src/layouts/ProfileLayout/index.tsx | 2 +- src/layouts/RoomLayout/index.tsx | 2 +- src/layouts/SettingsLayout/index.tsx | 2 +- src/pages/_app.tsx | 7 +++++-- 124 files changed, 235 insertions(+), 256 deletions(-) create mode 100644 src/components/common/BottomContainer/index.tsx rename src/{containers/main => components/common}/BottomContainer/styles.module.scss (100%) rename src/{containers/main => components/common}/Container/index.tsx (74%) rename src/{containers/main => components/common}/Container/styles.module.scss (100%) rename src/components/{main => common}/Footer/index.tsx (84%) rename src/components/{main => common}/Footer/styles.module.scss (100%) rename src/components/{main => common}/GodRays/index.tsx (100%) rename src/components/{main => common}/Logo/index.tsx (100%) rename src/components/{main => common}/Logo/styles.module.scss (100%) rename src/components/{main => common}/MainPreloader/index.tsx (100%) rename src/components/{main => common}/MainPreloader/styles.module.scss (100%) delete mode 100644 src/containers/main/BottomContainer/index.tsx rename src/{components/main => containers/main/UserButtonWithNotifications/components}/UserButton/index.tsx (88%) rename src/{components/main => containers/main/UserButtonWithNotifications/components}/UserButton/styles.module.scss (100%) diff --git a/src/components/common/ArcProgress/index.tsx b/src/components/common/ArcProgress/index.tsx index 51bdc35a..cb269d0e 100644 --- a/src/components/common/ArcProgress/index.tsx +++ b/src/components/common/ArcProgress/index.tsx @@ -4,12 +4,12 @@ import { describeArc } from '~/utils/dom'; import styles from './styles.module.scss'; -interface IProps { +interface Props { size: number; progress?: number; } -export const ArcProgress: FC = ({ size, progress = 0 }) => ( +export const ArcProgress: FC = ({ size, progress = 0 }) => ( = observer(({ children, hydratedOnly }) => { +const Authorized: FC = observer(({ children, hydratedOnly }) => { const { isUser, fetched } = useAuth(); if (!isUser || (!hydratedOnly && !fetched)) return null; diff --git a/src/components/common/BetterScrollDialog/index.tsx b/src/components/common/BetterScrollDialog/index.tsx index fe9780e1..25d5fdb3 100644 --- a/src/components/common/BetterScrollDialog/index.tsx +++ b/src/components/common/BetterScrollDialog/index.tsx @@ -7,7 +7,7 @@ import { LoaderCircle } from '~/components/common/LoaderCircle'; import styles from './styles.module.scss'; -interface IProps { +interface Props { children: ReactChild; header?: JSX.Element; footer?: JSX.Element; @@ -23,7 +23,7 @@ interface IProps { onClose?: () => void; } -const BetterScrollDialog: FC = ({ +const BetterScrollDialog: FC = ({ children, header, footer, diff --git a/src/components/common/BlurWrapper/index.tsx b/src/components/common/BlurWrapper/index.tsx index f83ed2c4..da935117 100644 --- a/src/components/common/BlurWrapper/index.tsx +++ b/src/components/common/BlurWrapper/index.tsx @@ -4,9 +4,9 @@ import classNames from 'classnames'; import styles from './styles.module.scss'; -type IProps = AllHTMLAttributes & { is_blurred: boolean }; +type Props = AllHTMLAttributes & { is_blurred: boolean }; -export const BlurWrapper: FC = ({ children, is_blurred }) => ( +export const BlurWrapper: FC = ({ children, is_blurred }) => (
{children}
diff --git a/src/components/common/BottomContainer/index.tsx b/src/components/common/BottomContainer/index.tsx new file mode 100644 index 00000000..ed024ff0 --- /dev/null +++ b/src/components/common/BottomContainer/index.tsx @@ -0,0 +1,11 @@ +import styles from './styles.module.scss'; + +const BottomContainer = ({ children }) => ( +
+
+
+
+
+); + +export { BottomContainer }; diff --git a/src/containers/main/BottomContainer/styles.module.scss b/src/components/common/BottomContainer/styles.module.scss similarity index 100% rename from src/containers/main/BottomContainer/styles.module.scss rename to src/components/common/BottomContainer/styles.module.scss diff --git a/src/components/common/CellGrid/index.tsx b/src/components/common/CellGrid/index.tsx index 99fc4c85..2f98d3b2 100644 --- a/src/components/common/CellGrid/index.tsx +++ b/src/components/common/CellGrid/index.tsx @@ -4,12 +4,12 @@ import classNames from 'classnames'; import styles from './styles.module.scss'; -type IProps = HTMLAttributes & { +type Props = HTMLAttributes & { children: any; size: number; }; -const CellGrid: FC = ({ children, size, className, ...props }) => ( +const CellGrid: FC = ({ children, size, className, ...props }) => (
= ({ className, children }) => ( +const Container: FC = ({ className, children }) => (
{children}
); diff --git a/src/containers/main/Container/styles.module.scss b/src/components/common/Container/styles.module.scss similarity index 100% rename from src/containers/main/Container/styles.module.scss rename to src/components/common/Container/styles.module.scss diff --git a/src/components/common/CoverBackdrop/index.tsx b/src/components/common/CoverBackdrop/index.tsx index 4cce6607..abb00e1a 100644 --- a/src/components/common/CoverBackdrop/index.tsx +++ b/src/components/common/CoverBackdrop/index.tsx @@ -8,11 +8,11 @@ import { getURL } from '~/utils/dom'; import styles from './styles.module.scss'; -interface IProps { +interface Props { cover: IUser['cover']; } -const CoverBackdrop: FC = ({ cover }) => { +const CoverBackdrop: FC = ({ cover }) => { const ref = useRef(null); const [is_loaded, setIsLoaded] = useState(false); diff --git a/src/components/common/DialogTitle/index.tsx b/src/components/common/DialogTitle/index.tsx index b5de8560..d1713f95 100644 --- a/src/components/common/DialogTitle/index.tsx +++ b/src/components/common/DialogTitle/index.tsx @@ -2,11 +2,11 @@ import { FC, ReactNode } from 'react'; import styles from './styles.module.scss'; -interface IProps { +interface Props { children: ReactNode; } -const DialogTitle: FC = ({ children }) => ( +const DialogTitle: FC = ({ children }) => (

{children}

); diff --git a/src/components/common/Filler/index.tsx b/src/components/common/Filler/index.tsx index 2f3c6ac7..f41863c3 100644 --- a/src/components/common/Filler/index.tsx +++ b/src/components/common/Filler/index.tsx @@ -4,8 +4,8 @@ import classNames from 'classnames'; import styles from './styles.module.scss'; -type IProps = HTMLAttributes; +type Props = HTMLAttributes; -export const Filler: FC = ({ className = '', ...props }) => ( +export const Filler: FC = ({ className = '', ...props }) => (
); diff --git a/src/components/main/Footer/index.tsx b/src/components/common/Footer/index.tsx similarity index 84% rename from src/components/main/Footer/index.tsx rename to src/components/common/Footer/index.tsx index 1fa4f3ff..fcb770aa 100644 --- a/src/components/main/Footer/index.tsx +++ b/src/components/common/Footer/index.tsx @@ -2,9 +2,9 @@ import { FC, memo } from 'react'; import styles from './styles.module.scss'; -interface IProps {} +interface Props {} -const Footer: FC = memo(() => ( +const Footer: FC = memo(() => (