From 569dd344355d1990877ff60c0989f2bd5ecb8907 Mon Sep 17 00:00:00 2001 From: "plebeius.eth" Date: Fri, 3 Nov 2023 15:30:36 +0100 Subject: [PATCH] refactor: remove FC, not needed --- .../header/account-bar/account-bar.tsx | 4 ++-- src/components/header/header.tsx | 8 +++---- .../header/post-buttons/post-buttons.tsx | 4 ++-- .../header/sort-buttons/sort-buttons.tsx | 4 ++-- src/components/post/embed/embed.tsx | 24 +++++++++---------- .../post/expand-button/expand-button.tsx | 3 +-- src/components/post/expando/expando.tsx | 3 +-- src/components/post/flair/flair.tsx | 3 +-- .../post-tools-label/post-tools-label.tsx | 3 +-- src/components/post/post-tools/post-tools.tsx | 3 +-- src/components/post/post.tsx | 4 ++-- src/components/post/thumbnail/thumbnail.tsx | 3 +-- src/components/reply/reply.tsx | 4 ++-- src/components/topbar/topbar.tsx | 4 ++-- src/views/home/home.tsx | 4 ++-- src/views/post/post.tsx | 4 ++-- 16 files changed, 38 insertions(+), 44 deletions(-) diff --git a/src/components/header/account-bar/account-bar.tsx b/src/components/header/account-bar/account-bar.tsx index b178c47f..33b5a0f4 100644 --- a/src/components/header/account-bar/account-bar.tsx +++ b/src/components/header/account-bar/account-bar.tsx @@ -1,10 +1,10 @@ -import { FC } from 'react'; + import { useTranslation } from 'react-i18next'; import { Link } from 'react-router-dom'; import styles from './account-bar.module.css'; import { useAccount } from '@plebbit/plebbit-react-hooks'; -const AccountBar: FC = () => { +const AccountBar = () => { const account = useAccount(); const { t } = useTranslation(); diff --git a/src/components/header/header.tsx b/src/components/header/header.tsx index aef95e30..0e719bc2 100644 --- a/src/components/header/header.tsx +++ b/src/components/header/header.tsx @@ -1,4 +1,4 @@ -import { FC } from 'react'; + import { Link, useLocation, useParams } from 'react-router-dom'; import { useTranslation } from 'react-i18next'; import styles from './header.module.css'; @@ -11,7 +11,7 @@ import SortButtons from '../header/sort-buttons'; const availableLanguages = ['ar', 'bn', 'cs', 'da', 'de', 'el', 'en', 'es', 'fa', 'fi', 'fil', 'fr', 'he', 'hi', 'hu', 'id', 'it', 'ja', 'ko', 'mr', 'nl', 'no', 'pl', 'pt', 'ro', 'ru', 'sq', 'sv', 'te', 'th', 'tr', 'uk', 'ur', 'vi', 'zh']; // TODO: move to settings page -const Theme: FC = () => { +const Theme = () => { const [theme, setTheme] = useTheme(); const { t } = useTranslation(); @@ -26,7 +26,7 @@ const Theme: FC = () => { }; // TODO: move to settings page -const Language: FC = () => { +const Language = () => { const { i18n } = useTranslation(); const { changeLanguage, language } = i18n; @@ -47,7 +47,7 @@ const Language: FC = () => { ); }; -const Header: FC = () => { +const Header = () => { const [theme] = useTheme(); const { sortType, subplebbitAddress, commentCid } = useParams(); const location = useLocation(); diff --git a/src/components/header/post-buttons/post-buttons.tsx b/src/components/header/post-buttons/post-buttons.tsx index f5c858bd..72263e95 100644 --- a/src/components/header/post-buttons/post-buttons.tsx +++ b/src/components/header/post-buttons/post-buttons.tsx @@ -1,10 +1,10 @@ -import { FC } from 'react'; + import { Link, useParams } from 'react-router-dom'; import styles from './post-buttons.module.css'; import { useTranslation } from 'react-i18next'; import { useSubplebbit } from '@plebbit/plebbit-react-hooks'; -const PostButtons: FC = () => { +const PostButtons = () => { const { t } = useTranslation(); const { subplebbitAddress, commentCid } = useParams(); const subplebbit = useSubplebbit({ subplebbitAddress }); diff --git a/src/components/header/sort-buttons/sort-buttons.tsx b/src/components/header/sort-buttons/sort-buttons.tsx index a3685c02..0203a8ff 100644 --- a/src/components/header/sort-buttons/sort-buttons.tsx +++ b/src/components/header/sort-buttons/sort-buttons.tsx @@ -1,11 +1,11 @@ -import { FC, useEffect, useState } from 'react'; +import { useEffect, useState } from 'react'; import { Link, useParams } from 'react-router-dom'; import { useTranslation } from 'react-i18next'; import styles from './sort-buttons.module.css'; const choices = ['/hot', '/new', '/active', '/controversialAll', '/topAll']; -const SortButtons: FC = () => { +const SortButtons = () => { const { sortType } = useParams<{ sortType: string }>(); const { t } = useTranslation(); const [selected, setSelected] = useState(sortType || '/topMonth'); diff --git a/src/components/post/embed/embed.tsx b/src/components/post/embed/embed.tsx index 92a480e4..cb559973 100644 --- a/src/components/post/embed/embed.tsx +++ b/src/components/post/embed/embed.tsx @@ -1,11 +1,11 @@ -import { FC } from 'react'; + import styles from './embed.module.css'; interface EmbedProps { url: string; } -const Embed: FC = ({ url }) => { +const Embed = ({ url }: EmbedProps) => { const parsedUrl = new URL(url); if (youtubeHosts.has(parsedUrl.host)) { @@ -46,7 +46,7 @@ interface EmbedComponentProps { const youtubeHosts = new Set(['youtube.com', 'www.youtube.com', 'youtu.be', 'www.youtu.be']); -const YoutubeEmbed: FC = ({ parsedUrl }) => { +const YoutubeEmbed = ({ parsedUrl }: EmbedComponentProps) => { let youtubeId; if (parsedUrl.host.endsWith('youtu.be')) { youtubeId = parsedUrl.pathname.replaceAll('/', ''); @@ -69,7 +69,7 @@ const YoutubeEmbed: FC = ({ parsedUrl }) => { const xHosts = new Set(['twitter.com', 'www.twitter.com', 'x.com', 'www.x.com']); -const XEmbed: FC = ({ parsedUrl }) => { +const XEmbed = ({ parsedUrl }: EmbedComponentProps) => { return (