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)
Sat, Jun 29, 12:09 PM
Unknown Object (File)
Sat, Jun 29, 11:42 AM
Unknown Object (File)
Fri, Jun 28, 1:51 AM
Unknown Object (File)
Mon, Jun 24, 4:43 PM
Unknown Object (File)
Sat, Jun 22, 8:18 PM
Unknown Object (File)
Thu, Jun 20, 1:18 AM
Unknown Object (File)
Sun, Jun 16, 5:27 PM
Unknown Object (File)
Fri, Jun 7, 6:23 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
Branch
ENG-835
Lint
No Lint Coverage
Unit
No Test Coverage

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

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

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

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

Destructuring makes sense!

This revision was automatically updated to reflect the committed changes.