Skip to content

Commit

Permalink
fix #33009
Browse files Browse the repository at this point in the history
(cherry picked from commit c1cd739)
  • Loading branch information
marcozanghi authored and gsmet committed May 9, 2023
1 parent 7b415fe commit de72415
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ export class QuiBadge extends LitElement {
this.background = null;
this.color = null;
this.small = false;
this.small = false;
this.primary = false;
this.pill = false;
this.clickable = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { devuiState } from 'devui-state';
import { observeState } from 'lit-element-state';
import 'qwc/qwc-extension.js';
import 'qwc/qwc-extension-link.js';
import 'qui-badge';


/**
* This component create cards of all the extensions
Expand Down Expand Up @@ -40,23 +42,26 @@ export class QwcExtensions extends observeState(LitElement) {
flex-flow: column wrap;
padding-top: 5px;
}
`;
.float-right {
align-self: flex-end;
}
`;

render() {
return html`<div class="grid">
${devuiState.cards.active.map(extension => this._renderActive(extension))}
${devuiState.cards.inactive.map(extension => this._renderInactive(extension))}
</div>`;
}

_renderActive(extension){
extension.cardPages.forEach(page => {
extension.cardPages.forEach(page => {
if(page.embed){ // we need to register with the router
import(page.componentRef);
this.routerController.addRouteForExtension(page);
}
});

return html`
<qwc-extension
clazz="active"
Expand Down Expand Up @@ -101,21 +106,24 @@ export class QwcExtensions extends observeState(LitElement) {
namespace="${extension.namespace}">
</${extension.card.componentName}>`;

return html`${unsafeHTML(customCardCode)}`;

}

_renderDefaultCardContent(extension){

return html`<div class="card-content" slot="content">
<span class="description">${extension.description}</span>
${this._renderCardLinks(extension)}
</div>`;
return html`
<div class="card-content" slot="content">
<span class="description">
${this._renderExperimentalBadge(extension)}
${extension.description}
</span>
${this._renderCardLinks(extension)}
</div>`;
}

_renderCardLinks(extension){

return html`${extension.cardPages.map(page => html`
<qwc-extension-link slot="link"
namespace="${extension.namespace}"
Expand All @@ -135,28 +143,33 @@ export class QwcExtensions extends observeState(LitElement) {

_renderInactive(extension){
if(extension.unlisted === "false"){
return html`
<qwc-extension
clazz="inactive"
name="${extension.name}"
description="${extension.description}"
guide="${extension.guide}"
namespace="${extension.namespace}"
artifact="${extension.artifact}"
shortName="${extension.shortName}"
keywords="${extension.keywords}"
status="${extension.status}"
configFilter="${extension.configFilter}"
categories="${extension.categories}"
unlisted="${extension.unlisted}"
builtWith="${extension.builtWith}"
providesCapabilities="${extension.providesCapabilities}"
extensionDependencies="${extension.extensionDependencies}">
<div class="card-content" slot="content">
${extension.description}
</div>
</qwc-extension>
`;
return html`<qwc-extension
clazz="inactive"
name="${extension.name}"
description="${extension.description}"
guide="${extension.guide}"
namespace="${extension.namespace}"
artifact="${extension.artifact}"
shortName="${extension.shortName}"
keywords="${extension.keywords}"
status="${extension.status}"
configFilter="${extension.configFilter}"
categories="${extension.categories}"
unlisted="${extension.unlisted}"
builtWith="${extension.builtWith}"
providesCapabilities="${extension.providesCapabilities}"
extensionDependencies="${extension.extensionDependencies}">
<div class="card-content" slot="content">
${this._renderExperimentalBadge(extension)}
${extension.description}
</div>
</qwc-extension>`;
}
}

_renderExperimentalBadge(extension){
if(extension.status === "experimental") {
return html`<qui-badge level="warning" class="float-right" small><span>EXPERIMENTAL</span></qui-badge>`;
}
}

Expand Down

0 comments on commit de72415

Please sign in to comment.