@bytebrand/fe-ui-core-autobahn 1.0.195 → 1.0.196
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/locales/de/autobahn.json +3 -1
- package/locales/en/autobahn.json +3 -1
- package/package.json +1 -1
- package/vdp/VdpModules.tsx +20 -7
package/locales/de/autobahn.json
CHANGED
|
@@ -777,7 +777,9 @@
|
|
|
777
777
|
"ratings": {
|
|
778
778
|
"showLess": "Weniger anzeigen",
|
|
779
779
|
"showMore": "Alle {{count}} Bewertung anzeigen",
|
|
780
|
-
"showMore_plural": "Alle {{count}} Bewertungen anzeigen"
|
|
780
|
+
"showMore_plural": "Alle {{count}} Bewertungen anzeigen",
|
|
781
|
+
"showMoreLoaded": "Weitere {{count}} Bewertung anzeigen",
|
|
782
|
+
"showMoreLoaded_plural": "Weitere {{count}} Bewertungen anzeigen"
|
|
781
783
|
},
|
|
782
784
|
"steps": {
|
|
783
785
|
"step1": {
|
package/locales/en/autobahn.json
CHANGED
|
@@ -777,7 +777,9 @@
|
|
|
777
777
|
"ratings": {
|
|
778
778
|
"showLess": "Show less",
|
|
779
779
|
"showMore": "Show all {{count}} review",
|
|
780
|
-
"showMore_plural": "Show all {{count}} reviews"
|
|
780
|
+
"showMore_plural": "Show all {{count}} reviews",
|
|
781
|
+
"showMoreLoaded": "Show {{count}} more review",
|
|
782
|
+
"showMoreLoaded_plural": "Show {{count}} more reviews"
|
|
781
783
|
},
|
|
782
784
|
"steps": {
|
|
783
785
|
"step1": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bytebrand/fe-ui-core-autobahn",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.196",
|
|
4
4
|
"description": "auto.de md3 (Autobahn) design system — UI primitives, cards, chrome, VDP modules, theme CSS and locales. Ships raw TypeScript source (like fe-ui-core before it); each consumer's bundler compiles it.",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"license": "UNLICENSED",
|
package/vdp/VdpModules.tsx
CHANGED
|
@@ -3937,14 +3937,21 @@ export const ReviewsTeaser: React.FunctionComponent<ReviewsTeaserProps> = ({ cou
|
|
|
3937
3937
|
};
|
|
3938
3938
|
|
|
3939
3939
|
export interface CustomerRatingsProps {
|
|
3940
|
-
/** the loaded reviews (REAL —
|
|
3940
|
+
/** the loaded reviews (REAL — Bewertung Welt via fe-landing's /angebot/customer-quotes). */
|
|
3941
3941
|
reviews: VdpReview[];
|
|
3942
3942
|
/**
|
|
3943
|
-
* Overall auto.de
|
|
3944
|
-
*
|
|
3945
|
-
*
|
|
3943
|
+
* Overall auto.de rating to display instead of the average of the few loaded
|
|
3944
|
+
* reviews (which skews to 5,0 — only 4-5 star quotes are loaded). The page passes
|
|
3945
|
+
* the real site-wide aggregate.
|
|
3946
3946
|
*/
|
|
3947
3947
|
average?: number;
|
|
3948
|
+
/**
|
|
3949
|
+
* Site-wide review count shown next to the average (Bewertung Welt `summary`). When set,
|
|
3950
|
+
* the header shows it instead of reviews.length and the expander reads "Weitere N …".
|
|
3951
|
+
*/
|
|
3952
|
+
total?: number;
|
|
3953
|
+
/** portals the average/total come from, e.g. "Google & Trustpilot" (default "Google"). */
|
|
3954
|
+
sourceLabel?: string;
|
|
3948
3955
|
/** i18n function (drilled from the page). */
|
|
3949
3956
|
t: TranslationFunction;
|
|
3950
3957
|
}
|
|
@@ -3957,10 +3964,11 @@ export interface CustomerRatingsProps {
|
|
|
3957
3964
|
* the WordPress json-quotes feed); the page loads them and passes them in. When no
|
|
3958
3965
|
* reviews load, the page renders nothing (no fabricated content).
|
|
3959
3966
|
*/
|
|
3960
|
-
export const CustomerRatings: React.FunctionComponent<CustomerRatingsProps> = ({ reviews, average, t }) => {
|
|
3967
|
+
export const CustomerRatings: React.FunctionComponent<CustomerRatingsProps> = ({ reviews, average, total, sourceLabel, t }) => {
|
|
3961
3968
|
const [showAll, setShowAll] = useState(false);
|
|
3962
3969
|
if (!reviews || !reviews.length) return null;
|
|
3963
3970
|
const count = reviews.length;
|
|
3971
|
+
const headerCount = total != null && total > 0 ? total : count;
|
|
3964
3972
|
const avg = average != null ? average : reviews.reduce((s, r) => s + (r.rating || 0), 0) / count;
|
|
3965
3973
|
const shown = showAll ? reviews : reviews.slice(0, 4);
|
|
3966
3974
|
return (
|
|
@@ -3976,7 +3984,7 @@ export const CustomerRatings: React.FunctionComponent<CustomerRatingsProps> = ({
|
|
|
3976
3984
|
<span>
|
|
3977
3985
|
<Stars value={avg} size={16} />
|
|
3978
3986
|
<span className="md-label-sm" style={{ display: 'block' }}>
|
|
3979
|
-
{t('autobahn:reviews.ratingCount', { count })} · via Google
|
|
3987
|
+
{t('autobahn:reviews.ratingCount', { count: headerCount })} · via {sourceLabel || 'Google'}
|
|
3980
3988
|
</span>
|
|
3981
3989
|
</span>
|
|
3982
3990
|
</div>
|
|
@@ -4029,7 +4037,12 @@ export const CustomerRatings: React.FunctionComponent<CustomerRatingsProps> = ({
|
|
|
4029
4037
|
</div>
|
|
4030
4038
|
{reviews.length > 4 && (
|
|
4031
4039
|
<button className="mbtn mbtn--text" style={{ marginTop: 4 }} onClick={() => setShowAll((a) => !a)}>
|
|
4032
|
-
{showAll
|
|
4040
|
+
{showAll
|
|
4041
|
+
? t('autobahn:ratings.showLess')
|
|
4042
|
+
// with a site-wide total in the header, "Alle N" would contradict it — only the loaded ones expand
|
|
4043
|
+
: headerCount !== count
|
|
4044
|
+
? t('autobahn:ratings.showMoreLoaded', { count: count - 4 })
|
|
4045
|
+
: t('autobahn:ratings.showMore', { count })}
|
|
4033
4046
|
<Icon name={showAll ? 'chevron-up' : 'chevron-down'} size={16} />
|
|
4034
4047
|
</button>
|
|
4035
4048
|
)}
|