Adjust event defaults and nav width
This commit is contained in:
@@ -94,9 +94,9 @@ export default function MobileEventFormPage() {
|
||||
try {
|
||||
const types = await getEventTypes();
|
||||
setEventTypes(types);
|
||||
// Default to first type if none set
|
||||
if (!form.eventTypeId && types.length) {
|
||||
setForm((prev) => ({ ...prev, eventTypeId: types[0].id }));
|
||||
const preferredType = types.find((type) => type.slug === 'wedding') ?? types[0] ?? null;
|
||||
if (preferredType) {
|
||||
setForm((prev) => (prev.eventTypeId ? prev : { ...prev, eventTypeId: preferredType.id }));
|
||||
}
|
||||
} catch {
|
||||
// silently ignore; fallback to null
|
||||
|
||||
@@ -81,6 +81,7 @@ vi.mock('../theme', () => ({
|
||||
}),
|
||||
}));
|
||||
|
||||
import { getEventTypes } from '../../api';
|
||||
import MobileEventFormPage from '../EventFormPage';
|
||||
|
||||
describe('MobileEventFormPage', () => {
|
||||
@@ -94,4 +95,18 @@ describe('MobileEventFormPage', () => {
|
||||
|
||||
expect(backMock).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('defaults event type to wedding when available', async () => {
|
||||
vi.mocked(getEventTypes).mockResolvedValueOnce([
|
||||
{ id: 11, slug: 'conference', name: 'Conference', name_translations: {}, icon: null, settings: {} },
|
||||
{ id: 22, slug: 'wedding', name: 'Wedding', name_translations: {}, icon: null, settings: {} },
|
||||
]);
|
||||
|
||||
await act(async () => {
|
||||
render(<MobileEventFormPage />);
|
||||
});
|
||||
|
||||
const select = screen.getByRole('combobox');
|
||||
expect(select).toHaveValue('22');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -47,7 +47,7 @@ export function BottomNav({ active, onNavigate }: { active: NavKey; onNavigate:
|
||||
WebkitBackdropFilter: 'blur(14px)',
|
||||
}}
|
||||
>
|
||||
<XStack justifyContent="space-between" alignItems="center">
|
||||
<XStack width="100%" maxWidth={800} marginHorizontal="auto" justifyContent="space-between" alignItems="center">
|
||||
{items.map((item) => {
|
||||
const activeState = item.key === active;
|
||||
const isPressed = pressedKey === item.key;
|
||||
|
||||
Reference in New Issue
Block a user