mirror of
https://github.com/wassname/talk.git
synced 2026-07-10 00:52:51 +08:00
65c8da0f34
* Merge client * Add linting script * Rename serve to start:development * Move error harmonization and handling to network layer * Show Comment Stream * Added initial test
38 lines
867 B
TypeScript
38 lines
867 B
TypeScript
import React from "react";
|
|
import { StatelessComponent } from "react";
|
|
import ReactDOM from "react-dom";
|
|
|
|
import {
|
|
createContext,
|
|
TalkContext,
|
|
TalkContextProvider,
|
|
} from "talk-framework/lib/bootstrap";
|
|
|
|
import { initLocalState } from "./local";
|
|
import localesData from "./locales";
|
|
import AppQuery from "./queries/AppQuery";
|
|
|
|
// This is called when the context is first initialized.
|
|
async function init({ relayEnvironment }: TalkContext) {
|
|
await initLocalState(relayEnvironment);
|
|
}
|
|
|
|
async function main() {
|
|
// Bootstrap our context.
|
|
const context = await createContext({
|
|
init,
|
|
localesData,
|
|
userLocales: navigator.languages,
|
|
});
|
|
|
|
const Index: StatelessComponent = () => (
|
|
<TalkContextProvider value={context}>
|
|
<AppQuery />
|
|
</TalkContextProvider>
|
|
);
|
|
|
|
ReactDOM.render(<Index />, document.getElementById("app"));
|
|
}
|
|
|
|
main();
|