diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 303efa07..611dc5c1 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 feature diff --git a/src/components/CollabButton.scss b/src/components/CollabButton.scss index 5d9a86de..5fab9b5e 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.tsx index a046041d..f1412f72 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.tsx index ae0bea03..85198c35 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 { 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.scss index 8ddbe7cb..90bd6944 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.scss index 5a045136..f0b14e19 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.tsx index c880eece..a8e65312 100644 --- a/src/excalidraw-app/collab/RoomDialog.tsx +++ b/src/excalidraw-app/collab/RoomDialog.tsx @@ -119,7 +119,11 @@ const RoomDialog = ({ ); }; return ( - + {renderRoomDialog()} ); diff --git a/src/i18n.ts b/src/i18n.ts index 4b3ae5f2..a2714c95 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[] = allLanguages COMPLETION_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.json index e69a2a5f..48bb0233 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",