use new selected file options and navbars

This commit is contained in:
Abhinav 2022-05-28 13:42:01 +05:30
parent 0e5aa9d59d
commit 8ba7558858
4 changed files with 24 additions and 14 deletions

View file

@ -18,7 +18,7 @@ import {
DefaultDeduplicateContext, DefaultDeduplicateContext,
} from 'types/deduplicate'; } from 'types/deduplicate';
import Router from 'next/router'; import Router from 'next/router';
import DeduplicateOptions from 'components/pages/gallery/SelectedFileOptions/DeduplicateOptions'; import DeduplicateOptions from 'components/pages/dedupe/SelectedFileOptions';
import { PAGES } from 'constants/pages'; import { PAGES } from 'constants/pages';
import router from 'next/router'; import router from 'next/router';
import { getKey, SESSION_KEYS } from 'utils/storage/sessionStorage'; import { getKey, SESSION_KEYS } from 'utils/storage/sessionStorage';

View file

@ -50,8 +50,7 @@ import {
mergeMetadata, mergeMetadata,
sortFiles, sortFiles,
} from 'utils/file'; } from 'utils/file';
import SearchBar from 'components/Search'; import SelectedFileOptions from 'components/pages/gallery/SelectedFileOptions';
import SelectedFileOptions from 'components/pages/gallery/SelectedFileOptions/GalleryOptions';
import CollectionSelector, { import CollectionSelector, {
CollectionSelectorAttributes, CollectionSelectorAttributes,
} from 'components/pages/gallery/CollectionSelector'; } from 'components/pages/gallery/CollectionSelector';
@ -59,7 +58,6 @@ import CollectionNamer, {
CollectionNamerAttributes, CollectionNamerAttributes,
} from 'components/Collections/CollectionNamer'; } from 'components/Collections/CollectionNamer';
import AlertBanner from 'components/pages/gallery/AlertBanner'; import AlertBanner from 'components/pages/gallery/AlertBanner';
import UploadButton from 'components/pages/gallery/UploadButton';
import PlanSelector from 'components/pages/gallery/PlanSelector'; import PlanSelector from 'components/pages/gallery/PlanSelector';
import Upload from 'components/pages/gallery/Upload'; import Upload from 'components/pages/gallery/Upload';
import { import {
@ -110,6 +108,7 @@ import ToastNotification from 'components/ToastNotification';
import { ElectronFile } from 'types/upload'; import { ElectronFile } from 'types/upload';
import importService from 'services/importService'; import importService from 'services/importService';
import Collections from 'components/Collections'; import Collections from 'components/Collections';
import { GalleryNavbar } from 'components/pages/gallery/Navbar';
export const DeadCenter = styled.div` export const DeadCenter = styled.div`
flex: 1; flex: 1;
@ -134,6 +133,8 @@ const defaultGalleryContext: GalleryContextType = {
syncWithRemote: () => null, syncWithRemote: () => null,
setNotificationAttributes: () => null, setNotificationAttributes: () => null,
setBlockingLoad: () => null, setBlockingLoad: () => null,
sidebarView: false,
closeSidebar: () => null,
}; };
export const GalleryContext = createContext<GalleryContextType>( export const GalleryContext = createContext<GalleryContextType>(
@ -210,6 +211,11 @@ export default function Gallery() {
const [electronFiles, setElectronFiles] = useState<ElectronFile[]>(null); const [electronFiles, setElectronFiles] = useState<ElectronFile[]>(null);
const [uploadTypeSelectorView, setUploadTypeSelectorView] = useState(false); const [uploadTypeSelectorView, setUploadTypeSelectorView] = useState(false);
const [sidebarView, setSidebarView] = useState(false);
const closeSidebar = () => setSidebarView(false);
const openSidebar = () => setSidebarView(true);
useEffect(() => { useEffect(() => {
const key = getKey(SESSION_KEYS.ENCRYPTION_KEY); const key = getKey(SESSION_KEYS.ENCRYPTION_KEY);
if (!key) { if (!key) {
@ -239,7 +245,6 @@ export default function Gallery() {
setIsFirstFetch(false); setIsFirstFetch(false);
}; };
main(); main();
appContext.showNavBar(true);
}, []); }, []);
useEffect( useEffect(
@ -579,6 +584,8 @@ export default function Gallery() {
syncWithRemote, syncWithRemote,
setNotificationAttributes, setNotificationAttributes,
setBlockingLoad, setBlockingLoad,
closeSidebar,
sidebarView,
}}> }}>
<FullScreenDropZone <FullScreenDropZone
getRootProps={getRootProps} getRootProps={getRootProps}
@ -603,16 +610,19 @@ export default function Gallery() {
attributes={notificationAttributes} attributes={notificationAttributes}
clearAttributes={clearNotificationAttributes} clearAttributes={clearNotificationAttributes}
/> />
<SearchBar <GalleryNavbar
isOpen={isInSearchMode} openSidebar={openSidebar}
setOpen={setIsInSearchMode}
isFirstFetch={isFirstFetch} isFirstFetch={isFirstFetch}
openUploader={openUploader}
isInSearchMode={isInSearchMode}
setIsInSearchMode={setIsInSearchMode}
collections={collections} collections={collections}
files={getNonTrashedUniqueUserFiles(files)} files={getNonTrashedUniqueUserFiles(files)}
setActiveCollection={setActiveCollection} setActiveCollection={setActiveCollection}
setSearch={updateSearch} updateSearch={updateSearch}
searchStats={searchStats} searchStats={searchStats}
/> />
<Collections <Collections
collections={collections} collections={collections}
isInSearchMode={isInSearchMode} isInSearchMode={isInSearchMode}
@ -666,10 +676,7 @@ export default function Gallery() {
setUploadTypeSelectorView={setUploadTypeSelectorView} setUploadTypeSelectorView={setUploadTypeSelectorView}
/> />
<Sidebar collectionSummaries={collectionSummaries} /> <Sidebar collectionSummaries={collectionSummaries} />
<UploadButton
isFirstFetch={isFirstFetch}
openUploader={openUploader}
/>
<PhotoFrame <PhotoFrame
files={files} files={files}
setFiles={setFiles} setFiles={setFiles}

View file

@ -32,6 +32,7 @@ import { useRouter } from 'next/router';
import SingleInputForm from 'components/SingleInputForm'; import SingleInputForm from 'components/SingleInputForm';
import { Card } from 'react-bootstrap'; import { Card } from 'react-bootstrap';
import { logError } from 'utils/sentry'; import { logError } from 'utils/sentry';
import SharedAlbumNavbar from 'components/pages/sharedAlbum/Navbar';
const Loader = () => ( const Loader = () => (
<VerticallyCentered> <VerticallyCentered>
@ -62,7 +63,6 @@ export default function PublicCollectionGallery() {
useState<CollectionSummaries>(new Map()); useState<CollectionSummaries>(new Map());
useEffect(() => { useEffect(() => {
appContext.showNavBar(true);
const currentURL = new URL(window.location.href); const currentURL = new URL(window.location.href);
if (currentURL.pathname !== PAGES.ROOT) { if (currentURL.pathname !== PAGES.ROOT) {
router.replace( router.replace(
@ -292,6 +292,7 @@ export default function PublicCollectionGallery() {
accessedThroughSharedURL: true, accessedThroughSharedURL: true,
openReportForm, openReportForm,
}}> }}>
<SharedAlbumNavbar />
<PhotoFrame <PhotoFrame
files={publicFiles} files={publicFiles}
setFiles={setPublicFiles} setFiles={setPublicFiles}

View file

@ -30,6 +30,8 @@ export type GalleryContextType = {
syncWithRemote: (force?: boolean, silent?: boolean) => Promise<void>; syncWithRemote: (force?: boolean, silent?: boolean) => Promise<void>;
setNotificationAttributes: (attributes: NotificationAttributes) => void; setNotificationAttributes: (attributes: NotificationAttributes) => void;
setBlockingLoad: (value: boolean) => void; setBlockingLoad: (value: boolean) => void;
sidebarView: boolean;
closeSidebar: () => void;
}; };
export interface NotificationAttributes { export interface NotificationAttributes {