-
Notifications
You must be signed in to change notification settings - Fork 217
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
imprv: Show modal when enabling Textlint #4373
Conversation
…seek/growi into fix/77789-dict-path-on-server
|
||
type DownloadDictModalProps = { | ||
isModalOpen: boolean | ||
isDontAskAgainChecked: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isDontAskAgainChecked は不要。なぜなら「二度と聞かない」を ON にしたあとは、このモーダルは開かれることすらないから。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
対応しました
isModalOpen: boolean | ||
isDontAskAgainChecked: boolean; | ||
onConfirmEnableTextlint: () => void; | ||
onCancel: () => void; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
onHoge は nullable にする。呼び出すときは null チェックをする。
onConfirmEnableTextlint を呼んだ時は、isDontAskAgainChecked にあたる boolean も引数に入れる。
ただし、dont ask という否定系の名前は避ける。代案はパッといいのは思いつかないけど例えば isSkipCheckingAfterThis とか。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
対応済
isDontAskAgainChecked: boolean; | ||
onConfirmEnableTextlint: () => void; | ||
onCancel: () => void; | ||
dontAskAgainCheckboxHandler: (isChecked: boolean) => void; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dontAskAgainCheckboxHandler は不要
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
対応済
if (editorContainer.state.isTextlintEnabled === null) { | ||
this.setState({ isDownloadDictModalShown: true }); | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ここまではいい。
ここを通過してモーダルを開かなかった場合は、新規メソッドを作ってそれを呼ぶ。
confirmEnableTextlintHandler からもそれを呼ぶことになる。
<span className="ml-2 ml-sm-4">{this.renderConfigurationDropdown()}</span> | ||
</div> | ||
|
||
<DownloadDictModal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isDontAskAgainChecked が true になったら、レンダリングすらしなくていい。
confirmEnableTextlintHandler(isSkipAskingAgainChecked) { | ||
this.setState( | ||
{ isSkipAskingAgainChecked, isDownloadDictModalShown: false }, | ||
() => this.toggleTextlint(), | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.toggleTextlint()
をcallbackに入れずに実行しようとするとsetStateの前に走ってしまう。
setState
はasyncではあるがPromiseを返しているわけではないのでasync awaitは使えない。
参考: StackOverflow | React setState not updating state
{!this.state.isSkipAskingAgainChecked && ( | ||
<DownloadDictModal | ||
isModalOpen={this.state.isDownloadDictModalShown} | ||
onConfirmEnableTextlint={this.confirmEnableTextlintHandler} | ||
onCancel={() => this.setState({ isDownloadDictModalShown: false })} | ||
/> | ||
)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isSkipAskingAgainChecked: true
の場合、Renderしない
…t/77515-77833-arrange-component-temporaly * feat/77515-display-search-result-with-snippet: (47 commits) revert wip show snippet wip fix presentation of snippets send search result make the first SlackAppIntegration primary replace add-app-to-this-channel image fix: New user is created on SAML login even if attribute-based login control failure (#4422) fix: Redirected to apiv3 endpoint when guest mode is enabled (#4443) imprv: Show modal when enabling Textlint (#4373) imprv: Slackbot reaction to user (#4442) update dependabot setting fix(slackbot): Stop auto-join to channels with middlewarer (#4424) Bump version Release v4.4.7 imprv: Slackbot search (#4420) update release-slackbot-proxy.yml Bump version bump version for slackbot-proxy add npm script for bump-versions fix(slackbot): Sync permission when data stored is not enough (#4417) ... # Conflicts: # packages/app/src/components/SearchPage/SearchResult.jsx
タスク
内容
英語(ダークモード)
日本語(ダークモード)
中国語(ライトモード)
ロジック
Editor画面初回マウント時
Editor画面2回目以降マウント時