Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for rendering a custom wrapper around Element #25537

Merged
merged 13 commits into from
Aug 30, 2023
30 changes: 19 additions & 11 deletions src/vector/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ import { SnakedObject } from "matrix-react-sdk/src/utils/SnakedObject";
import MatrixChat from "matrix-react-sdk/src/components/structures/MatrixChat";
import { ValidatedServerConfig } from "matrix-react-sdk/src/utils/ValidatedServerConfig";
import { QueryDict, encodeParams } from "matrix-js-sdk/src/utils";
import { BannerLifecycle, BannerOpts } from "@matrix-org/react-sdk-module-api/lib/lifecycles/BannerLifecycle";
import { ModuleRunner } from "matrix-react-sdk/src/modules/ModuleRunner";

import { parseQs } from "./url_utils";
import VectorBasePlatform from "./platform/VectorBasePlatform";
Expand Down Expand Up @@ -129,18 +131,24 @@ export async function loadApp(fragParams: {}): Promise<ReactElement> {
const defaultDeviceName =
snakedConfig.get("default_device_display_name") ?? platform?.getDefaultDeviceDisplayName();

const opts: BannerOpts = { banner: undefined };
ModuleRunner.instance.invoke(BannerLifecycle.Banner, opts);

return (
<MatrixChat
onNewScreen={onNewScreen}
makeRegistrationUrl={makeRegistrationUrl}
config={config}
realQueryParams={params}
startingFragmentQueryParams={fragParams}
enableGuest={!config.disable_guests}
onTokenLoginCompleted={onTokenLoginCompleted}
initialScreenAfterLogin={getScreenFromLocation(window.location)}
defaultDeviceDisplayName={defaultDeviceName}
/>
<>
{opts.banner}
<MatrixChat
onNewScreen={onNewScreen}
makeRegistrationUrl={makeRegistrationUrl}
config={config}
realQueryParams={params}
startingFragmentQueryParams={fragParams}
enableGuest={!config.disable_guests}
onTokenLoginCompleted={onTokenLoginCompleted}
initialScreenAfterLogin={getScreenFromLocation(window.location)}
defaultDeviceDisplayName={defaultDeviceName}
/>
</>
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/vector/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
</head>
<body style="height: 100%; margin: 0;">
<noscript>Sorry, Element requires JavaScript to be enabled.</noscript> <!-- TODO: Translate this? -->
<section id="matrixchat" style="height: 100%;" class="notranslate"></section>
<section id="matrixchat" style="height: 100%; display: flex; flex-direction: column;" class="notranslate"></section>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would not be needed once moving to the new wrapper suggestion

Suggested change
<section id="matrixchat" style="height: 100%; display: flex; flex-direction: column;" class="notranslate"></section>
<section id="matrixchat" style="height: 100%;" class="notranslate"></section>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change is removed as not needed, thanks!

<script src="<%= htmlWebpackPlugin.files.js.find(entry => entry.includes("bundle.js")) %>"></script>

<!-- Legacy supporting Prefetch images -->
Expand Down