Skip to content

Commit

Permalink
fix(plugins/plugin-client-common): sidecar screenshot button is visib…
Browse files Browse the repository at this point in the history
…le even inBrowser
  • Loading branch information
myan9 authored and k8s-ci-robot committed May 28, 2021
1 parent 8bcf21d commit 860981a
Showing 1 changed file with 2 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,12 @@
*/

import React from 'react'
import { REPL, inBrowser, i18n } from '@kui-shell/core'
import { REPL, inBrowser } from '@kui-shell/core'

import Width from './width'
import Icons from '../../spi/Icons'
import DropDown from '../../spi/DropDown'
import Breadcrumb, { BreadcrumbView } from '../../spi/Breadcrumb'

const strings = i18n('plugin-client-common', 'screenshot')

export interface Props {
kind?: string
name?: string
Expand Down Expand Up @@ -75,39 +72,6 @@ export default class Window extends React.PureComponent<Props> {

private readonly _toggleMaximization = this.toggleMaximization.bind(this)

private toggleClose() {
this.props.onClose()
}

private screenshotAction() {
if (inBrowser()) {
return []
} else {
return [
{
label: strings('Screenshot'),
handler: () => this.props.willScreenshot()
}
]
}
}

private overflowButton() {
if (this.props.width !== Width.Closed) {
const actions = this.screenshotAction()

if (actions.length > 0) {
return (
<div className="sidecar-bottom-stripe-button">
<a href="#">
<DropDown actions={actions} className="kui--sidecar-overflow kui--repl-block-right-element" />
</a>
</div>
)
}
}
}

private readonly _preventDefault = (evt: React.MouseEvent) => evt.preventDefault()

private screenshotButton() {
Expand Down Expand Up @@ -252,7 +216,7 @@ export default class Window extends React.PureComponent<Props> {

<div className="sidecar-bottom-stripe-right-bits">
<div className="sidecar-window-buttons">
{this.screenshotButton()}
{!inBrowser() && this.screenshotButton()}
{this.maximizeButton()}
{!this.props.notCloseable && this.quitButton()}
</div>
Expand Down

0 comments on commit 860981a

Please sign in to comment.