Virtual whiteboard for sketching hand-drawn like diagrams
feat: Updates to Collaboration and RTL UX (#2994)
Jed Fox73cba59d2d55
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex 303efa0755..611dc5c163 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -35,7 +35,6 @@ Make sure the title starts with a semantic prefix:- **feat**: A new feature- **fix**: A bug fix-- **improvement**: An improvement to a current feature- **docs**: Documentation only changes- **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)- **refactor**: A code change that neither fixes a bug nor adds a featurediff --git a/src/components/CollabButton.scss b/src/components/CollabButton.scssindex 5d9a86de3d..5fab9b5e8b 100644--- a/src/components/CollabButton.scss+++ b/src/components/CollabButton.scss@@ -4,7 +4,8 @@.CollabButton.is-collaborating {background-color: var(--button-special-active-background-color);- .ToolIcon__icon svg {+ .ToolIcon__icon svg,+ .ToolIcon__label {color: var(--icon-green-fill-color);}}diff --git a/src/components/CollabButton.tsx b/src/components/CollabButton.tsxindex a046041dac..f1412f7231 100644--- a/src/components/CollabButton.tsx+++ b/src/components/CollabButton.tsx@@ -25,8 +25,8 @@ const CollabButton = ({onClick={onClick}icon={users}type="button"- title={t("buttons.roomDialog")}- aria-label={t("buttons.roomDialog")}+ title={t("labels.liveCollaboration")}+ aria-label={t("labels.liveCollaboration")}showAriaLabel={useIsMobile()}>{collaboratorCount > 0 && (diff --git a/src/components/InitializeApp.tsx b/src/components/InitializeApp.tsxindex ae0bea0366..85198c3536 100644--- a/src/components/InitializeApp.tsx+++ b/src/components/InitializeApp.tsx@@ -1,12 +1,7 @@import React from "react";import { LoadingMessage } from "./LoadingMessage";-import {- defaultLang,- Language,- languages,- setLanguageFirstTime,-} from "../i18n";+import { defaultLang, Language, languages, setLanguage } from "../i18n";interface Props {langCode: Language["code"];@@ -23,7 +18,7 @@ export class InitializeApp extends React.Component<Props, State> {const currentLang =languages.find((lang) => lang.code === this.props.langCode) ||defaultLang;- await setLanguageFirstTime(currentLang);+ await setLanguage(currentLang);this.setState({isLoading: false,});diff --git a/src/components/LayerUI.scss b/src/components/LayerUI.scssindex 8ddbe7cbf8..90bd69445e 100644--- a/src/components/LayerUI.scss+++ b/src/components/LayerUI.scss@@ -19,9 +19,9 @@}a {- margin-left: auto;+ margin-inline-start: auto;// 17px for scrollbar (needed for overlay scrollbars on Big Sur?) + 1px extra- padding-right: 18px;+ padding-inline-end: 18px;white-space: nowrap;}}diff --git a/src/excalidraw-app/collab/RoomDialog.scss b/src/excalidraw-app/collab/RoomDialog.scssindex 5a045136ad..f0b14e190e 100644--- a/src/excalidraw-app/collab/RoomDialog.scss+++ b/src/excalidraw-app/collab/RoomDialog.scss@@ -32,6 +32,16 @@display: flex;align-items: center;justify-content: center;+ @media #{$is-mobile-query} {+ flex-direction: column;+ align-items: stretch;+ }+ }++ @media #{$is-mobile-query} {+ .RoomDialog-usernameLabel {+ font-weight: bold;+ }}.RoomDialog-username {@@ -41,6 +51,10 @@min-width: 0;flex: 1 1 auto;margin-inline-start: 1em;+ @media #{$is-mobile-query} {+ margin-top: 0.5em;+ margin-inline-start: 0;+ }height: 2.5rem;font-size: 1em;line-height: 1.5;diff --git a/src/excalidraw-app/collab/RoomDialog.tsx b/src/excalidraw-app/collab/RoomDialog.tsxindex c880eece77..a8e6531253 100644--- a/src/excalidraw-app/collab/RoomDialog.tsx+++ b/src/excalidraw-app/collab/RoomDialog.tsx@@ -119,7 +119,11 @@ const RoomDialog = ({);};return (- <Dialog small onCloseRequest={handleClose} title={t("labels.createRoom")}>+ <Dialog+ small+ onCloseRequest={handleClose}+ title={t("labels.liveCollaboration")}+ >{renderRoomDialog()}</Dialog>);diff --git a/src/i18n.ts b/src/i18n.tsindex 4b3ae5f21f..a2714c958a 100644--- a/src/i18n.ts+++ b/src/i18n.ts@@ -1,5 +1,6 @@import fallbackLangData from "./locales/en.json";import percentages from "./locales/percentages.json";+import { ENV } from "./constants";const COMPLETION_THRESHOLD = 85;@@ -55,6 +56,18 @@ export const languages: Language[] = allLanguagesCOMPLETION_THRESHOLD,);+const TEST_LANG_CODE = "__test__";+if (process.env.NODE_ENV === ENV.DEVELOPMENT) {+ languages.unshift(+ { code: TEST_LANG_CODE, label: "test language" },+ {+ code: `${TEST_LANG_CODE}.rtl`,+ label: "\u{202a}test language (rtl)\u{202c}",+ rtl: true,+ },+ );+}+let currentLang: Language = defaultLang;let currentLangData = {};@@ -63,18 +76,13 @@ export const setLanguage = async (lang: Language) => {document.documentElement.dir = currentLang.rtl ? "rtl" : "ltr";document.documentElement.lang = currentLang.code;- currentLangData = await import(- /* webpackChunkName: "i18n-[request]" */ `./locales/${currentLang.code}.json`- );-};--export const setLanguageFirstTime = async (lang: Language) => {- currentLang = lang;- document.documentElement.dir = currentLang.rtl ? "rtl" : "ltr";-- currentLangData = await import(- /* webpackChunkName: "i18n-[request]" */ `./locales/${currentLang.code}.json`- );+ if (lang.code.startsWith(TEST_LANG_CODE)) {+ currentLangData = {};+ } else {+ currentLangData = await import(+ /* webpackChunkName: "i18n-[request]" */ `./locales/${currentLang.code}.json`+ );+ }};export const getLanguage = () => currentLang;@@ -94,6 +102,13 @@ const findPartsForData = (data: any, parts: string[]) => {};export const t = (path: string, replacement?: { [key: string]: string }) => {+ if (currentLang.code.startsWith(TEST_LANG_CODE)) {+ const name = replacement+ ? `${path}(${JSON.stringify(replacement).slice(1, -1)})`+ : path;+ return `\u{202a}[[${name}]]\u{202c}`;+ }+const parts = path.split(".");let translation =findPartsForData(currentLangData, parts) ||diff --git a/src/locales/en.json b/src/locales/en.jsonindex e69a2a5fc8..48bb0233df 100644--- a/src/locales/en.json+++ b/src/locales/en.json@@ -68,7 +68,7 @@"layers": "Layers","actions": "Actions","language": "Language",- "createRoom": "Share a live-collaboration session",+ "liveCollaboration": "Live Collaboration","duplicateSelection": "Duplicate","untitled": "Untitled","name": "Name",@@ -117,7 +117,6 @@"edit": "Edit","undo": "Undo","redo": "Redo",- "roomDialog": "Start live collaboration","createNewRoom": "Create new room","fullScreen": "Full screen","darkMode": "Dark mode",