diff --git a/public/locales/en/widget.json b/public/locales/en/widget.json new file mode 100644 index 00000000..c3af99dc --- /dev/null +++ b/public/locales/en/widget.json @@ -0,0 +1,6 @@ +{ + "welcome_not_login": "👋 Hi there, Nice to meet you! Please login before we have a nice talk 👇", + "welcome": "👋 Hi there, Nice to meet you!", + "placeholder_send": "Type and press enter", + "start_chat": "Start Chat" +} diff --git a/public/locales/zh/widget.json b/public/locales/zh/widget.json new file mode 100644 index 00000000..526c9658 --- /dev/null +++ b/public/locales/zh/widget.json @@ -0,0 +1,6 @@ +{ + "welcome_not_login": "👋 你好,请先输入你的用户名👇", + "welcome": "👋 你好,很高兴认识你!", + "placeholder_send": "请输入消息", + "start_chat": "开始聊天" +} diff --git a/src/assets/icons/send.svg b/src/assets/icons/send.svg new file mode 100644 index 00000000..993e4704 --- /dev/null +++ b/src/assets/icons/send.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/i18n.ts b/src/i18n.ts index f88a54ff..ecd6696c 100644 --- a/src/i18n.ts +++ b/src/i18n.ts @@ -8,6 +8,7 @@ import auth from "../public/locales/en/auth.json"; import member from "../public/locales/en/member.json"; import chat from "../public/locales/en/chat.json"; import fav from "../public/locales/en/fav.json"; +import widget from "../public/locales/en/widget.json"; import welcome from "../public/locales/en/welcome.json"; import setting from "../public/locales/en/setting.json"; import file from "../public/locales/en/file.json"; @@ -26,7 +27,8 @@ export const resources = { member, welcome, setting, - file + file, + widget } } as const; i18n.on("languageChanged", (lng) => { @@ -46,7 +48,7 @@ i18n // init i18next // for all options read: https://www.i18next.com/overview/configuration-options .init({ - ns: ["common", "chat", "member", "setting", "fav", "file", "welcome", "auth"], + ns: ["common", "chat", "member", "setting", "fav", "file", "welcome", "auth", "widget"], defaultNS, load: "languageOnly", // lng: "jp", diff --git a/src/widget/Popup/Footer.tsx b/src/widget/Popup/Footer.tsx index 5efbf273..7b588718 100644 --- a/src/widget/Popup/Footer.tsx +++ b/src/widget/Popup/Footer.tsx @@ -6,7 +6,9 @@ type Props = { const Index: FC = () => { return ( - + ); }; diff --git a/src/widget/Popup/Header.tsx b/src/widget/Popup/Header.tsx index bab16942..f0bb2307 100644 --- a/src/widget/Popup/Header.tsx +++ b/src/widget/Popup/Header.tsx @@ -11,7 +11,7 @@ const Index: FC = ({ handleClose }) => { return (
- logo + {logo && logo}
{name} diff --git a/src/widget/Popup/Login/index.tsx b/src/widget/Popup/Login/index.tsx index 5ec1243d..793a9df2 100644 --- a/src/widget/Popup/Login/index.tsx +++ b/src/widget/Popup/Login/index.tsx @@ -14,10 +14,12 @@ import Input from '../../../common/component/styled/Input'; import useGithubAuthConfig from '../../../common/hook/useGithubAuthConfig'; import useGoogleAuthConfig from '../../../common/hook/useGoogleAuthConfig'; import { useWidget } from '../../WidgetContext'; +import { useTranslation } from 'react-i18next'; // type Props = {} const Login = () => { + const { t } = useTranslation("widget"); const dispatch = useDispatch(); const { color, fgColor, from } = useWidget(); const { clientId } = useGoogleAuthConfig(); @@ -72,10 +74,12 @@ const Login = () => { return (
-
- + + {/* */} - Start Chat + + {t("start_chat")} + {hasSocialLogins && } {googleLogin && } {enableGithubLogin && } diff --git a/src/widget/Popup/Message/index.tsx b/src/widget/Popup/Message/index.tsx index 84e8d1ad..1ce7e389 100644 --- a/src/widget/Popup/Message/index.tsx +++ b/src/widget/Popup/Message/index.tsx @@ -33,9 +33,10 @@ const Index = (props: IWidgetMessage) => { break; } return
- {host ? <>
- avatar -
+ {host ? <> +
+ avatar +
{contentContainer}