Skip to content

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

:art: Use filled stars for marketplace ratings https://github.com/siyuan-note/siyuan/issues/16711

Daniel10da3a905e3f
diff --git a/app/src/assets/scss/business/_config.scss b/app/src/assets/scss/business/_config.scss
index 4af84df515..112508a28f 100644
--- a/app/src/assets/scss/business/_config.scss
+++ b/app/src/assets/scss/business/_config.scss
@@ -478,25 +478,34 @@
cursor: pointer;
}
- svg {
+ > .config-bazaar__rating-star {
color: var(--b3-theme-primary);
+ font-size: 14px;
}
}
+ &__rating-star {
+ display: inline-block;
+ font-family: sans-serif;
+ font-style: normal;
+ line-height: 1;
+ text-align: center;
+ }
+
&__rating-stars {
color: var(--b3-theme-on-surface-light);
display: inline-flex;
flex-shrink: 0;
position: relative;
- > svg,
- > span > svg {
+ > .config-bazaar__rating-star,
+ > .config-bazaar__rating-stars--active > .config-bazaar__rating-star {
flex: 0 0 16px;
- height: 16px;
+ font-size: 16px;
width: 16px;
}
- > span {
+ > .config-bazaar__rating-stars--active {
display: inline-flex;
}
@@ -505,10 +514,6 @@
inset: 0 auto auto 0;
overflow: hidden;
position: absolute;
-
- svg {
- flex: 0 0 16px;
- }
}
}
@@ -537,11 +542,9 @@
gap: 4px;
grid-template-columns: 10px 14px minmax(48px, 1fr) auto auto;
- > svg {
+ > .config-bazaar__rating-star {
color: var(--b3-theme-primary);
- fill: currentColor;
- height: 12px;
- width: 12px;
+ font-size: 12px;
}
}
@@ -593,9 +596,8 @@
cursor: pointer;
padding: 6px;
- svg {
- height: 28px;
- width: 28px;
+ .config-bazaar__rating-star {
+ font-size: 28px;
}
&:hover,
diff --git a/app/src/config/bazaar.ts b/app/src/config/bazaar.ts
index 7aabd78196..3f7585926e 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}, () => '<svg><use xlink:href="#iconStar"></use></svg>').join("");
+ const stars = Array.from({length: 5}, () => '<span class="config-bazaar__rating-star">&#9733;</span>').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 = `<svg><use xlink:href="#iconStar"></use></svg>
+ const content = `<span class="config-bazaar__rating-star" aria-hidden="true">&#9733;</span>
<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>
- <svg aria-hidden="true"><use xlink:href="#iconStar"></use></svg>
+ <span class="config-bazaar__rating-star" aria-hidden="true">&#9733;</span>
<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"}">
- <svg><use xlink:href="#iconStar"></use></svg>
+ <span class="config-bazaar__rating-star" aria-hidden="true">&#9733;</span>
</button>`;
}).join("");
const dialog = new Dialog({