export hook for mobile
This commit is contained in:
parent
274294a367
commit
e20b3325e9
@ -1,10 +1,10 @@
|
|||||||
import { isExcalidrawPlusSignedUser, PlusAppLinkJSX, PlusLPLinkJSX } from "..";
|
|
||||||
import { useDevice } from "../../components/App";
|
|
||||||
import { shield } from "../../components/icons";
|
import { shield } from "../../components/icons";
|
||||||
import { Tooltip } from "../../components/Tooltip";
|
import { Tooltip } from "../../components/Tooltip";
|
||||||
import { t } from "../../i18n";
|
import { t } from "../../i18n";
|
||||||
import { languages } from "../../packages/excalidraw/index";
|
import { languages, useDevice } from "../../packages/excalidraw/index";
|
||||||
import { LanguageList } from "./LanguageList";
|
import { LanguageList } from "./LanguageList";
|
||||||
|
import PlusAppLink, { isExcalidrawPlusSignedUser } from "./PlusAppLink";
|
||||||
|
import PlusLPLink from "./PlusLPLink";
|
||||||
|
|
||||||
const EncryptedIcon = () => (
|
const EncryptedIcon = () => (
|
||||||
<a
|
<a
|
||||||
@ -59,7 +59,7 @@ const Footer = ({
|
|||||||
borderRadius: 12,
|
borderRadius: 12,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{isExcalidrawPlusSignedUser ? PlusAppLinkJSX : PlusLPLinkJSX}
|
{isExcalidrawPlusSignedUser ? <PlusAppLink /> : <PlusLPLink />}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -4,13 +4,7 @@ import { trackEvent } from "../analytics";
|
|||||||
import { getDefaultAppState } from "../appState";
|
import { getDefaultAppState } from "../appState";
|
||||||
import { ErrorDialog } from "../components/ErrorDialog";
|
import { ErrorDialog } from "../components/ErrorDialog";
|
||||||
import { TopErrorBoundary } from "../components/TopErrorBoundary";
|
import { TopErrorBoundary } from "../components/TopErrorBoundary";
|
||||||
import {
|
import { APP_NAME, EVENT, TITLE_TIMEOUT, VERSION_TIMEOUT } from "../constants";
|
||||||
APP_NAME,
|
|
||||||
COOKIES,
|
|
||||||
EVENT,
|
|
||||||
TITLE_TIMEOUT,
|
|
||||||
VERSION_TIMEOUT,
|
|
||||||
} from "../constants";
|
|
||||||
import { loadFromBlob } from "../data/blob";
|
import { loadFromBlob } from "../data/blob";
|
||||||
import {
|
import {
|
||||||
ExcalidrawElement,
|
ExcalidrawElement,
|
||||||
@ -76,10 +70,10 @@ import { jotaiStore, useAtomWithInitialValue } from "../jotai";
|
|||||||
import { reconcileElements } from "./collab/reconciliation";
|
import { reconcileElements } from "./collab/reconciliation";
|
||||||
import { parseLibraryTokensFromUrl, useHandleLibrary } from "../data/library";
|
import { parseLibraryTokensFromUrl, useHandleLibrary } from "../data/library";
|
||||||
import Footer from "./components/Footer";
|
import Footer from "./components/Footer";
|
||||||
|
import PlusAppLink, {
|
||||||
export const isExcalidrawPlusSignedUser = document.cookie.includes(
|
isExcalidrawPlusSignedUser,
|
||||||
COOKIES.AUTH_STATE_COOKIE,
|
} from "./components/PlusAppLink";
|
||||||
);
|
import PlusLPLink from "./components/PlusLPLink";
|
||||||
|
|
||||||
const languageDetector = new LanguageDetector();
|
const languageDetector = new LanguageDetector();
|
||||||
languageDetector.init({
|
languageDetector.init({
|
||||||
@ -191,31 +185,6 @@ const initializeScene = async (opts: {
|
|||||||
return { scene: null, isExternalScene: false };
|
return { scene: null, isExternalScene: false };
|
||||||
};
|
};
|
||||||
|
|
||||||
export const PlusLPLinkJSX = (
|
|
||||||
<p style={{ direction: "ltr", unicodeBidi: "embed" }}>
|
|
||||||
Introducing Excalidraw+
|
|
||||||
<br />
|
|
||||||
<a
|
|
||||||
href="https://plus.excalidraw.com/plus?utm_source=excalidraw&utm_medium=banner&utm_campaign=launch"
|
|
||||||
target="_blank"
|
|
||||||
rel="noreferrer"
|
|
||||||
>
|
|
||||||
Try out now!
|
|
||||||
</a>
|
|
||||||
</p>
|
|
||||||
);
|
|
||||||
|
|
||||||
export const PlusAppLinkJSX = (
|
|
||||||
<a
|
|
||||||
href={`${process.env.REACT_APP_PLUS_APP}/#excalidraw-redirect`}
|
|
||||||
target="_blank"
|
|
||||||
rel="noreferrer"
|
|
||||||
className="plus-button"
|
|
||||||
>
|
|
||||||
Go to Excalidraw+
|
|
||||||
</a>
|
|
||||||
);
|
|
||||||
|
|
||||||
const ExcalidrawWrapper = () => {
|
const ExcalidrawWrapper = () => {
|
||||||
const [errorMessage, setErrorMessage] = useState("");
|
const [errorMessage, setErrorMessage] = useState("");
|
||||||
let currentLangCode = languageDetector.detect() || defaultLang.code;
|
let currentLangCode = languageDetector.detect() || defaultLang.code;
|
||||||
@ -575,7 +544,7 @@ const ExcalidrawWrapper = () => {
|
|||||||
textAlign: "center",
|
textAlign: "center",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{isExcalidrawPlusSignedUser ? PlusAppLinkJSX : PlusLPLinkJSX}
|
{isExcalidrawPlusSignedUser ? <PlusAppLink /> : <PlusLPLink />}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -226,3 +226,5 @@ export {
|
|||||||
sceneCoordsToViewportCoords,
|
sceneCoordsToViewportCoords,
|
||||||
viewportCoordsToSceneCoords,
|
viewportCoordsToSceneCoords,
|
||||||
} from "../../utils";
|
} from "../../utils";
|
||||||
|
|
||||||
|
export { useDevice } from "../../components/App";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user