Leave admin menu up while choosing files

This commit is contained in:
Sam Becker 2025-02-28 09:00:25 -06:00
parent 2e0767ce73
commit 8a9cd17cd5
3 changed files with 12 additions and 3 deletions

View File

@ -51,7 +51,13 @@ export default function AdminAppMenu({
size={15}
className="translate-x-[0.5px] translate-y-[0.5px]"
/>,
action: startUpload,
action: () => new Promise(resolve => {
if (startUpload) {
startUpload(() => resolve());
} else {
resolve();
}
}),
}, {
label: 'Manage Photos',
...photosCountTotal && {

View File

@ -23,7 +23,7 @@ export interface AppStateContext {
shouldRespondToKeyboardCommands?: boolean
setShouldRespondToKeyboardCommands?: Dispatch<SetStateAction<boolean>>
// UPLOAD
startUpload?: () => void
startUpload?: (onStart?: () => void) => void
uploadInputRef?: RefObject<HTMLInputElement | null>
uploadState: UploadState
setUploadState?: (uploadState: Partial<UploadState>) => void

View File

@ -90,10 +90,11 @@ export default function AppStateProvider({
const [shouldDebugRecipeOverlays, setShouldDebugRecipeOverlays] =
useState(false);
const startUpload = useCallback(() => {
const startUpload = useCallback((onStart?: () => void) => {
if (uploadInputRef.current) {
uploadInputRef.current.value = '';
uploadInputRef.current.click();
uploadInputRef.current.oninput = onStart ?? null;
}
}, []);
const setUploadState = useCallback((uploadState: Partial<UploadState>) => {
@ -125,6 +126,8 @@ export default function AppStateProvider({
},
);
console.log('adminData', adminData);
useEffect(() => {
if (userEmail) {
storeAuthEmailCookie(userEmail);