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} size={15}
className="translate-x-[0.5px] translate-y-[0.5px]" className="translate-x-[0.5px] translate-y-[0.5px]"
/>, />,
action: startUpload, action: () => new Promise(resolve => {
if (startUpload) {
startUpload(() => resolve());
} else {
resolve();
}
}),
}, { }, {
label: 'Manage Photos', label: 'Manage Photos',
...photosCountTotal && { ...photosCountTotal && {

View File

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

View File

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