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

Commit a3b31d8

Browse files
committed
fix(plugins/plugin-client-common): regression in boldface in status stripe "Now playing" message
1 parent f48be7e commit a3b31d8

File tree

1 file changed

+20
-1
lines changed
  • plugins/plugin-client-common/src/components/Client/StatusStripe

1 file changed

+20
-1
lines changed

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

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,25 @@ export default class StatusStripe extends React.PureComponent<Props, State> {
8585
return <div style={{ flex: 1 }} />
8686
}
8787

88+
/** Simplistic Markdown, to help with performance. Our full Markdown.tsx is pretty heavy-weight. */
89+
private simpleMarkdown(str: string) {
90+
const msg = decode(str)
91+
const pat = /\*\*[^*]+\*\*/g
92+
const bolds = msg.match(pat)
93+
94+
return msg.split(pat).reduce(
95+
(M, _) => {
96+
if (_ === '') {
97+
M.A.push(<strong>{bolds[M.idx++].replace(/\*\*/g, '')}</strong>)
98+
} else {
99+
M.A.push(_)
100+
}
101+
return M
102+
},
103+
{ A: [], idx: 0 }
104+
).A
105+
}
106+
88107
/**
89108
* Render the current State.message, if any
90109
*
@@ -93,7 +112,7 @@ export default class StatusStripe extends React.PureComponent<Props, State> {
93112
if (this.state.type !== 'default' && this.state.message) {
94113
return (
95114
<div className="kui--status-stripe-element left-pad kui--status-stripe-message-element">
96-
{decode(this.state.message)}
115+
{this.simpleMarkdown(this.state.message)}
97116
</div>
98117
)
99118
}

0 commit comments

Comments
 (0)