Files
supabase/apps/studio/components/interfaces/AuditLogs/AuditLogsUserOption.tsx
Danny White 000320e914 fix(studio): keep form text consistent across breakpoints (#53429)
## Problem

Small and medium form controls and related text grow from 14px to 16px
below a viewport breakpoint, making them larger than surrounding
dashboard text.

## Solution

Keep these sizes at 14px across breakpoints in shared controls and form
layouts, plus Studio search fields and assistant textareas. Explicit
large and extra-large variants keep their existing sizes. The shared
sizing change also applies to buttons.

```diff
- text-base md:text-sm
+ text-sm
```

This accepts iOS Safari’s automatic zoom when focusing smaller editable
fields. User zoom remains available.

Validation: Prettier, scoped Studio ESLint, and whitespace checks pass.
Browser checks and a full build have not been run.

## Review instructions

1. Open a project’s **Settings > General**. Resize across 768px and
check that field text, labels, helper text, and buttons keep the same
font size.
2. Open the organisation/project selector and resize across 640px. Its
search text should stay at 14px.
3. Open the assistant and check that its textarea text stays the same
size across 768px.
4. On an iPhone, focus an editable field and check that the accepted
focus zoom behaviour remains usable.

## Checklist

- [x] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
2026-11-16 09:56:27 +11:00

66 lines
2.5 KiB
TypeScript

import { Command, CommandGroup, CommandInput, CommandItem, CommandList } from 'ui'
import type { CustomOptionProps } from 'ui-patterns/FilterBar'
import { ShimmeringLoader } from 'ui-patterns/ShimmeringLoader'
import { useOrganizationMembersQuery } from '@/data/organizations/organization-members-query'
interface AuditLogsUserOptionProps extends CustomOptionProps {
slug?: string
}
// Select-only member list for the FilterBar. The stored value is the member's gotrue_id, while
// the chip shows the username through the property's `formatValue`.
export const AuditLogsUserOption = ({ slug, onChange }: AuditLogsUserOptionProps) => {
const { data, error, isLoading, isError, isSuccess } = useOrganizationMembersQuery({ slug })
const members = (data ?? []).filter((member) => !member.invited_at && !!member.gotrue_id)
return (
<Command>
<CommandInput
showResetIcon
placeholder="Find member..."
className="text-sm"
// FilterBar keeps focus on the chip's input, so move it here for cmdk's arrow/enter keys
autoFocus
/>
<CommandList className="max-h-[300px] overflow-y-auto overflow-x-hidden">
<CommandGroup>
{isLoading && (
<div className="px-2 py-1">
<ShimmeringLoader className="py-2" />
</div>
)}
{isError && (
<p className="text-xs text-center text-foreground-lighter py-3">
Failed to retrieve members: {error.message}
</p>
)}
{isSuccess && members.length === 0 && (
<p className="text-xs text-center text-foreground-lighter py-3">No members found</p>
)}
{isSuccess &&
members.map((member) => (
<CommandItem
key={member.gotrue_id}
value={`${member.username.replaceAll('"', '')}-${member.gotrue_id}`}
className="cursor-pointer w-full"
onSelect={() => onChange(member.gotrue_id)}
>
{member.username}
</CommandItem>
))}
</CommandGroup>
</CommandList>
</Command>
)
}
// FilterBar invokes `component(props)` as a plain function, so this factory returns that function
// with `slug` bound, keeping the component itself defined at module level.
export const createAuditLogsUserOption = (slug?: string) => {
const renderUserOption = (props: CustomOptionProps) => (
<AuditLogsUserOption {...props} slug={slug} />
)
return renderUserOption
}