|
1 | | -import { Component, Show, createSignal, For } from "solid-js"; |
| 1 | +import { Component, Show, createSignal } from "solid-js"; |
2 | 2 | import { Extension, MarketplaceExtension, ExtensionUpdateInfo } from "../../context/ExtensionsContext"; |
3 | 3 | import { Card, Text, Button, Badge } from "@/components/ui"; |
4 | 4 | import { tokens } from "@/design-system/tokens"; |
@@ -109,82 +109,6 @@ export const ExtensionCard: Component<ExtensionCardProps> = (props) => { |
109 | 109 | const hasUpdate = () => !!props.updateInfo; |
110 | 110 | const isUpdating = () => !!props.isUpdating; |
111 | 111 |
|
112 | | - const formatNumber = (num: number): string => { |
113 | | - if (num >= 1000000) { |
114 | | - return (num / 1000000).toFixed(1) + "M"; |
115 | | - } |
116 | | - if (num >= 1000) { |
117 | | - return (num / 1000).toFixed(1) + "K"; |
118 | | - } |
119 | | - return num.toString(); |
120 | | - }; |
121 | | - |
122 | | - // Star rating component - VS Code specifications |
123 | | - // 3px margin-left between stars, 0.75 opacity for empty stars |
124 | | - const StarRating = (rating: number) => { |
125 | | - const fullStars = Math.floor(rating); |
126 | | - const hasHalfStar = rating % 1 >= 0.5; |
127 | | - const emptyStars = 5 - fullStars - (hasHalfStar ? 1 : 0); |
128 | | - return ( |
129 | | - <div class="extension-ratings" style={{ display: "flex", "align-items": "center" }}> |
130 | | - <For each={Array(fullStars).fill(0)}> |
131 | | - {(_, index) => ( |
132 | | - <svg |
133 | | - class="star star-full" |
134 | | - width="12" |
135 | | - height="12" |
136 | | - viewBox="0 0 24 24" |
137 | | - fill={tokens.colors.semantic.warning} |
138 | | - stroke="none" |
139 | | - style={{ "margin-left": index() > 0 ? "3px" : "0" }} |
140 | | - > |
141 | | - <polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2" /> |
142 | | - </svg> |
143 | | - )} |
144 | | - </For> |
145 | | - <Show when={hasHalfStar}> |
146 | | - <svg |
147 | | - class="star star-half" |
148 | | - width="12" |
149 | | - height="12" |
150 | | - viewBox="0 0 24 24" |
151 | | - style={{ "margin-left": fullStars > 0 ? "3px" : "0" }} |
152 | | - > |
153 | | - <defs> |
154 | | - <linearGradient id="half-star-small"> |
155 | | - <stop offset="50%" stop-color={tokens.colors.semantic.warning} /> |
156 | | - <stop offset="50%" stop-color={tokens.colors.surface.canvas} /> |
157 | | - </linearGradient> |
158 | | - </defs> |
159 | | - <polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2" fill="url(#half-star-small)" /> |
160 | | - </svg> |
161 | | - </Show> |
162 | | - <For each={Array(emptyStars).fill(0)}> |
163 | | - {(_, index) => ( |
164 | | - <svg |
165 | | - class="star star-empty" |
166 | | - width="12" |
167 | | - height="12" |
168 | | - viewBox="0 0 24 24" |
169 | | - fill={tokens.colors.surface.canvas} |
170 | | - stroke={tokens.colors.text.muted} |
171 | | - stroke-width="1" |
172 | | - style={{ |
173 | | - "margin-left": "3px", |
174 | | - opacity: 0.75 /* VS Code: empty stars at 0.75 opacity */ |
175 | | - }} |
176 | | - > |
177 | | - <polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2" /> |
178 | | - </svg> |
179 | | - )} |
180 | | - </For> |
181 | | - <span class="count" style={{ "font-size": "12px", color: tokens.colors.text.muted, "margin-left": "6px" }}> |
182 | | - {rating.toFixed(1)} |
183 | | - </span> |
184 | | - </div> |
185 | | - ); |
186 | | - }; |
187 | | - |
188 | 112 | // VS Code-style list view (60px height, compact) |
189 | 113 | if (isListView()) { |
190 | 114 | return ( |
|
0 commit comments