diff --git a/src/common/component/AvatarOld.tsx b/src/common/component/AvatarOld.tsx deleted file mode 100644 index 67c14b9c..00000000 --- a/src/common/component/AvatarOld.tsx +++ /dev/null @@ -1,43 +0,0 @@ -import { useState, useEffect, memo, SyntheticEvent, FC, ImgHTMLAttributes } from "react"; -import { getInitials, getInitialsAvatar } from "../utils"; - -interface Props extends ImgHTMLAttributes { - // className?: string; - // alt?: string; - // src?: string; - name?: string; - type?: "user" | "channel"; -} - -const Avatar: FC = ({ src = "", name = "Deleted User", type = "user", ...rest }) => { - const [url, setUrl] = useState(""); - const handleError = (err: SyntheticEvent) => { - console.error("load avatar error", err); - const tmp = getInitialsAvatar({ - initials: getInitials(name), - background: type == "channel" ? "#EAECF0" : undefined, - foreground: type == "channel" ? "#475467" : undefined - }); - setUrl(tmp); - }; - - useEffect(() => { - if (!src) { - const tmp = getInitialsAvatar({ - initials: getInitials(name), - background: type == "channel" ? "#EAECF0" : undefined, - foreground: type == "channel" ? "#475467" : undefined - }); - setUrl(tmp); - } else { - setUrl(src); - } - }, [src, name]); - if (!url) return null; - - return ; -}; - -export default memo(Avatar, (prev, next) => { - return prev.src == next.src; -}); diff --git a/src/common/component/Divider.tsx b/src/common/component/Divider.tsx index 66472677..82362737 100644 --- a/src/common/component/Divider.tsx +++ b/src/common/component/Divider.tsx @@ -1,36 +1,12 @@ -import styled from "styled-components"; import { FC } from "react"; - -const StyledDivider = styled.hr` - display: block; - position: relative; - border: 0; - border-top: 1px solid #e3e5e8; - margin: 25px 0; - overflow: visible; - &:before { - background: #fff; - padding: 2px 4px; - position: absolute; - left: 50%; - top: 50%; - transform: translate3d(-50%, -50%, 0); - content: attr(data-content); - font-style: normal; - font-weight: 600; - font-size: 12px; - line-height: 18px; - color: #78787c; - } -`; - interface Props { content: string; } const Divider: FC = ({ content }) => { - if (!content) return null; - return ; + return
+ {content} +
; }; export default Divider; diff --git a/src/common/component/FileBox/preview/Audio.tsx b/src/common/component/FileBox/preview/Audio.tsx index 32c7f58c..ebd5a078 100644 --- a/src/common/component/FileBox/preview/Audio.tsx +++ b/src/common/component/FileBox/preview/Audio.tsx @@ -1,21 +1,4 @@ import { FC, ReactEventHandler, useState } from "react"; -import styled from "styled-components"; - -const Styled = styled.div` - height: 100%; - display: flex; - justify-content: center; - align-items: center; - .err { - padding: 18px; - /* font-weight: bold; */ - font-size: 16px; - color: #999; - } - audio { - width: 100%; - } -`; interface Props { url: string; @@ -31,13 +14,13 @@ const Audio: FC = ({ url }) => { if (!url) return null; return ( - +
{err ? ( -
Unable to play this audio
+
Unable to play this audio
) : ( -
); }; diff --git a/src/common/component/FileBox/preview/Code.tsx b/src/common/component/FileBox/preview/Code.tsx index 625e4b46..c3a10c12 100644 --- a/src/common/component/FileBox/preview/Code.tsx +++ b/src/common/component/FileBox/preview/Code.tsx @@ -1,16 +1,4 @@ import { useState, useEffect, FC } from "react"; -import styled from "styled-components"; - -const Styled = styled.div` - height: 218px; - padding: 15px 15px 0 15px; - line-height: 1.4; - overflow: scroll; - white-space: pre-wrap; - word-break: break-all; - background-color: #000; - color: #eee; -`; interface Props { url: string; @@ -29,7 +17,7 @@ const Code: FC = ({ url }) => { }, [url]); if (!content) return null; - return {content}; + return
{content}
; }; export default Code; diff --git a/src/common/component/FileBox/preview/Image.tsx b/src/common/component/FileBox/preview/Image.tsx index b93d25d1..bf60c144 100644 --- a/src/common/component/FileBox/preview/Image.tsx +++ b/src/common/component/FileBox/preview/Image.tsx @@ -1,27 +1,14 @@ import React, { FC } from "react"; -import styled from "styled-components"; - -const Styled = styled.div` - height: 218px; - overflow: hidden; - img { - width: 100%; - height: 100%; - object-fit: cover; - } -`; - interface Props { url: string; alt?: string; } const Image: FC = ({ url, alt }) => { - if (!url) return null; return ( - - {alt} - +
+ {alt} +
); }; diff --git a/src/common/component/FileBox/preview/Pdf.tsx b/src/common/component/FileBox/preview/Pdf.tsx index 8421f91c..daf4edde 100644 --- a/src/common/component/FileBox/preview/Pdf.tsx +++ b/src/common/component/FileBox/preview/Pdf.tsx @@ -1,34 +1,14 @@ -import styled from "styled-components"; import { FC } from "react"; -const Styled = styled.div` - padding: 8px; - /* height: 218px; */ - overflow: hidden; - embed { - width: 100%; - height: 100%; - } -`; - interface Props { url: string; } const Pdf: FC = ({ url }) => { - // const [content, setContent] = useState(""); - // const [pageNumber, setPageNumber] = useState(1); - // const [numPages, setNumPages] = useState(null); - // const onDocumentLoadSuccess = ({ numPages }) => { - // setNumPages(numPages); - // }; return ( - - - {/* - - */} - +
+ +
); }; diff --git a/src/common/component/FileBox/preview/Video.tsx b/src/common/component/FileBox/preview/Video.tsx index c1507e79..db412592 100644 --- a/src/common/component/FileBox/preview/Video.tsx +++ b/src/common/component/FileBox/preview/Video.tsx @@ -1,24 +1,13 @@ import React, { FC } from "react"; -import styled from "styled-components"; - -const Styled = styled.div` - height: 218px; - video { - width: 100%; - height: 100%; - object-fit: cover; - } -`; - interface Props { url: string; } const Video: FC = ({ url }) => { return ( - - +
+
); }; diff --git a/src/common/component/FileMessage/Progress.tsx b/src/common/component/FileMessage/Progress.tsx index 019e391c..534d4411 100644 --- a/src/common/component/FileMessage/Progress.tsx +++ b/src/common/component/FileMessage/Progress.tsx @@ -1,19 +1,4 @@ import { FC } from "react"; -import styled from "styled-components"; - -const Styled = styled.div` - background: #ecfdff; - border-radius: 4px; - height: 8px; - overflow: hidden; - .progress { - transition: all 0.25s ease; - height: 8px; - background: #088ab2; - border-radius: 4px; - } -`; - interface Props { value: number; width?: string; @@ -21,9 +6,9 @@ interface Props { const Progress: FC = ({ value, width = "100%" }) => { return ( - -
-
+
+
+
); }; diff --git a/src/common/component/InviteModal/index.tsx b/src/common/component/InviteModal/index.tsx index 95fb8d70..abe9897d 100644 --- a/src/common/component/InviteModal/index.tsx +++ b/src/common/component/InviteModal/index.tsx @@ -1,4 +1,3 @@ -import styled from "styled-components"; import InviteByEmail from "./InviteByEmail"; import AddMembers from "./AddMembers"; import CloseIcon from "../../../assets/icons/close.svg"; @@ -7,28 +6,6 @@ import { useAppSelector } from "../../../app/store"; import { FC } from "react"; import { useTranslation } from "react-i18next"; -const Styled = styled.div` - display: flex; - flex-direction: column; - background: #fff; - box-shadow: 0 25px 50px rgba(31, 41, 55, 0.25); - border-radius: var(--br); - padding: 16px; - min-width: 408px; - > .title { - display: flex; - align-items: center; - justify-content: space-between; - font-style: normal; - font-weight: 600; - font-size: 18px; - line-height: 28px; - color: #374151; - .close { - cursor: pointer; - } - } -`; interface Props { type?: "server" | "channel"; @@ -48,14 +25,14 @@ const InviteModal: FC = ({ type = "server", cid, title = "", closeModal } const finalTitle = type == "server" ? server.name : `#${title || channel?.name}`; return ( - -

+
+

{t("invite_title", { name: finalTitle })} - +

{!channel?.is_public && } - +
); }; diff --git a/src/common/component/ManageMembers/styled.js b/src/common/component/ManageMembers/styled.tsx similarity index 100% rename from src/common/component/ManageMembers/styled.js rename to src/common/component/ManageMembers/styled.tsx diff --git a/src/common/component/Server.tsx b/src/common/component/Server.tsx index ad3846da..4c122cac 100644 --- a/src/common/component/Server.tsx +++ b/src/common/component/Server.tsx @@ -1,4 +1,3 @@ -import styled from "styled-components"; import { NavLink, useLocation } from "react-router-dom"; import Tippy from "@tippyjs/react"; import addIcon from "../../assets/icons/add.svg?url"; @@ -7,50 +6,6 @@ import AddEntriesMenu from "./AddEntriesMenu"; import { useAppSelector } from "../../app/store"; import { useTranslation } from "react-i18next"; -const StyledWrapper = styled.div` - min-height: 56px; - position: relative; - padding: 10px 16px; - display: flex; - align-items: center; - justify-content: space-between; - gap: 8px; - .server { - display: flex; - align-items: center; - gap: 8px; - .logo { - width: 32px; - height: 32px; - img { - width: 100%; - height: 100%; - object-fit: cover; - border-radius: 50%; - } - } - .info { - display: flex; - flex-direction: column; - gap: 4px; - .name { - font-weight: 700; - font-size: 14px; - line-height: 100%; - color: #374151; - } - .desc { - font-weight: 400; - font-size: 12px; - line-height: 100%; - color: #78787c; - } - } - } - .add { - cursor: pointer; - } -`; type Props = { readonly?: boolean; }; @@ -67,42 +22,42 @@ export default function Server({ readonly = false }: Props) { const { name, description, logo } = server; if (readonly) return ( - -
-
- {`${name} +
+
+
+ {`${name}
-
-

+
+

{name}

- {userCount} {t("members")} + {userCount} {t("members")}

- +
); return ( - +
-
-
- {`${name} +
+
+ {`${name}
-
-

+
+

{name}

- {userCount} {t("members")} + {userCount} {t("members")}

}> - add icon + add icon - +
); }