Skip to content
This repository was archived by the owner on Jul 30, 2025. It is now read-only.

Commit be0b1fe

Browse files
committed
fix(plugins/plugin-client-common): Theme switching from StatusStripe widget should be quiet
part of #7961
1 parent 5cf5062 commit be0b1fe

File tree

1 file changed

+9
-46
lines changed
  • plugins/plugin-client-common/src/components/Client/StatusStripe

1 file changed

+9
-46
lines changed

plugins/plugin-client-common/src/components/Client/StatusStripe/Settings.tsx

Lines changed: 9 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,9 @@ import {
2222
getPersistedThemeChoice,
2323
i18n,
2424
pexecInCurrentTab,
25-
uiThemes,
26-
Theme
25+
uiThemes
2726
} from '@kui-shell/core'
2827

29-
import { Loading } from '../../..'
3028
import DropdownWidget, { Props as DropdownWidgetProps } from './DropdownWidget'
3129

3230
const strings = i18n('plugin-client-common')
@@ -35,7 +33,7 @@ type Props = Pick<DropdownWidgetProps, 'position'>
3533

3634
interface State {
3735
currentTheme: string
38-
themes: Theme[]
36+
actions: DropdownWidgetProps['actions']
3937
}
4038

4139
export default class Settings extends React.PureComponent<Props, State> {
@@ -44,7 +42,7 @@ export default class Settings extends React.PureComponent<Props, State> {
4442

4543
this.state = {
4644
currentTheme: undefined,
47-
themes: []
45+
actions: []
4846
}
4947

5048
this.recomputeThemeList()
@@ -64,46 +62,15 @@ export default class Settings extends React.PureComponent<Props, State> {
6462

6563
this.setState({
6664
currentTheme,
67-
themes: themes
65+
actions: themes.map(_ => ({
66+
label: _.name,
67+
isSelected: _.name === currentTheme,
68+
handler: () => pexecInCurrentTab(`theme set ${encodeComponent(_.name)}`, undefined, true)
69+
}))
6870
})
6971
}
7072

71-
private header() {
72-
if (!this.state.currentTheme) {
73-
return <Loading />
74-
} else {
75-
return (
76-
<React.Fragment>
77-
<div>{strings('Current Theme')}</div>
78-
<div>
79-
<strong>{this.state.currentTheme}</strong>
80-
</div>
81-
<div className="sub-text even-smaller-text">{this.changeTheme()}</div>
82-
</React.Fragment>
83-
)
84-
}
85-
}
86-
87-
private body() {
88-
if (!this.state.currentTheme) {
89-
return <Loading />
90-
} else {
91-
return <React.Fragment />
92-
}
93-
}
94-
95-
/** @return UI for changing themes */
96-
private changeTheme() {
97-
return (
98-
<a href="#" onClick={() => pexecInCurrentTab('themes')}>
99-
{strings('Switch theme')}
100-
</a>
101-
)
102-
}
103-
10473
public render() {
105-
// aria-label="Settings"
106-
// tabIndex={0}
10774
if (!this.state || !this.state.currentTheme) {
10875
return <React.Fragment />
10976
}
@@ -113,11 +80,7 @@ export default class Settings extends React.PureComponent<Props, State> {
11380
noPadding
11481
id="kui--settings-widget"
11582
title={strings('Switch theme')}
116-
actions={this.state.themes.map(_ => ({
117-
label: _.name,
118-
isSelected: _.name === this.state.currentTheme,
119-
handler: () => pexecInCurrentTab(`theme set ${encodeComponent(_.name)}`)
120-
}))}
83+
actions={this.state.actions}
12184
/>
12285
)
12386
}

0 commit comments

Comments
 (0)