Skip to content

Commit 7a8d8d2

Browse files
authored
feat: add icon and description to preset dropdown (coder#21694)
Closes coder#20598 This pull-request implements a very basic change to also render the `icon` of the `Preset` when we've specifically defined one within the template. Furthermore, theres a `ⓘ` icon with a description. ### Preview <img width="984" height="442" alt="CleanShot 2026-01-27 at 20 15 29@2x" src="https://github.com/user-attachments/assets/d4ceebf9-a5fe-4df4-a8b2-a8355d6bb25e" />
1 parent 7090a1e commit 7a8d8d2

1 file changed

Lines changed: 33 additions & 5 deletions

File tree

‎site/src/modules/tasks/TaskPrompt/TaskPrompt.tsx‎

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import {
2727
} from "components/Tooltip/Tooltip";
2828
import { useAuthenticated } from "hooks/useAuthenticated";
2929
import { useExternalAuth } from "hooks/useExternalAuth";
30-
import { ArrowUpIcon, RedoIcon, RotateCcwIcon } from "lucide-react";
30+
import { ArrowUpIcon, InfoIcon, RedoIcon, RotateCcwIcon } from "lucide-react";
3131
import { type FC, useEffect, useState } from "react";
3232
import { useMutation, useQuery, useQueryClient } from "react-query";
3333
import TextareaAutosize, {
@@ -294,7 +294,7 @@ const CreateTaskForm: FC<CreateTaskFormProps> = ({ templates, onSuccess }) => {
294294
</div>
295295
)}
296296

297-
<div>
297+
<div className="flex-1 overflow-hidden min-w-0">
298298
<label htmlFor="presetID" className="sr-only">
299299
Preset
300300
</label>
@@ -310,15 +310,43 @@ const CreateTaskForm: FC<CreateTaskFormProps> = ({ templates, onSuccess }) => {
310310
value={selectedPresetId}
311311
onValueChange={setSelectedPresetId}
312312
>
313-
<PromptSelectTrigger id="presetID" tooltip="Preset">
313+
<PromptSelectTrigger
314+
id="presetID"
315+
tooltip="Preset"
316+
className="w-full max-w-full [&_span]:flex [&_span]:items-center [&_span]:gap-2 [&_span]:min-w-0 [&_span]:overflow-hidden [&_span>span]:truncate [&_svg[data-slot='preset-description']]:hidden"
317+
>
314318
<SelectValue placeholder="Select a preset" />
315319
</PromptSelectTrigger>
316320
<SelectContent>
317321
{presets?.toSorted(sortByDefault).map((preset) => (
318-
<SelectItem value={preset.ID} key={preset.ID}>
319-
<span className="overflow-hidden text-ellipsis block">
322+
<SelectItem
323+
value={preset.ID}
324+
key={preset.ID}
325+
className="[&_span]:flex [&_span]:items-center [&_span]:gap-2"
326+
>
327+
{preset.Icon && (
328+
<img
329+
src={preset.Icon}
330+
alt={preset.Name}
331+
className="size-icon-sm flex-shrink-0"
332+
/>
333+
)}
334+
<span>
320335
{preset.Name} {preset.Default && "(Default)"}
321336
</span>
337+
{preset.Description && (
338+
<Tooltip>
339+
<TooltipTrigger asChild>
340+
<InfoIcon
341+
className="size-4"
342+
data-slot="preset-description"
343+
/>
344+
</TooltipTrigger>
345+
<TooltipContent>
346+
{preset.Description}
347+
</TooltipContent>
348+
</Tooltip>
349+
)}
322350
</SelectItem>
323351
))}
324352
</SelectContent>

0 commit comments

Comments
 (0)