Skip to content

Commit

Permalink
fix display of empty topics message (#638)
Browse files Browse the repository at this point in the history
* fix display of empty topics message

so it's visible based on selected my/company topics.

CPCN-415

* fix 0 handling in gettext replace
  • Loading branch information
petrjasek authored Oct 26, 2023
1 parent 094619a commit 1cf903a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions assets/components/PersonalizeHomeModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,14 @@ class PersonalizeHomeModal extends React.Component<IProps, IState> {

const topicSearch = (searchMatches?.length ?? 0) > 0
? (
<div style={{padding: 4}}>
<div className='boxed-checklist'>
{searchMatches}
</div>
) : <NoSearchMatches />;
) : null;

const hasTopics = (filteredTopics(this.wireTopics).length ?? 0) > 0;

const groupedTopics = (this.props.topics?.length ?? 0) > 0 ? (
const groupedTopics = hasTopics ? (
<div>
<div className='boxed-checklist'>
{filteredTopics(this.wireTopics).map((wireTopic) => (
Expand Down Expand Up @@ -309,7 +311,7 @@ class PersonalizeHomeModal extends React.Component<IProps, IState> {
</div>
</form>
</div>
{this.state.searchTerm ? topicSearch : groupedTopics}
{this.state.searchTerm && hasTopics ? topicSearch : groupedTopics}
</div>
</aside>
<div
Expand Down
2 changes: 1 addition & 1 deletion assets/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export function gettext(text: string, params?: {[key: string]: any}): string {
if (params) {
Object.keys(params).forEach((param: string) => {
const paramRegexp = new RegExp('{{ ?' + param + ' ?}}', 'g');
translated = translated.replace(paramRegexp, params[param] || '');
translated = translated.replace(paramRegexp, params[param] != null ? params[param] : '');
});
}

Expand Down

0 comments on commit 1cf903a

Please sign in to comment.