[space] Prettify chat and discussion loading state

GitOrigin-RevId: 932bcfcca88e2cfb0810eec14ef0404da242cdd9
This commit is contained in:
Nikolay Rykunov
2021-02-18 23:19:16 +00:00
committed by intellij-monorepo-bot
parent e506aacce9
commit 1b615aa69c
5 changed files with 30 additions and 9 deletions
@@ -32,7 +32,7 @@ internal class SpaceChatContentPanel(
private val lifetime: Lifetime,
parent: Disposable,
channelsVm: ChannelsVm,
chatRecord: Ref<M2ChannelRecord>,
chatRecord: Ref<M2ChannelRecord>
) : SpaceChatContentPanelBase(lifetime, parent, channelsVm, chatRecord) {
private val server = channelsVm.client.server
@@ -1,4 +1,4 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.space.chat.ui
import circlet.client.api.M2ChannelRecord
@@ -10,12 +10,15 @@ import com.intellij.openapi.editor.colors.EditorColorsManager
import com.intellij.ui.ComponentUtil
import com.intellij.ui.components.JBLoadingPanel
import com.intellij.util.concurrency.annotations.RequiresEdt
import com.intellij.util.ui.JBUI
import com.intellij.util.ui.UIUtil
import com.intellij.util.ui.components.BorderLayoutPanel
import libraries.coroutines.extra.Lifetime
import libraries.coroutines.extra.launch
import org.jetbrains.annotations.Nls
import runtime.Ui
import java.awt.BorderLayout
import java.awt.Dimension
import java.awt.event.MouseEvent
import java.awt.event.MouseMotionAdapter
import javax.swing.JComponent
@@ -26,9 +29,16 @@ internal abstract class SpaceChatContentPanelBase(
private val channelsVm: ChannelsVm,
private val chatRecord: Ref<M2ChannelRecord>
) : BorderLayoutPanel() {
private val loadingPanel = JBLoadingPanel(BorderLayout(), parent).apply {
startLoading()
isOpaque = false
private val loadingPanel = object : JBLoadingPanel(BorderLayout(), parent) {
init {
startLoading()
isOpaque = false
}
override fun getPreferredSize(): Dimension {
val size = super.getPreferredSize()
return Dimension(size.width, size.height.takeIf { it != 0 } ?: JBUI.scale(80))
}
}
init {
@@ -75,4 +85,8 @@ internal abstract class SpaceChatContentPanelBase(
loadingPanel.repaint()
}
}
fun setLoadingText(@Nls text: String) {
loadingPanel.setLoadingText(text)
}
}
@@ -1,4 +1,4 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.space.chat.ui
import circlet.client.api.M2ChannelRecord
@@ -9,6 +9,7 @@ import com.intellij.openapi.editor.colors.EditorColorsManager
import com.intellij.openapi.project.Project
import com.intellij.space.chat.model.api.SpaceChatHeaderDetails
import com.intellij.space.chat.ui.header.createComponent
import com.intellij.space.messages.SpaceBundle
import com.intellij.ui.ScrollPaneFactory
import com.intellij.util.ui.JBUI
import com.intellij.util.ui.components.BorderLayoutPanel
@@ -48,7 +49,9 @@ internal class SpaceChatPanel(
}
private fun createContentComponent(): JComponent {
val contentPanel = SpaceChatContentPanel(project, lifetime, parent, channelsVm, chatRecord)
val contentPanel = SpaceChatContentPanel(project, lifetime, parent, channelsVm, chatRecord).apply {
setLoadingText(SpaceBundle.message("chat.loading.text"))
}
return JPanel(null).apply {
isOpaque = false
@@ -13,6 +13,7 @@ import com.intellij.space.chat.model.impl.SpaceChatItemImpl.Companion.convertToC
import com.intellij.space.chat.ui.discussion.SpaceChatDiscussionActionsFactory
import com.intellij.space.chat.ui.getLink
import com.intellij.space.chat.ui.thread.SpaceChatStandaloneThreadComponent
import com.intellij.space.messages.SpaceBundle
import com.intellij.space.vcs.review.details.SpaceReviewChange
import com.intellij.util.ui.JBUI
import com.intellij.util.ui.codereview.comment.wrapComponentUsingRoundedPanel
@@ -68,5 +69,7 @@ internal class SpaceReviewCommentPanelFactory(
}
)
}
)
).apply {
setLoadingText(SpaceBundle.message("review.diff.loading.discussion.text"))
}
}
@@ -59,7 +59,6 @@ group.SpaceGroup.text=Space
group.com.intellij.space.vcs.OpenChecklists.text=Open Checklists...
group.com.intellij.space.vcs.OpenIssues.text=Open Issues...
group.com.intellij.space.vcs.OpenReviews.text=Open Code Reviews...
group.com.intellij.space.vcs.SpaceVcsOpenInBrowserActionGroup.text=Open On Space
kts.file.login.error=You need to login to Space to enable support for this file
kts.file.dependencies.error=Could not download dependencies for .space.kts file
@@ -145,6 +144,7 @@ tab.title.space.automation.dsl=Space Automation DSL
chat.comment.action.text=Comment
chat.editor.name=Space Chat Editor
chat.filetype.description=Space chat
chat.loading.text=Loading chat...
chat.message.action.delete.tooltip=Delete message
chat.message.action.edit.tooltip=Edit message
chat.message.action.start.thread.tooltip=Start thread
@@ -211,6 +211,7 @@ review.changes.browser.failure.text=Could not load changed files
review.diff.filetype.description=Space review diff
review.diff.tab.title=Diff for {0}
review.diff.editor.name=Space Diff Editor
review.diff.loading.discussion.text=Loading discussion...
review.label.created.at.time=Created {0}
review.label.created.by.user.at.time=Created by {0} {1}
review.by.author.at.time={0} by {1} {2}