fix issues pointed out by copilot

This commit is contained in:
juhanikat
2026-09-19 14:10:48 +03:00
parent 70e479e470
commit 02e98067b0
6 changed files with 22 additions and 30 deletions
+2 -1
View File
@@ -329,8 +329,9 @@ export const getOccurrenceByCompositeKey = async (lid: number, speciesId: number
loc_status: boolean | null loc_status: boolean | null
loc_name: string loc_name: string
country: string country: string
order_name: string
family_name: string
genus_name: string genus_name: string
family_name: string | null
species_name: string species_name: string
unique_identifier: string | null unique_identifier: string | null
dms_lat: string | null dms_lat: string | null
@@ -83,8 +83,9 @@ export const generateOccurrenceDetailSql = (lid: number, speciesId: number) => {
now_loc.min_age, now_loc.min_age,
now_loc.bfa_max, now_loc.bfa_max,
now_loc.bfa_min, now_loc.bfa_min,
com_species.genus_name, com_species.order_name,
com_species.family_name, com_species.family_name,
com_species.genus_name,
com_species.species_name, com_species.species_name,
com_species.unique_identifier com_species.unique_identifier
FROM now_ls FROM now_ls
@@ -96,7 +96,7 @@ export const OccurrenceDetails = () => {
if (localityQueryError) return <div>Error loading locality data</div> if (localityQueryError) return <div>Error loading locality data</div>
if (occurrenceDataLoading || localityDataLoading || mutationLoading) return <CircularProgress /> if (occurrenceDataLoading || localityDataLoading || mutationLoading) return <CircularProgress />
const initialOccurrence = emptyOccurrence const initialOccurrence: OccurrenceDetailsType = { ...emptyOccurrence }
if (isNew) { if (isNew) {
initialOccurrence.lid = parseInt(localityId, 10) initialOccurrence.lid = parseInt(localityId, 10)
@@ -107,7 +107,7 @@ export const OccurrenceCoreTab = ({
['Family', editData.family_name], ['Family', editData.family_name],
['Genus', editData.genus_name], ['Genus', editData.genus_name],
['Species', editData.species_name], ['Species', editData.species_name],
['Unique Identifier', editData.unique_identifier], ['Unique Identifier', toText(editData.unique_identifier)],
['ID status', dropdown('id_status', idStatusOptions, 'ID status')], ['ID status', dropdown('id_status', idStatusOptions, 'ID status')],
['Additional Information', textField('orig_entry', { type: 'text' })], ['Additional Information', textField('orig_entry', { type: 'text' })],
['Source name', textField('source_name', { type: 'text' })], ['Source name', textField('source_name', { type: 'text' })],
@@ -201,25 +201,23 @@ export const TableToolBar = <T extends MRT_RowData>({
return ( return (
<div className="table-tool-bar"> <div className="table-tool-bar">
{showContactButton && ( <Box className="left-buttons">
<Box className="left-buttons"> {showContactButton && <ContactForm<T> buttonText="Contact" noContext={true} />}
<ContactForm<T> buttonText="Contact" noContext={true} /> {showNewButton && (
<Button
id="new-button"
variant="outlined"
component={Link}
to="new"
className="button"
startIcon={<AddCircleIcon />}
onClick={() => setPreviousTableUrls([...previousTableUrls, `${location.pathname}`])}
>
New
</Button>
)}
</Box>
{showNewButton && (
<Button
id="new-button"
variant="outlined"
component={Link}
to="new"
className="button"
startIcon={<AddCircleIcon />}
onClick={() => setPreviousTableUrls([...previousTableUrls, `${location.pathname}`])}
>
New
</Button>
)}
</Box>
)}
<Box className="icon-buttons"> <Box className="icon-buttons">
<Tooltip title="Show/hide columns"> <Tooltip title="Show/hide columns">
<IconButton <IconButton
-8
View File
@@ -36,14 +36,6 @@ const router = createBrowserRouter([
return { Component: OccurrencesPage } return { Component: OccurrencesPage }
}, },
}, },
{
path: 'occurrence/:id',
// Matches occurrence/new
lazy: async () => {
const { OccurrencesPage } = await import('../pages/OccurrencesPage')
return { Component: OccurrencesPage }
},
},
{ {
path: 'occurrence', path: 'occurrence',
lazy: async () => { lazy: async () => {