Page MenuHomePhabricator

[web] Add danger zone page
ClosedPublic

Authored by tomek on May 19 2022, 8:35 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Nov 14, 4:29 AM
Unknown Object (File)
Wed, Nov 13, 7:23 PM
Unknown Object (File)
Wed, Nov 13, 7:23 PM
Unknown Object (File)
Mon, Oct 28, 3:03 AM
Unknown Object (File)
Mon, Oct 28, 3:03 AM
Unknown Object (File)
Mon, Oct 28, 3:03 AM
Unknown Object (File)
Mon, Oct 28, 3:02 AM
Unknown Object (File)
Mon, Oct 28, 2:50 AM

Details

Summary

Add new page and connect it to the route so that it is displayed when a navigation item is selected.

danger_zone2.png (666×1 px, 39 KB)

Depends on D4093

Test Plan

Open danger zone and check if the header is displayed.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

tomek requested review of this revision.May 19 2022, 8:41 AM

Minor refactor suggestion, but otherwise looks good!

web/app.react.js
152–165 ↗(On Diff #12958)

Wonder if something like this could be cleaner?


Pasted below because the "suggestion" diff can be hard to read:

let mainContent;
const { tab, settingsSection } = this.props.navInfo;
if (tab === 'calendar') {
  mainContent = <Calendar url={this.props.location.pathname} />;
} else if (tab === 'chat') {
  mainContent = <Chat />;
} else if (tab === 'apps') {
  mainContent = <AppsDirectory />;
} else if (tab === 'settings' && settingsSection === 'account') {
  mainContent = <AccountSettings />;
} else if (tab === 'settings' && settingsSection === 'danger-zone') {
  mainContent = <DangerZone />;
}
This revision is now accepted and ready to land.May 19 2022, 11:16 AM
web/app.react.js
152–165 ↗(On Diff #12958)

For me having nested ifs here increases the readability, because it is really clear which branches are for which tab. When we have flat structure we need to repeat a part of the condition which is less maintainable due to duplication.

If you feel strongly, I can change it. But I don't think it is better.

web/app.react.js
152–165 ↗(On Diff #12958)

Ok yeah that makes sense. Thoughts on destructuring tab and settingsSection from this.props.navInfo to make things a bit less verbose?

web/app.react.js
152–165 ↗(On Diff #12958)

Destructuring makes sense!

This revision was automatically updated to reflect the committed changes.