Skip to content

Commit

Permalink
feat(web): add "open in browser" tip in wechat browser (#1268)
Browse files Browse the repository at this point in the history
  • Loading branch information
hyrious authored Jan 5, 2022
1 parent 30b5c15 commit 76e87c8
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 8 deletions.
1 change: 1 addition & 0 deletions cspell.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ module.exports = {
"estree",
"webstorm",
"Frameless",
"micromessenger",

// CNCF
"nindent",
Expand Down
3 changes: 2 additions & 1 deletion packages/flat-i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -388,5 +388,6 @@
"user-guide-text": "Want to learn more about Flat? ",
"user-guide-button": "Check it out now",
"start-recording": "Start recording",
"stop-recording": "Stop recording"
"stop-recording": "Stop recording",
"open-in-browser": "Open in Browser"
}
3 changes: 2 additions & 1 deletion packages/flat-i18n/locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -388,5 +388,6 @@
"user-guide-text": "想了解更多 Flat 的使用技巧?",
"user-guide-button": "立即查看",
"start-recording": "开始录制",
"stop-recording": "停止录制"
"stop-recording": "停止录制",
"open-in-browser": "请在浏览器中打开"
}
11 changes: 10 additions & 1 deletion web/flat-web/src/pages/JoinPage/JoinPageMobile.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logoSVG from "./icons/logo-sm.svg";
import openInBrowserSVG from "./icons/open-in-browser.svg";

import React, { useCallback, useEffect, useMemo } from "react";
import { useTranslation } from "react-i18next";
Expand All @@ -10,6 +11,8 @@ export interface JoinPageMobileProps {
serviceURL: string;
}

const isWeChatBrowser = window.navigator.userAgent.toLowerCase().includes("micromessenger");

export default function JoinPageMobile({
roomUUID,
privacyURL,
Expand All @@ -33,7 +36,7 @@ export default function JoinPageMobile({

return (
<div className="join-page-mobile-container">
<iframe width="0" height="0" style={{ display: "none" }} src={url} />
<iframe width="0" height="0" title="join flat" style={{ display: "none" }} src={url} />
<div className="join-page-mobile-effect"></div>
<div className="join-page-mobile-header">
<div className="join-page-mobile-app-icon">
Expand All @@ -57,6 +60,12 @@ export default function JoinPageMobile({
{t("service-policy")}
</a>
</div>
{isWeChatBrowser && (
<div className="join-page-mobile-wechat-overlay">
<img src={openInBrowserSVG} alt="[open-in-browser]" />
<strong>{t("open-in-browser")}</strong>
</div>
)}
</div>
);
}
7 changes: 7 additions & 0 deletions web/flat-web/src/pages/JoinPage/icons/open-in-browser.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion web/flat-web/src/pages/JoinPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ export const JoinPage = observer(function JoinPage() {
serviceURL={serviceURL}
/>
)}
;
</div>
);
});
Expand Down
36 changes: 32 additions & 4 deletions web/flat-web/src/pages/JoinPage/style.less
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
width: 100%;
max-width: 268px;
border-radius: 8px;
border: 1px solid #3381FF;
border: 1px solid #3381ff;
outline: none;
background-color: #3381ff;
color: #fff;
Expand All @@ -197,7 +197,10 @@
&::after {
content: "";
position: absolute;
top: 0; right: 0; bottom: 0; left: 0;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 10;
background-color: transparent;
}
Expand All @@ -207,14 +210,14 @@
}

.join-page-mobile-big-btn.secondary {
color: #3381FF;
color: #3381ff;
background-color: transparent;
}

.join-page-mobile-footer {
font-size: 14px;
text-align: center;
color: #7A7B7C;
color: #7a7b7c;
}

.join-page-mobile-logo-texts {
Expand Down Expand Up @@ -351,3 +354,28 @@
z-index: 0;
pointer-events: none;
}

.join-page-mobile-wechat-overlay {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.5);

img {
width: 176px;
position: absolute;
top: 0;
right: 0;
}

strong {
color: #fff;
font-size: 16px;
font-weight: 400;
position: absolute;
top: 96px;
right: 40px;
}
}

0 comments on commit 76e87c8

Please sign in to comment.