Add icon support for tools and improve analytics chart display

Update API, database schema, and frontend components to allow optional icons for tools, and adjust analytics chart rendering for better visibility.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 776963d0-f75d-42e2-a57b-cc36bdff8495
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Event-Id: 0ad0b686-eebd-46d2-8314-67e9e874e224
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/0683fb79-a27c-485c-9333-5f4b288c4567/776963d0-f75d-42e2-a57b-cc36bdff8495/1p7jhzu
Replit-Helium-Checkpoint-Created: true
This commit is contained in:
cheffe01
2026-05-25 13:28:34 +00:00
parent 7abb048edc
commit b8ba53598d
13 changed files with 132 additions and 27 deletions
+37
View File
@@ -23,6 +23,7 @@ const toolSchema = z.object({
description: z.string().min(10, "Description must be at least 10 characters"),
category: z.string().min(2, "Category is required"),
websiteUrl: z.string().url("Must be a valid URL").optional().or(z.literal("")),
iconUrl: z.string().url("Must be a valid URL").optional().or(z.literal("")),
features: z.array(z.object({ value: z.string() })).optional(),
tags: z.array(z.object({ value: z.string() })).optional(),
});
@@ -43,6 +44,7 @@ export default function ToolNew() {
description: "",
category: "",
websiteUrl: "",
iconUrl: "",
features: [{ value: "" }],
tags: [{ value: "" }],
},
@@ -62,6 +64,7 @@ export default function ToolNew() {
const payload = {
...data,
websiteUrl: data.websiteUrl || undefined,
iconUrl: data.iconUrl || undefined,
features: data.features?.map((f) => f.value).filter((v) => v.trim() !== ""),
tags: data.tags?.map((t) => t.value).filter((v) => v.trim() !== ""),
};
@@ -166,6 +169,40 @@ export default function ToolNew() {
)}
/>
<FormField
control={form.control}
name="iconUrl"
render={({ field }) => (
<FormItem>
<FormLabel>Icon / Logo URL (Optional)</FormLabel>
<FormControl>
<div className="flex items-center gap-3">
<div className="w-9 h-9 rounded-md border bg-muted flex items-center justify-center overflow-hidden shrink-0">
{field.value ? (
<img
src={field.value}
alt="icon preview"
className="w-full h-full object-contain p-0.5"
onError={(e) => { (e.target as HTMLImageElement).style.display = "none"; }}
/>
) : (
<span className="text-xs text-muted-foreground">img</span>
)}
</div>
<Input
placeholder="https://example.com/logo.png"
type="url"
{...field}
data-testid="input-tool-icon-url"
className="flex-1"
/>
</div>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="description"