diff --git a/packages/flat-i18n/locales/en.json b/packages/flat-i18n/locales/en.json index e60f540e55c..08214406169 100644 --- a/packages/flat-i18n/locales/en.json +++ b/packages/flat-i18n/locales/en.json @@ -110,6 +110,7 @@ "periodic": "Periodic", "today": "Today", "tomorrow": "Tomorrow", + "pmi-invite-prefix": "{{userName}} invites you to join {{appName}} personal room", "invite-begin-time": "Start time: {{time}}", "invite-prefix": "{{userName}} invites you to join the {{appName}} room\n\nRoom theme: {{title}}", "invite-suffix": "Room ID: {{uuid}}", diff --git a/packages/flat-i18n/locales/zh-CN.json b/packages/flat-i18n/locales/zh-CN.json index 1fd915603b4..bb5d0d9800e 100644 --- a/packages/flat-i18n/locales/zh-CN.json +++ b/packages/flat-i18n/locales/zh-CN.json @@ -110,6 +110,7 @@ "all-loaded": "已全部加载", "no-record": "暂无记录", "no-room": "暂无房间", + "pmi-invite-prefix": "{{userName}} 邀请你加入 {{appName}} 个人房间", "invite-prefix": "{{userName}} 邀请你加入 {{appName}} 房间\n房间主题:{{title}}\n", "invite-begin-time": "开始时间:{{time}}\n", "invite-suffix": "房间号:{{uuid}}", diff --git a/packages/flat-pages/src/HomePage/MainRoomMenu/CreateRoomBox.tsx b/packages/flat-pages/src/HomePage/MainRoomMenu/CreateRoomBox.tsx index 73a89c8b3d8..ebc499eeba1 100644 --- a/packages/flat-pages/src/HomePage/MainRoomMenu/CreateRoomBox.tsx +++ b/packages/flat-pages/src/HomePage/MainRoomMenu/CreateRoomBox.tsx @@ -1,7 +1,14 @@ import "./CreateRoomBox.less"; import React, { useContext, useEffect, useRef, useState, KeyboardEvent, useCallback } from "react"; -import { ClassPicker, HomePageHeroButton, PmiDesc, PmiExistTip, Region } from "flat-components"; +import { + ClassPicker, + HomePageHeroButton, + PmiDesc, + PmiExistTip, + Region, + formatInviteCode, +} from "flat-components"; import { Input, Modal, Checkbox, Form, InputRef, Dropdown, message, Button } from "antd"; import { MoreOutlined } from "@ant-design/icons"; import { useTranslate } from "@netless/flat-i18n"; @@ -12,6 +19,7 @@ import { PreferencesStoreContext, GlobalStoreContext } from "../../components/St import { RouteNameType, usePushHistory } from "../../utils/routes"; import { joinRoomHandler } from "../../utils/join-room-handler"; import { useSafePromise } from "../../utils/hooks/lifecycle"; +import { FLAT_WEB_BASE_URL } from "../../constants/process"; interface CreateRoomFormValues { roomTitle: string; @@ -51,7 +59,7 @@ export const CreateRoomBox = observer(function CreateRoomBox roomType: RoomType.BigClass, autoMicOn: preferencesStore.autoMicOn, autoCameraOn: preferencesStore.autoCameraOn, - // if there exists pmi room, it will can not be selected + // if there exists pmi room, it can not be selected pmi: preferencesStore.autoPmiOn && !globalStore.pmiRoomExist, }; @@ -83,10 +91,21 @@ export const CreateRoomBox = observer(function CreateRoomBox const handleCopy = useCallback( (text: string) => { - navigator.clipboard.writeText(text); + const copyText = + t("pmi-invite-prefix", { + userName: globalStore.userInfo?.name, + }) + + "\n" + + "\n" + + t("invite-suffix", { uuid: formatInviteCode("", text) }) + + "\n" + + "\n" + + t("invite-join-link", { link: `${FLAT_WEB_BASE_URL}/join/${text}` }); + + navigator.clipboard.writeText(copyText); void message.success(t("copy-success")); }, - [t], + [globalStore.userInfo?.name, t], ); const handleCreateRoom = (): void => { diff --git a/packages/flat-pages/src/UserScheduledPage/index.tsx b/packages/flat-pages/src/UserScheduledPage/index.tsx index b2647bca081..93c79e3fe87 100644 --- a/packages/flat-pages/src/UserScheduledPage/index.tsx +++ b/packages/flat-pages/src/UserScheduledPage/index.tsx @@ -54,7 +54,7 @@ export const UserScheduledPage = observer(function UserScheduledPage() { rate: 7, endTime: addWeeks(scheduleBeginTime, 6), }, - // if there exists pmi room, it will can not be selected + // if there exists pmi room, it can not be selected pmi: preferencesStore.autoPmiOn && !globalStore.pmiRoomExist, }; });