diff --git a/packages/bcer-data-portal/app/src/components/generic/StyledEditableDropdown.tsx b/packages/bcer-data-portal/app/src/components/generic/StyledEditableDropdown.tsx
new file mode 100644
index 00000000..c3ef0e00
--- /dev/null
+++ b/packages/bcer-data-portal/app/src/components/generic/StyledEditableDropdown.tsx
@@ -0,0 +1,89 @@
+import React, { useState, useEffect, useRef } from 'react';
+import Select from '@mui/material/Select';
+import MenuItem from '@mui/material/MenuItem';
+import { styled } from '@mui/system';
+import useLocation from '@/hooks/useLocation';
+import useNetworkErrorMessage from '@/hooks/useNetworkErrorMessage';
+
+const StyledSelect = styled(Select)({
+ '& .MuiInputBase-input': {
+ color: 'black',
+ fontSize: '14px',
+ fontWeight: 600,
+ WebkitTextFillColor: 'black',
+ },
+ '& .MuiInput-underline:before': {
+ borderBottomStyle: 'none',
+ },
+ '& .MuiSelect-select:focus': {
+ backgroundColor: 'transparent',
+ },
+ '& .Mui-selected': {
+ backgroundColor: 'transparent !important',
+ },
+});
+
+interface StyledEditableDropdownProps {
+ id: string;
+ value: any;
+ type: string;
+ options: Array<{ label: string; value: any }>;
+ onSuccessfulUpdate?: (data: string) => void;
+}
+
+function StyledEditableDropdown({ id, value, type, options, onSuccessfulUpdate }: StyledEditableDropdownProps) {
+ const [content, setContent] = useState(value);
+ const { updateLocationInfo, patchLocationError } = useLocation(id);
+ const [noteMessage, updateNoteMessage] = useState('');
+ const { showNetworkErrorMessage } = useNetworkErrorMessage();
+ const notInitialRender = useRef(false);
+
+ useEffect(() => {
+ if (notInitialRender.current) {
+ const sendToDB = async () => {
+ await updateLocationInfo(type, content);
+
+ if (patchLocationError) {
+ showNetworkErrorMessage(patchLocationError);
+ } else {
+ onSuccessfulUpdate(noteMessage + ' to ' + content);
+ }
+ };
+
+ sendToDB();
+ } else {
+ notInitialRender.current = true;
+ }
+ }, [content]);
+
+ const handleChange = (event:any) => {
+ updateNoteMessage(type + ' changed from ' + content);
+ setContent(event.target.value);
+ };
+
+ const isLegacyValue = !options.some(option => option.value === content);
+
+ return (
+ <>
+
+ {isLegacyValue && (
+
+ )}
+ {options.map((option) => (
+
+ ))}
+
+ >
+ );
+}
+
+export default StyledEditableDropdown;
\ No newline at end of file
diff --git a/packages/bcer-data-portal/app/src/components/generic/StyledEditableTextField.tsx b/packages/bcer-data-portal/app/src/components/generic/StyledEditableTextField.tsx
index 65a491a7..6efa519f 100644
--- a/packages/bcer-data-portal/app/src/components/generic/StyledEditableTextField.tsx
+++ b/packages/bcer-data-portal/app/src/components/generic/StyledEditableTextField.tsx
@@ -7,6 +7,7 @@ import { styled } from '@mui/system';
import useLocation from '@/hooks/useLocation';
import useNetworkErrorMessage from '@/hooks/useNetworkErrorMessage';
import StyledEditDialog from './StyledEditDialog';
+import StyledEditableDropdown from './StyledEditableDropdown';
const StyledTextField = styled(TextField)({
'& .MuiInputBase-input.Mui-disabled': {
@@ -41,7 +42,7 @@ function StyledEditableTextField({ id, value, type, onSuccessfulUpdate }: Styled
const [latitude, setLatitude] = useState(null);
const [geo_confidence, setGeo_confidence] = useState('');
const [mouseOver, setMouseOver] = useState(false);
- const [dialogOpen, setDialogOpen] = useState(false); // State to manage dialog open state
+ const [dialogOpen, setDialogOpen] = useState(false);
const { updateLocationInfo, patchLocationError } = useLocation(id);
const [noteMessage, updateNoteMessage] = useState('');
const { showNetworkErrorMessage } = useNetworkErrorMessage();
@@ -106,25 +107,42 @@ function StyledEditableTextField({ id, value, type, onSuccessfulUpdate }: Styled
setDialogOpen(false);
};
+ const dropdownOptions = [
+ { label: 'Yes', value: "Yes" },
+ { label: 'No', value: "No" },
+ ];
+
+ const dropdownTypes = ['underage', 'manufacturing'];
+
return (
<>
-
-
-
-
-
- ) : null,
- }}
- variant="standard"
- />
+ { dropdownTypes.includes(type) ? (
+
+ ) : (
+
+
+
+
+
+ ) : null,
+ }}
+ variant="standard"
+ />
+ )}