-
Notifications
You must be signed in to change notification settings - Fork 825
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(flat-rtm): add flat rtm service
refactor(flat-server-api): mv flat server api to a package refactor(flat-server-api): update deps chore(flat-server-api): remove unused deps refactor(flat-server-api): update entry refactor(i18n): add i18next refactor(flat-stores): mv stores to a package refactor(flat-stores): mv stores to flat-stores refactor(project): update to flat-stores refactor(flat-rtm): update flat-rtm api refactor(flat-stores): remove React fix(flat-stores): correct imports refactor(flat-rtm): fix rtm failing chore(project): remove stores workspace refactor(web): update rtm services config refactor(web): replace errorTips with flat-components refactor(flat-stores): update owner uuid from roomInfo refactor(flat-server-api): replace session storage to local storage session storage does not work under incognito mode refactor(flat-rtc): ignore track enable refactor(flat-stores): update device states on init fix(flat-stores): cancel hand raising refactor(flat-stores): add whiteboard debugging refactor(classroom): listen to rtc events before joining room
- Loading branch information
Showing
130 changed files
with
2,322 additions
and
3,278 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
module.exports = { | ||
"*.svg": "svgo", | ||
"*.{ts,tsx}": ["eslint --cache --fix", "prettier --write"], | ||
"*.{md,ts,tsx,js,css,less,json,yml,yaml,html,sh}": "cspell --no-progress --no-must-find-files", | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 16 additions & 11 deletions
27
packages/flat-components/src/components/ChatPanel/types.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,19 @@ | ||
export enum ChatMsgType { | ||
Notice = "Notice", | ||
BanText = "BanText", | ||
ChannelMessage = "ChannelMessage", | ||
UserGuide = "UserGuide", | ||
} | ||
|
||
export type ChatMsg = { | ||
import type { FlatRTMEventData } from "@netless/flat-rtm"; | ||
|
||
export type ChatMsgType = "notice" | "ban" | "room-message" | "user-guide"; | ||
|
||
export type ChatMsgRoomMessage = { type: "room-message" } & FlatRTMEventData["room-message"]; | ||
|
||
export type ChatMsgNotice = { type: "notice" } & FlatRTMEventData["notice"]; | ||
|
||
export type ChatMsgBan = { type: "ban" } & FlatRTMEventData["ban"]; | ||
|
||
export type ChatMsgUserGuide = { | ||
type: "user-guide"; | ||
roomUUID: string; | ||
uuid: string; | ||
type: string; | ||
value: string | boolean; | ||
userUUID: string; | ||
timestamp: number; | ||
senderID: string; | ||
}; | ||
|
||
export type ChatMsg = ChatMsgRoomMessage | ChatMsgNotice | ChatMsgBan | ChatMsgUserGuide; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...lat-web/src/components/Tips/ErrorTips.tsx → ...ges/flat-components/src/utils/errorTip.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
node_modules/ | ||
dist/ | ||
public/ | ||
*.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import i18next, { Resource } from "i18next"; | ||
import I18nextBrowserLanguageDetector from "i18next-browser-languagedetector"; | ||
import { initReactI18next } from "react-i18next"; | ||
import en from "../locales/en.json"; | ||
import zhCN from "../locales/zh-CN.json"; | ||
|
||
import varsCNen from "../vars/cn/en.json"; | ||
import varsCNzhCN from "../vars/cn/zh-CN.json"; | ||
import varsUSen from "../vars/us/en.json"; | ||
import varsUSzhCN from "../vars/us/zh-CN.json"; | ||
|
||
/** | ||
* NOTE: to use this library, also install https://github.com/antfu/i18n-ally | ||
* to edit translations. open a new vscode window at <path to renderer-app>. | ||
*/ | ||
|
||
export let i18nLoaded = false; | ||
|
||
export const i18n = i18next; | ||
|
||
export const languages = ["en", "zh-CN"] as const; | ||
|
||
export async function initI18n(): Promise<void> { | ||
if (i18nLoaded) { | ||
return; | ||
} | ||
|
||
const messages: Resource = { | ||
en: { translation: en }, | ||
"zh-CN": { translation: zhCN }, | ||
}; | ||
|
||
const defaultVars: Record<string, Record<string, string>> = process.env.FLAT_REGION === "US" | ||
? { en: varsUSen, "zh-CN": varsUSzhCN } | ||
: { en: varsCNen, "zh-CN": varsCNzhCN }; | ||
|
||
const p = i18next | ||
.use(I18nextBrowserLanguageDetector) | ||
.use(initReactI18next) | ||
.init({ | ||
resources: messages, | ||
fallbackLng: "en", | ||
supportedLngs: languages, | ||
interpolation: { | ||
escapeValue: false, // react already safes from xss | ||
defaultVariables: defaultVars[i18next.language] || defaultVars.en, | ||
}, | ||
}); | ||
|
||
const changeLang = (lang: string): void => { | ||
document.querySelector("html")?.setAttribute("lang", lang); | ||
|
||
const defaultVariables = defaultVars[lang] || defaultVars.en; | ||
if (i18next.options.interpolation) { | ||
i18next.options.interpolation.defaultVariables = defaultVariables; | ||
} else { | ||
i18next.options.interpolation = { defaultVariables }; | ||
} | ||
}; | ||
|
||
changeLang(i18next.language); | ||
i18next.on("languageChanged", changeLang); | ||
|
||
await p; | ||
|
||
i18nLoaded = true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"extends": "../../tsconfig.base.json", | ||
"compilerOptions": { | ||
"declaration": true, | ||
"declarationMap": true, | ||
"sourceMap": true, | ||
"composite": true, | ||
"outDir": "./dist" | ||
}, | ||
"include": ["src", "vars/**/*.json", "locales/**/*.json"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
node_modules/ | ||
dist/ | ||
public/ | ||
*.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"name": "@netless/flat-server-api", | ||
"version": "0.1.0", | ||
"description": "Flat Server API", | ||
"main": "src/index.ts", | ||
"private": true, | ||
"license": "MIT", | ||
"scripts": { | ||
"build": "tsc" | ||
}, | ||
"peerDependencies": { | ||
"axios": "0.x" | ||
}, | ||
"devDependencies": { | ||
"axios": "^0.26.1", | ||
"prettier": "^2.3.0", | ||
"typescript": "^4.6.2" | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.