Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Position toggle switch more clearly #6914

Merged
merged 3 commits into from
Oct 19, 2021
Merged
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: 1 addition & 2 deletions res/css/views/settings/_SetIntegrationManager.scss
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,11 @@ limitations under the License.
.mx_SetIntegrationManager > .mx_SettingsTab_heading > .mx_SettingsTab_subheading {
display: inline-block;
padding-left: 5px;
margin-top: 0px;
}

.mx_SetIntegrationManager .mx_ToggleSwitch {
display: inline-block;
float: right;
top: 9px;

@mixin mx_Settings_fullWidthField;
}
10 changes: 6 additions & 4 deletions src/components/views/settings/SetIntegrationManager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ import React from 'react';
import { _t } from "../../../languageHandler";
import { IntegrationManagers } from "../../../integrations/IntegrationManagers";
import { IntegrationManagerInstance } from "../../../integrations/IntegrationManagerInstance";
import * as sdk from '../../../index';
import SettingsStore from "../../../settings/SettingsStore";
import { SettingLevel } from "../../../settings/SettingLevel";
import { replaceableComponent } from "../../../utils/replaceableComponent";
import ToggleSwitch from "../elements/ToggleSwitch";

interface IProps {

Expand Down Expand Up @@ -57,8 +57,6 @@ export default class SetIntegrationManager extends React.Component<IProps, IStat
};

public render(): React.ReactNode {
const ToggleSwitch = sdk.getComponent("views.elements.ToggleSwitch");

const currentManager = this.state.currentManager;
let managerName;
let bodyText;
Expand All @@ -79,7 +77,11 @@ export default class SetIntegrationManager extends React.Component<IProps, IStat
<div className="mx_SettingsTab_heading">
<span>{ _t("Manage integrations") }</span>
<span className="mx_SettingsTab_subheading">{ managerName }</span>
<ToggleSwitch checked={this.state.provisioningEnabled} onChange={this.onProvisioningToggled} />
<ToggleSwitch
checked={this.state.provisioningEnabled}
disabled={false}
Copy link
Contributor

@SimonBrandner SimonBrandner Oct 16, 2021

Choose a reason for hiding this comment

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

Why is this necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You mean the disabled property? A check was failing because I didn't include it. I think it's because I used a regular import instead of using sdk.getComponent:

...

src/verification.ts -> lib/verification.js
src/widgets/CapabilityText.tsx -> lib/widgets/CapabilityText.js
src/widgets/Jitsi.ts -> lib/widgets/Jitsi.js
src/widgets/ManagedHybrid.ts -> lib/widgets/ManagedHybrid.js
src/widgets/WidgetType.ts -> lib/widgets/WidgetType.js
src/workers/blurhash.worker.ts -> lib/workers/blurhash.worker.js
src/workers/indexeddb.worker.ts -> lib/workers/indexeddb.worker.js
Successfully compiled 846 files with Babel (34459ms).
$ tsc --emitDeclarationOnly --jsx react
src/components/views/settings/SetIntegrationManager.tsx:81:22 - error TS2741: Property 'disabled' is missing in type '{ checked: boolean; onChange: () => void; }' but required in type 'IProps'.
 
81                     <ToggleSwitch checked={this.state.provisioningEnabled} onChange={this.onProvisioningToggled} />
                        ~~~~~~~~~~~~
 
  src/components/views/elements/ToggleSwitch.tsx:27:5
    27     disabled: boolean;
           ~~~~~~~~
    'disabled' is declared here.
 
Found 1 error.
 
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
🚨 Error: The command exited with status 1
user command error: The plugin docker command hook exited with status 1

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, sorry, didn't realize it wasn't optional 🤦‍♂️

Copy link
Member

Choose a reason for hiding this comment

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

we should probably make it optional, but this is fine too

onChange={this.onProvisioningToggled}
/>
</div>
<span className="mx_SettingsTab_subsectionText">
{ bodyText }
Expand Down