Merge remote-tracking branch 'origin/dev'
Deploy / deploy-dev (push) Skipped
Deploy / deploy-prod (push) Successful in 3m14s

This commit is contained in:
blaisadmin committed 2026-10-07 20:19:30 -04:00
commit cf8dceb014
3 files changed
+38 -22

No files matched your search

+2
View File
@@ -3566,6 +3566,7 @@ app.post('/api/birds', requireAuth, requireWriteAccess, requireWorkspaceRole(['o
toWorkspaceId: req.auth!.workspace.id, toWorkspaceId: req.auth!.workspace.id,
locationLabel: bird!.location_label, locationLabel: bird!.location_label,
locationDetails: bird!.location_details, locationDetails: bird!.location_details,
eventDate: emptyToNull(parsed.data.locationDate),
createdByUserId: req.auth!.user.id, createdByUserId: req.auth!.user.id,
}); });
res.status(201).json({ bird: normalizeBird(bird!) }); res.status(201).json({ bird: normalizeBird(bird!) });
@@ -3945,6 +3946,7 @@ app.put('/api/birds/:birdId', requireAuth, requireWriteAccess, requireWorkspaceR
toWorkspaceId: req.auth!.workspace.id, toWorkspaceId: req.auth!.workspace.id,
locationLabel: bird.location_label, locationLabel: bird.location_label,
locationDetails: bird.location_details, locationDetails: bird.location_details,
eventDate: emptyToNull(parsed.data.locationDate),
createdByUserId: req.auth!.user.id, createdByUserId: req.auth!.user.id,
}); });
} }
+1
View File
@@ -104,6 +104,7 @@ export const locationSearchSchema = z.object({
}); });
export const birdSchema = z.object({ export const birdSchema = z.object({
locationDate: dateStringSchema.optional().or(z.literal('')),
name: z.string().trim().min(1).max(120), name: z.string().trim().min(1).max(120),
tagId: z.string().trim().max(80).optional().or(z.literal('')), tagId: z.string().trim().max(80).optional().or(z.literal('')),
species: z.string().trim().min(1).max(120), species: z.string().trim().min(1).max(120),
+35 -22
View File
@@ -271,6 +271,7 @@ type FlockNoteFormState = {
}; };
type BirdFormState = { type BirdFormState = {
locationDate: string;
name: string; name: string;
tagId: string; tagId: string;
species: string; species: string;
@@ -812,6 +813,7 @@ const VerifiedLocationSearchField = ({
}; };
const emptyBirdForm: BirdFormState = { const emptyBirdForm: BirdFormState = {
locationDate: '',
name: '', name: '',
tagId: '', tagId: '',
species: '', species: '',
@@ -966,6 +968,7 @@ const ProviderIcon = ({ providerKey }: { providerKey: AuthProvider['providerKey'
const sortBirdsByName = (nextBirds: Bird[]) => [...nextBirds].sort((left, right) => left.name.localeCompare(right.name)); const sortBirdsByName = (nextBirds: Bird[]) => [...nextBirds].sort((left, right) => left.name.localeCompare(right.name));
const toBirdForm = (bird: Bird): BirdFormState => ({ const toBirdForm = (bird: Bird): BirdFormState => ({
locationDate: '',
name: bird.name, name: bird.name,
tagId: bird.tagId ?? '', tagId: bird.tagId ?? '',
species: bird.species, species: bird.species,
@@ -3988,7 +3991,7 @@ function App() {
const response = await apiFetch(isEditing ? `/birds/${editingBirdId}` : '/birds', authToken, { const response = await apiFetch(isEditing ? `/birds/${editingBirdId}` : '/birds', authToken, {
method, method,
headers: { 'Content-Type': 'application/json' }, headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ ...birdForm, hatchDay: birdForm.dateOfBirth, locationLabel }), body: JSON.stringify({ ...birdForm, hatchDay: birdForm.dateOfBirth, locationLabel, locationDate: birdForm.locationDate || getLocalDateString() }),
}); });
if (!response.ok) { if (!response.ok) {
@@ -6586,27 +6589,6 @@ function App() {
) : null} ) : null}
</div> </div>
</label> </label>
<div className="settings-inline-header wide-field">
<p className="eyebrow">Location</p>
<h3>Mappable location</h3>
</div>
<VerifiedLocationSearchField
label="Location"
location={birdForm.locationDetails}
fallbackLabel={birdForm.locationLabel}
searchState={birdLocationSearch}
onSearchStateChange={setBirdLocationSearch}
onSearch={() => searchVerifiedLocations(birdLocationSearch, setBirdLocationSearch)}
onSelect={(location) => {
const locationLabel = formatVerifiedLocationLabel(location);
setBirdForm({ ...birdForm, locationDetails: location, locationLabel });
setBirdLocationSearch({ ...emptyLocationSearchState, query: locationLabel });
}}
onClear={() => {
setBirdForm({ ...birdForm, locationDetails: emptyVerifiedLocationDetails, locationLabel: '' });
setBirdLocationSearch(emptyLocationSearchState);
}}
/>
<div className="segmented-field wide-field"> <div className="segmented-field wide-field">
<span>Gender</span> <span>Gender</span>
<div className="segmented-control" role="radiogroup" aria-label="Bird gender"> <div className="segmented-control" role="radiogroup" aria-label="Bird gender">
@@ -6745,6 +6727,37 @@ function App() {
))} ))}
</div> </div>
</label> </label>
<div className="settings-inline-header wide-field">
<p className="eyebrow">Location</p>
<h3>Mappable location</h3>
</div>
<VerifiedLocationSearchField
label="Location"
location={birdForm.locationDetails}
fallbackLabel={birdForm.locationLabel}
searchState={birdLocationSearch}
onSearchStateChange={setBirdLocationSearch}
onSearch={() => searchVerifiedLocations(birdLocationSearch, setBirdLocationSearch)}
onSelect={(location) => {
const locationLabel = formatVerifiedLocationLabel(location);
setBirdForm({ ...birdForm, locationDetails: location, locationLabel });
setBirdLocationSearch({ ...emptyLocationSearchState, query: locationLabel });
}}
onClear={() => {
setBirdForm({ ...birdForm, locationDetails: emptyVerifiedLocationDetails, locationLabel: '' });
setBirdLocationSearch(emptyLocationSearchState);
}}
/>
<label>
Location date
<input
type="date"
value={birdForm.locationDate || getLocalDateString()}
onChange={(event) => setBirdForm({ ...birdForm, locationDate: event.target.value })}
required
/>
<span className="muted">Date this location took effect. Used when adding a bird or changing its location.</span>
</label>
</div> </div>
</section> </section>
<section className="settings-nested-card"> <section className="settings-nested-card">