fix(web): fix Select dark mode theming and personalities API client
All checks were successful
ci/woodpecker/push/web Pipeline was successful
All checks were successful
ci/woodpecker/push/web Pipeline was successful
- Replace hardcoded white/gray colors in Select component with theme tokens (bg-bg, border-border, text-text, bg-surface, hover:bg-surface-2) - Handle 204 No Content responses in apiRequest to prevent JSON parse errors - Fix deletePersonality return type to void (matches 204 response) Partial work for SS-UI-002 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -91,7 +91,7 @@ export function SelectTrigger({
|
||||
onClick={() => {
|
||||
setIsOpen(!isOpen);
|
||||
}}
|
||||
className={`flex h-10 w-full items-center justify-between rounded-md border border-gray-300 bg-white px-3 py-2 text-sm ${className}`}
|
||||
className={`flex h-10 w-full items-center justify-between rounded-md border border-border bg-bg px-3 py-2 text-sm text-text ${className}`}
|
||||
>
|
||||
{children}
|
||||
</button>
|
||||
@@ -110,7 +110,7 @@ export function SelectContent({ children }: SelectContentProps): React.JSX.Eleme
|
||||
if (!isOpen) return null;
|
||||
|
||||
return (
|
||||
<div className="absolute z-50 mt-1 max-h-60 w-full overflow-auto rounded-md border border-gray-300 bg-white shadow-lg">
|
||||
<div className="absolute z-50 mt-1 max-h-60 w-full overflow-auto rounded-md border border-border bg-surface shadow-md">
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
@@ -122,7 +122,7 @@ export function SelectItem({ value, children }: SelectItemProps): React.JSX.Elem
|
||||
return (
|
||||
<div
|
||||
onClick={() => onValueChange?.(value)}
|
||||
className="cursor-pointer px-3 py-2 text-sm hover:bg-gray-100"
|
||||
className="cursor-pointer px-3 py-2 text-sm text-text hover:bg-surface-2"
|
||||
>
|
||||
{children}
|
||||
</div>
|
||||
|
||||
@@ -250,6 +250,11 @@ export async function apiRequest<T>(endpoint: string, options: ApiRequestOptions
|
||||
throw new Error(error.message);
|
||||
}
|
||||
|
||||
// 204 No Content responses have no body — return undefined cast to T
|
||||
if (response.status === 204) {
|
||||
return undefined as T;
|
||||
}
|
||||
|
||||
return await (response.json() as Promise<T>);
|
||||
} catch (err: unknown) {
|
||||
if (err instanceof DOMException && err.name === "AbortError") {
|
||||
|
||||
@@ -73,7 +73,8 @@ export async function updatePersonality(
|
||||
|
||||
/**
|
||||
* Delete a personality
|
||||
* The DELETE endpoint returns 204 No Content on success.
|
||||
*/
|
||||
export async function deletePersonality(id: string): Promise<Record<string, never>> {
|
||||
return apiDelete<Record<string, never>>(`/api/personalities/${id}`);
|
||||
export async function deletePersonality(id: string): Promise<void> {
|
||||
await apiDelete<undefined>(`/api/personalities/${id}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user