Use
This commit is contained in:
@@ -38,7 +38,6 @@ import {
|
||||
type GalleryBarAndListHeaderProps = Omit<
|
||||
GalleryBarImplProps,
|
||||
| "collectionSummaries"
|
||||
| "hiddenCollectionSummaries"
|
||||
| "onSelectCollectionID"
|
||||
| "collectionsSortBy"
|
||||
| "onChangeCollectionsSortBy"
|
||||
@@ -112,7 +111,6 @@ export const GalleryBarAndListHeader: React.FC<
|
||||
const [collectionsSortBy, setCollectionsSortBy] =
|
||||
useCollectionsSortByLocalState("updation-time-desc");
|
||||
|
||||
|
||||
const shouldBeHidden = useMemo(
|
||||
() =>
|
||||
shouldHide ||
|
||||
|
||||
@@ -124,12 +124,12 @@ import { SubscriptionCard } from "./SubscriptionCard";
|
||||
|
||||
type SidebarProps = ModalVisibilityProps & {
|
||||
/**
|
||||
* The latest set of collections, sections and pseudo-collections.
|
||||
* Information about non-hidden collections and pseudo-collections.
|
||||
*
|
||||
* These are used to obtain data about the archive, hidden and trash
|
||||
* "section" entries shown within the shortcut section of the sidebar.
|
||||
*/
|
||||
collectionSummaries: CollectionSummaries;
|
||||
normalCollectionSummaries: CollectionSummaries;
|
||||
/**
|
||||
* The ID of the collection summary that should be shown when the user
|
||||
* activates the "Uncategorized" section shortcut.
|
||||
@@ -171,7 +171,7 @@ type SidebarProps = ModalVisibilityProps & {
|
||||
export const Sidebar: React.FC<SidebarProps> = ({
|
||||
open,
|
||||
onClose,
|
||||
collectionSummaries,
|
||||
normalCollectionSummaries,
|
||||
uncategorizedCollectionSummaryID,
|
||||
onShowPlanSelector,
|
||||
onShowCollectionSummary,
|
||||
@@ -186,7 +186,7 @@ export const Sidebar: React.FC<SidebarProps> = ({
|
||||
<ShortcutSection
|
||||
onCloseSidebar={onClose}
|
||||
{...{
|
||||
collectionSummaries,
|
||||
normalCollectionSummaries,
|
||||
uncategorizedCollectionSummaryID,
|
||||
onShowCollectionSummary,
|
||||
onShowHiddenSection,
|
||||
@@ -458,7 +458,7 @@ const ManageMemberSubscription: React.FC<ManageMemberSubscriptionProps> = ({
|
||||
type ShortcutSectionProps = SectionProps &
|
||||
Pick<
|
||||
SidebarProps,
|
||||
| "collectionSummaries"
|
||||
| "normalCollectionSummaries"
|
||||
| "uncategorizedCollectionSummaryID"
|
||||
| "onShowCollectionSummary"
|
||||
| "onShowHiddenSection"
|
||||
@@ -466,7 +466,7 @@ type ShortcutSectionProps = SectionProps &
|
||||
|
||||
const ShortcutSection: React.FC<ShortcutSectionProps> = ({
|
||||
onCloseSidebar,
|
||||
collectionSummaries,
|
||||
normalCollectionSummaries,
|
||||
uncategorizedCollectionSummaryID,
|
||||
onShowCollectionSummary,
|
||||
onShowHiddenSection,
|
||||
@@ -489,8 +489,8 @@ const ShortcutSection: React.FC<ShortcutSectionProps> = ({
|
||||
const openHiddenSection = () =>
|
||||
void onShowHiddenSection().then(onCloseSidebar);
|
||||
|
||||
const summaryCaption = (collectionSummaryID: number) =>
|
||||
collectionSummaries.get(collectionSummaryID)?.fileCount.toString();
|
||||
const summaryCaption = (summaryID: number) =>
|
||||
normalCollectionSummaries.get(summaryID)?.fileCount.toString();
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -249,6 +249,10 @@ const Page: React.FC = () => {
|
||||
: state.view?.activeCollectionSummaryID;
|
||||
const activeCollection =
|
||||
state.view?.type == "people" ? undefined : state.view?.activeCollection;
|
||||
const activeCollectionSummary =
|
||||
state.view?.type == "people"
|
||||
? undefined
|
||||
: state.view?.activeCollectionSummary;
|
||||
const activePerson =
|
||||
state.view?.type == "people" ? state.view.activePerson : undefined;
|
||||
const activePersonID = activePerson?.id;
|
||||
@@ -931,18 +935,16 @@ const Page: React.FC = () => {
|
||||
state.collections,
|
||||
)}
|
||||
isFavoriteCollection={
|
||||
normalCollectionSummaries.get(activeCollectionID)
|
||||
?.type == "favorites"
|
||||
activeCollectionSummary?.type == "favorites"
|
||||
}
|
||||
isUncategorizedCollection={
|
||||
normalCollectionSummaries.get(activeCollectionID)
|
||||
?.type == "uncategorized"
|
||||
activeCollectionSummary?.type == "uncategorized"
|
||||
}
|
||||
isIncomingSharedCollection={
|
||||
normalCollectionSummaries.get(activeCollectionID)
|
||||
?.type == "incomingShareCollaborator" ||
|
||||
normalCollectionSummaries.get(activeCollectionID)
|
||||
?.type == "incomingShareViewer"
|
||||
activeCollectionSummary?.type ==
|
||||
"incomingShareCollaborator" ||
|
||||
activeCollectionSummary?.type ==
|
||||
"incomingShareViewer"
|
||||
}
|
||||
isInSearchMode={isInSearchMode}
|
||||
isInHiddenSection={barMode == "hidden-albums"}
|
||||
@@ -1022,7 +1024,7 @@ const Page: React.FC = () => {
|
||||
/>
|
||||
<Sidebar
|
||||
{...sidebarVisibilityProps}
|
||||
collectionSummaries={normalCollectionSummaries}
|
||||
normalCollectionSummaries={normalCollectionSummaries}
|
||||
uncategorizedCollectionSummaryID={
|
||||
state.uncategorizedCollectionSummaryID
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user