Skip to content
This repository was archived by the owner on Dec 23, 2021. It is now read-only.

Tabs to switch devices #183

Merged
merged 12 commits into from
Feb 3, 2020
Merged

Tabs to switch devices #183

merged 12 commits into from
Feb 3, 2020

Conversation

xnkevinnguyen
Copy link
Contributor

@xnkevinnguyen xnkevinnguyen commented Jan 28, 2020

Description:

Switch between microbit and cpx device

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Type of change

  • New feature (non-breaking change which adds functionality)

Limitations:

Please describe limitations of this PR

Testing:

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Test A
  • Test B

Checklist:

  • My code follows the style guidelines of this project
  • My code has been formatted with npm run format and passes the checks in npm run check
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

… devices component

Linting

Remove unused ressource from device.tsx

Update snapshot for device
@xnkevinnguyen xnkevinnguyen changed the title WIP: Tabs to switch devices Tabs to switch devices Jan 28, 2020
Abstract tab in another component

Abstract tab in another component

Abstract tab in another component

Load devices dynamically

Abstract cpx

Update snapshot
@markAtMicrosoft markAtMicrosoft self-requested a review January 29, 2020 21:12
@xnkevinnguyen xnkevinnguyen mentioned this pull request Jan 30, 2020
13 tasks
Copy link
Collaborator

@sagarmanchanda sagarmanchanda left a comment

Choose a reason for hiding this comment

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

Amazing job 🥇 with the initial PR for microbit. Please make the suggested changes before checking it in.

import App from "./App";

describe("App component should", () => {
it("render correctly", () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: "should render ...."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

noted!

</main>
</div>
);
}

handleDeviceChange = (item?: PivotItem) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: private

+1 for using arrow functions :D

src/view/App.tsx Outdated
}

class App extends React.Component<{}, IState> {
state = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd put this inside the constructor

this.state = initialState

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, declaring initial state makes it more readable

@@ -3,6 +3,8 @@

// Adapted from : https://github.com/microsoft/pxt/blob/master/pxtsim/svg.ts

/* tslint:disable */
Copy link
Collaborator

Choose a reason for hiding this comment

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

What was the reason to add this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That file is currently failing the tslint, but I will fix it

Copy link
Contributor Author

@xnkevinnguyen xnkevinnguyen Jan 31, 2020

Choose a reason for hiding this comment

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

(unrelated to this pr)

interface IProps {
handleTabClick: (item?: PivotItem) => void;
}
export class Tab extends React.Component<IProps, any> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

If it doesn't have a state, consider using React.FC

Also, instead of any, I'd use {} empty state to pass to React.Component

setupSwitch(this.props);
this.updateImage();
} else {
console.log("Cannot find svg");
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we do more than just console.log()? Should we even include console.log(). Not very familiar with this situation to be honest

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed the console log for now

@xnkevinnguyen xnkevinnguyen merged commit 7d9bf29 into dev Feb 3, 2020
@xnkevinnguyen xnkevinnguyen deleted the users/t-xunguy/tabs branch February 3, 2020 22:54
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants