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

[PoC] Use webpack to customize #28

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions customisations.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"src/components/views/dialogs/ServerPickerDialog.tsx": "src/components/views/dialogs/TchapServerPickerDialog.tsx"
Copy link
Contributor

Choose a reason for hiding this comment

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

hmm. Customisations.json, si j'ai bien compris, est limité aux points de customisation definis par element : https://github.com/matrix-org/matrix-react-sdk/tree/develop/src/customisations

Du coup je suis intriguee de savoir si on peut s'en servir pour remplacer n'importe quelle file comme ca...

Webpack module replacement est différent : https://webpack.js.org/plugins/normal-module-replacement-plugin/

Copy link
Contributor

Choose a reason for hiding this comment

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

je pose la question à element

}
19 changes: 12 additions & 7 deletions src/components/views/dialogs/TchapServerPickerDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,18 @@ import SdkConfig from 'matrix-react-sdk/src/SdkConfig';
import { _t } from "matrix-react-sdk/src/languageHandler";
// We import components from the react-sdk like this to avoid " Attempted to get a component before a skin
// has been loaded"
import * as sdk from 'matrix-react-sdk/src/index';
import AutoDiscoveryUtils, { ValidatedServerConfig } from "matrix-react-sdk/src/utils/AutoDiscoveryUtils";

// not needed now
// import * as sdk from 'matrix-react-sdk/src/index';
import AutoDiscoveryUtils, { ValidatedServerConfig } from "matrix-react-sdk/src/utils/AutoDiscoveryUtils";
// directly import the style here as this layer does not support rethemedex at this time so no matrix-react-sdk
// scss variables will be accessible.
// this one still disturb me

import "../../../../res/css/views/dialogs/_TchapServerPickerDialog.scss";
import BaseDialog from "matrix-react-sdk/src/components/views/dialogs/BaseDialog";
import StyledRadioGroup from "matrix-react-sdk/src/components/views/elements/StyledRadioGroup";
import AccessibleButton from "matrix-react-sdk/src/components/views/elements/AccessibleButton";

interface IProps {
title?: string;
Expand All @@ -25,8 +31,6 @@ interface IState {
}

export default class TchapServerPickerDialog extends React.PureComponent<IProps, IState> {
static replaces = 'ServerPickerDialog';

homeServerList;

constructor(props) {
Expand Down Expand Up @@ -75,9 +79,10 @@ export default class TchapServerPickerDialog extends React.PureComponent<IProps,

public render() {
// Imports
const BaseDialog = sdk.getComponent('dialogs.BaseDialog');
const AccessibleButton = sdk.getComponent('elements.AccessibleButton');
const StyledRadioGroup = sdk.getComponent('elements.StyledRadioGroup');
// not needed now
// const BaseDialog = sdk.getComponent('dialogs.BaseDialog');
// const AccessibleButton = sdk.getComponent('elements.AccessibleButton');
// const StyledRadioGroup = sdk.getComponent('elements.StyledRadioGroup');

const radioButtonOptions = this.homeServerList.map(homeServer => {
return {
Expand Down