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

Componentnize NewNoteButton #800

Merged
merged 9 commits into from
Aug 14, 2017
Merged

Componentnize NewNoteButton #800

merged 9 commits into from
Aug 14, 2017

Conversation

asmsuechan
Copy link
Contributor

@asmsuechan asmsuechan commented Aug 13, 2017

context

Separation NewNoteButton from TopBar.

before

image

image

before(Trash)

8fb0f4979a82c703b4c74d14d61a1e6e

after

I hope the layout isn't changed.
image

image

after(Trash)

image

for tests

  • open modal
  • create Markdown note
  • create Snippet note
  • show tooltip (and the content is correct on Mac or others)
  • open modal (first-time Boostntoe launched)
  • cannot be shown this in trash
  • shown properly on dark theme and light theme
  • shown properly even the width of the list is changed

note

I just move the code, so I'll have to refactor them.

memo: delete DeleteArticleModal

Make sure whether all props are passed properly.

@BoostnoteBot
Copy link
Collaborator

Please make sure to be pasted screenshots of all your changes.


// Find first storage
if (storage == null) {
for (let kv of data.storageMap) {
Copy link
Contributor Author

@asmsuechan asmsuechan Aug 13, 2017

Choose a reason for hiding this comment

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

I want to seek better way: for

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I know this if condition is not good, but I don't know what exactly it is. So I choose a way not to change them.

break
}
}
if (storage == null) window.alert('No storage to create a note')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I want to seek better way: window.alert


createNote (noteType) {
let { dispatch, location } = this.props
if (noteType !== 'MARKDOWN_NOTE' && noteType !== 'SNIPPET_NOTE') throw new Error('Invalid note type.')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is this really needed?


let { storage, folder } = this.resolveTargetFolder()

let newNote = noteType === 'MARKDOWN_NOTE'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I want to seek better way

})
}

setDefaultNote (defaultNote) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is this really used?

Copy link
Member

Choose a reason for hiding this comment

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

It was used in the old version, but not used now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Understood.

height $topBar-height - 1
margin-left: auto;
width: 64px;
margin-right: -15px;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added these three lines for this change.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks!

return
}

switch (config.ui.defaultNote) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Deleted because defaultNote is not configurable in Preferences now.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks!

@@ -147,60 +66,6 @@ class TopBar extends React.Component {
}
}

createNote (noteType) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Deleted accompanied with handleNewPostButtonClick()

})
}

setDefaultNote (defaultNote) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Deleted because it's no longer used.

Copy link
Member

Choose a reason for hiding this comment

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

👍

@@ -1,51 +0,0 @@
import React, { PropTypes } from 'react'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Deleted because this file is no longer used.


render () {
const { config, style, data, location } = this.props
if (location.pathname === '/trashed') {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed a specification.

before

NewNoteButton was shown in Trash but a warning appeared when a user clicked this.

after

NewNoteButton is no longer shown in Trash.

Copy link
Member

Choose a reason for hiding this comment

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

Great🎉

@asmsuechan asmsuechan changed the title [WIP] Componentnize NewNoteButton Componentnize NewNoteButton Aug 14, 2017
@asmsuechan
Copy link
Contributor Author

The layout is a bit strange.
image

@asmsuechan asmsuechan merged commit f2a03e4 into BoostIO:master Aug 14, 2017
@asmsuechan asmsuechan deleted the componentnize-NewNoteButton branch August 14, 2017 02:45
@kazup01 kazup01 mentioned this pull request Sep 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants