Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: Align filled marketplace rating stars https://github.com/siyuan-note/siyuan/issues/16711

Danielab0f9be722ac
diff --git a/app/appearance/icons/litheness/icon.js b/app/appearance/icons/litheness/icon.js
index 4d0d1a24c8..df8c3c7695 100644
--- a/app/appearance/icons/litheness/icon.js
+++ b/app/appearance/icons/litheness/icon.js
@@ -378,7 +378,7 @@ document.body.insertAdjacentHTML('afterbegin', `<svg id="iconsLitheness" style="
<symbol id="iconHTML5" viewBox="-3 -3 38 38">
<path d="M24.52 9.38l0.32-3.5h-17.68l0.94 10.68h12.24l-0.44 4.56-3.94 1.060-3.92-1.060-0.26-2.8h-3.5l0.44 5.56 7.24 2h0.080v-0.020l7.18-1.98 1-10.88h-12.88l-0.3-3.62h13.48zM1.92 0h28.16l-2.56 28.76-11.56 3.24-11.48-3.24z"></path>
</symbol>
- <symbol id="iconStar" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round">
+ <symbol id="iconStar" viewBox="0 0 24 24" fill="var(--b3-icon-star-fill, none)" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round">
<path d="M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z"/>
</symbol>
<symbol id="iconSpreadEven" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round">
diff --git a/app/src/assets/scss/business/_config.scss b/app/src/assets/scss/business/_config.scss
index 112508a28f..3eec31b847 100644
--- a/app/src/assets/scss/business/_config.scss
+++ b/app/src/assets/scss/business/_config.scss
@@ -485,11 +485,11 @@
}
&__rating-star {
- display: inline-block;
- font-family: sans-serif;
- font-style: normal;
- line-height: 1;
- text-align: center;
+ --b3-icon-star-fill: currentColor;
+ display: block;
+ flex-shrink: 0;
+ height: 1em;
+ width: 1em;
}
&__rating-stars {
diff --git a/app/src/config/bazaar.ts b/app/src/config/bazaar.ts
index 3f7585926e..d62738953a 100644
--- a/app/src/config/bazaar.ts
+++ b/app/src/config/bazaar.ts
@@ -521,7 +521,7 @@ ${primaryAction ? '<div class="fn__hr"></div>' : ""}
},
_genRatingStarsHTML(value: number) {
const activePercentage = Math.max(0, Math.min(100, value / 5 * 100));
- const stars = Array.from({length: 5}, () => '<span class="config-bazaar__rating-star">&#9733;</span>').join("");
+ const stars = Array.from({length: 5}, () => '<svg class="config-bazaar__rating-star"><use xlink:href="#iconStar"></use></svg>').join("");
return `<span class="config-bazaar__rating-stars" aria-hidden="true">
${stars}
<span class="config-bazaar__rating-stars--active" style="width: ${activePercentage}%">${stars}</span>
@@ -533,7 +533,7 @@ ${primaryAction ? '<div class="fn__hr"></div>' : ""}
}
const rating = normalizeBazaarRating(item.rating);
const summary = bazaar._getRatingSummaryText(rating);
- const content = `<span class="config-bazaar__rating-star" aria-hidden="true">&#9733;</span>
+ const content = `<svg class="config-bazaar__rating-star" aria-hidden="true"><use xlink:href="#iconStar"></use></svg>
<span class="fn__space--small"></span>
<span>${escapeHtml(summary)}</span>`;
if (editable && window.siyuan.user) {
@@ -556,7 +556,7 @@ ${primaryAction ? '<div class="fn__hr"></div>' : ""}
.replace("${count}", count.toLocaleString());
return `<div class="config-bazaar__rating-row" aria-label="${escapeAttr(`${label} ${percentageText}`)}">
<span>${star}</span>
- <span class="config-bazaar__rating-star" aria-hidden="true">&#9733;</span>
+ <svg class="config-bazaar__rating-star" aria-hidden="true"><use xlink:href="#iconStar"></use></svg>
<span class="config-bazaar__rating-track" aria-hidden="true"><span style="width: ${percentage}%"></span></span>
<span>${escapeHtml(percentageText)}</span>
<span>${count.toLocaleString()}</span>
@@ -1550,7 +1550,7 @@ type="checkbox">
const buttons = [1, 2, 3, 4, 5].map((rating) => {
const label = window.siyuan.languages.bazaarRatingStarLabel.replace("${star}", rating.toString());
return `<button type="button" role="radio" data-rating-value="${rating}" aria-checked="${selectedRating === rating}" aria-label="${escapeAttr(label)}" tabindex="${selectedRating === rating || (!selectedRating && rating === 1) ? "0" : "-1"}">
- <span class="config-bazaar__rating-star" aria-hidden="true">&#9733;</span>
+ <svg class="config-bazaar__rating-star" aria-hidden="true"><use xlink:href="#iconStar"></use></svg>
</button>`;
}).join("");
const dialog = new Dialog({