diff --git a/src/routes/chat/Layout/DnDTip.tsx b/src/routes/chat/Layout/DnDTip.tsx new file mode 100644 index 00000000..da489708 --- /dev/null +++ b/src/routes/chat/Layout/DnDTip.tsx @@ -0,0 +1,25 @@ +// import { useEffect } from "react"; +import { ChatPrefixes } from "../../../app/config"; +import { useTranslation } from "react-i18next"; +type Props = { + context: "user" | "channel", + name: string +}; +const DnDTip = ({ context, name }: Props) => { + const { t } = useTranslation("chat"); + + return ( +
+
+
+

{`${t("send_to")} ${ChatPrefixes[context]}${name}`}

+ Photos accept jpg, png, max size limit to 10M. +
+
+
+ ); +}; + +export default DnDTip; diff --git a/src/routes/chat/Layout/LicenseOutdatedTip.tsx b/src/routes/chat/Layout/LicenseOutdatedTip.tsx index 121e9093..33dff1b0 100644 --- a/src/routes/chat/Layout/LicenseOutdatedTip.tsx +++ b/src/routes/chat/Layout/LicenseOutdatedTip.tsx @@ -1,28 +1,7 @@ // import { useEffect } from "react"; import { useTranslation } from "react-i18next"; import { useNavigate } from "react-router-dom"; -import styled from "styled-components"; import Button from "../../../common/component/styled/Button"; -const Styled = styled.div` - display: flex; - align-items: center; - justify-content: space-between; - background: #ef4444; - border-radius: var(--br); - width: 100%; - width: -webkit-fill-available; - padding: 12px 16px; - .txt { - font-weight: 500; - font-size: 16px; - line-height: 16px; - color: #fff; - .hand { - font-size: 20px; - margin-right: 10px; - } - } -`; // type Props = {}; const LicenseUpgradeTip = () => { @@ -33,13 +12,13 @@ const LicenseUpgradeTip = () => { }; return ( - - - 🚨 +
+ + 🚨 {t("license_tip")} - +
); }; diff --git a/src/routes/chat/Layout/Operations.tsx b/src/routes/chat/Layout/Operations.tsx index 59c27e9b..5616cf4f 100644 --- a/src/routes/chat/Layout/Operations.tsx +++ b/src/routes/chat/Layout/Operations.tsx @@ -1,5 +1,4 @@ import { FC, useState } from "react"; -import styled from "styled-components"; import { useKey } from "rooks"; import toast from "react-hot-toast"; import useDeleteMessage from "../../../common/hook/useDeleteMessage"; @@ -13,33 +12,6 @@ import ForwardModal from "../../../common/component/ForwardModal"; import DeleteMessageConfirmModal from "../../../common/component/DeleteMessageConfirm"; import { useAppDispatch, useAppSelector } from "../../../app/store"; -const Styled = styled.div` - position: relative; - padding: 16px; - display: flex; - gap: 32px; - align-items: center; - justify-content: center; - box-shadow: 0px -1px 0px rgba(0, 0, 0, 0.05); - .opt { - padding: 8px; - background: #f2f4f7; - border-radius: var(--br); - &:disabled svg path { - fill: #ccc; - } - &:hover { - background: #eaecf0; - } - } - .close { - cursor: pointer; - position: absolute; - right: 20px; - top: 50%; - transform: translateY(-50%); - } -`; type Props = { context: "user" | "channel"; id: number; @@ -83,20 +55,21 @@ const Operations: FC = ({ context, id }) => { }); const canDel = canDelete(mids); + // const return ( <> - - - - - - + + {forwardModalVisible && } {deleteModalVisible && ( diff --git a/src/routes/chat/Layout/index.tsx b/src/routes/chat/Layout/index.tsx index 75479c04..3c028c27 100644 --- a/src/routes/chat/Layout/index.tsx +++ b/src/routes/chat/Layout/index.tsx @@ -6,12 +6,13 @@ import Send from "../../../common/component/Send"; import Styled from "./styled"; import Operations from "./Operations"; import useUploadFile from "../../../common/hook/useUploadFile"; -import { ChatPrefixes } from "../../../app/config"; + import { useAppSelector } from "../../../app/store"; import LoginTip from "./LoginTip"; import useLicense from "../../../common/hook/useLicense"; import LicenseUpgradeTip from "./LicenseOutdatedTip"; -import { useTranslation } from "react-i18next"; +// import { useTranslation } from "react-i18next"; +import DnDTip from "./DnDTip"; interface Props { readonly?: boolean; @@ -34,7 +35,7 @@ const Layout: FC = ({ context = "channel", to }) => { - const { t } = useTranslation('chat'); + // const { t } = useTranslation('chat'); const { reachLimit } = useLicense(); const { addStageFile } = useUploadFile({ context, id: to }); const messagesContainer = useRef(null); @@ -125,17 +126,8 @@ const Layout: FC = ({ {users &&
{users}
} {aside &&
{aside}
} - {!readonly && ( -
-
-
-

{`${t("send_to")} ${ChatPrefixes[context]}${name}`}

- Photos accept jpg, png, max size limit to 10M. -
-
-
+ {!readonly && isActive && ( + )}
diff --git a/src/routes/chat/Layout/styled.tsx b/src/routes/chat/Layout/styled.tsx index d833c6ae..0df32d43 100644 --- a/src/routes/chat/Layout/styled.tsx +++ b/src/routes/chat/Layout/styled.tsx @@ -100,46 +100,6 @@ const Styled = styled.article` } } } - .drag_tip { - display: flex; - justify-content: center; - align-items: center; - position: absolute; - left: 0; - top: 0; - width: 100%; - height: 100%; - background-color: rgba(0, 0, 0, 0.5); - visibility: hidden; - &.visible { - visibility: visible; - } - .box { - padding: 16px; - filter: drop-shadow(0px 25px 50px rgba(31, 41, 55, 0.25)); - border-radius: 8px; - background: #52edff; - .inner { - padding: 16px; - padding-top: 64px; - border: 2px dashed #a5f3fc; - border-radius: 6px; - display: flex; - flex-direction: column; - align-items: center; - color: #fff; - .head { - font-weight: 600; - font-size: 20px; - line-height: 30px; - } - .intro { - font-weight: normal; - font-size: 14px; - line-height: 20px; - } - } - } - } + `; export default Styled;