Skip to content

Commit 76e87c8

Browse files
authored
feat(web): add "open in browser" tip in wechat browser (#1268)
1 parent 30b5c15 commit 76e87c8

File tree

7 files changed

+54
-8
lines changed

7 files changed

+54
-8
lines changed

cspell.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ module.exports = {
113113
"estree",
114114
"webstorm",
115115
"Frameless",
116+
"micromessenger",
116117

117118
// CNCF
118119
"nindent",

packages/flat-i18n/locales/en.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -388,5 +388,6 @@
388388
"user-guide-text": "Want to learn more about Flat? ",
389389
"user-guide-button": "Check it out now",
390390
"start-recording": "Start recording",
391-
"stop-recording": "Stop recording"
391+
"stop-recording": "Stop recording",
392+
"open-in-browser": "Open in Browser"
392393
}

packages/flat-i18n/locales/zh-CN.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -388,5 +388,6 @@
388388
"user-guide-text": "想了解更多 Flat 的使用技巧?",
389389
"user-guide-button": "立即查看",
390390
"start-recording": "开始录制",
391-
"stop-recording": "停止录制"
391+
"stop-recording": "停止录制",
392+
"open-in-browser": "请在浏览器中打开"
392393
}

web/flat-web/src/pages/JoinPage/JoinPageMobile.tsx

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import logoSVG from "./icons/logo-sm.svg";
2+
import openInBrowserSVG from "./icons/open-in-browser.svg";
23

34
import React, { useCallback, useEffect, useMemo } from "react";
45
import { useTranslation } from "react-i18next";
@@ -10,6 +11,8 @@ export interface JoinPageMobileProps {
1011
serviceURL: string;
1112
}
1213

14+
const isWeChatBrowser = window.navigator.userAgent.toLowerCase().includes("micromessenger");
15+
1316
export default function JoinPageMobile({
1417
roomUUID,
1518
privacyURL,
@@ -33,7 +36,7 @@ export default function JoinPageMobile({
3336

3437
return (
3538
<div className="join-page-mobile-container">
36-
<iframe width="0" height="0" style={{ display: "none" }} src={url} />
39+
<iframe width="0" height="0" title="join flat" style={{ display: "none" }} src={url} />
3740
<div className="join-page-mobile-effect"></div>
3841
<div className="join-page-mobile-header">
3942
<div className="join-page-mobile-app-icon">
@@ -57,6 +60,12 @@ export default function JoinPageMobile({
5760
{t("service-policy")}
5861
</a>
5962
</div>
63+
{isWeChatBrowser && (
64+
<div className="join-page-mobile-wechat-overlay">
65+
<img src={openInBrowserSVG} alt="[open-in-browser]" />
66+
<strong>{t("open-in-browser")}</strong>
67+
</div>
68+
)}
6069
</div>
6170
);
6271
}
Loading

web/flat-web/src/pages/JoinPage/index.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ export const JoinPage = observer(function JoinPage() {
8383
serviceURL={serviceURL}
8484
/>
8585
)}
86-
;
8786
</div>
8887
);
8988
});

web/flat-web/src/pages/JoinPage/style.less

+32-4
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
width: 100%;
187187
max-width: 268px;
188188
border-radius: 8px;
189-
border: 1px solid #3381FF;
189+
border: 1px solid #3381ff;
190190
outline: none;
191191
background-color: #3381ff;
192192
color: #fff;
@@ -197,7 +197,10 @@
197197
&::after {
198198
content: "";
199199
position: absolute;
200-
top: 0; right: 0; bottom: 0; left: 0;
200+
top: 0;
201+
right: 0;
202+
bottom: 0;
203+
left: 0;
201204
z-index: 10;
202205
background-color: transparent;
203206
}
@@ -207,14 +210,14 @@
207210
}
208211

209212
.join-page-mobile-big-btn.secondary {
210-
color: #3381FF;
213+
color: #3381ff;
211214
background-color: transparent;
212215
}
213216

214217
.join-page-mobile-footer {
215218
font-size: 14px;
216219
text-align: center;
217-
color: #7A7B7C;
220+
color: #7a7b7c;
218221
}
219222

220223
.join-page-mobile-logo-texts {
@@ -351,3 +354,28 @@
351354
z-index: 0;
352355
pointer-events: none;
353356
}
357+
358+
.join-page-mobile-wechat-overlay {
359+
position: absolute;
360+
top: 0;
361+
left: 0;
362+
right: 0;
363+
bottom: 0;
364+
background-color: rgba(0, 0, 0, 0.5);
365+
366+
img {
367+
width: 176px;
368+
position: absolute;
369+
top: 0;
370+
right: 0;
371+
}
372+
373+
strong {
374+
color: #fff;
375+
font-size: 16px;
376+
font-weight: 400;
377+
position: absolute;
378+
top: 96px;
379+
right: 40px;
380+
}
381+
}

0 commit comments

Comments
 (0)