mirror of
https://github.com/ente-io/ente.git
synced 2025-08-10 08:22:20 +00:00
wip: checkpoint
This commit is contained in:
parent
2865113c4d
commit
b97cf93c12
@ -213,7 +213,7 @@ export const CollectionListBar: React.FC<CollectionListBarProps> = ({
|
|||||||
itemSize={94}
|
itemSize={94}
|
||||||
useIsScrolling
|
useIsScrolling
|
||||||
>
|
>
|
||||||
{CollectionCardContainer}
|
{ListItem}
|
||||||
</FixedSizeList>
|
</FixedSizeList>
|
||||||
)}
|
)}
|
||||||
</AutoSizer>
|
</AutoSizer>
|
||||||
@ -305,45 +305,6 @@ type ItemData =
|
|||||||
activePerson: Person;
|
activePerson: Person;
|
||||||
};
|
};
|
||||||
|
|
||||||
const CollectionCardContainer = memo(
|
|
||||||
({
|
|
||||||
data,
|
|
||||||
index,
|
|
||||||
style,
|
|
||||||
isScrolling,
|
|
||||||
}: ListChildComponentProps<ItemData>) => {
|
|
||||||
let card: React.ReactNode;
|
|
||||||
switch (data.type) {
|
|
||||||
case "collections": {
|
|
||||||
const {
|
|
||||||
collectionSummaries,
|
|
||||||
activeCollectionID,
|
|
||||||
onCollectionClick,
|
|
||||||
} = data;
|
|
||||||
const collectionSummary = collectionSummaries[index];
|
|
||||||
|
|
||||||
card = (
|
|
||||||
<CollectionListBarCard
|
|
||||||
key={collectionSummary.id}
|
|
||||||
activeCollectionID={activeCollectionID}
|
|
||||||
isScrolling={isScrolling}
|
|
||||||
collectionSummary={collectionSummary}
|
|
||||||
onCollectionClick={onCollectionClick}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "people":
|
|
||||||
card = "Person";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return <div style={style}>{card}</div>;
|
|
||||||
},
|
|
||||||
areEqual,
|
|
||||||
);
|
|
||||||
|
|
||||||
const getItemCount = (data: ItemData) => {
|
const getItemCount = (data: ItemData) => {
|
||||||
switch (data.type) {
|
switch (data.type) {
|
||||||
case "collections": {
|
case "collections": {
|
||||||
@ -370,6 +331,42 @@ const getItemKey = (index: number, data: ItemData) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const ListItem = memo((props: ListChildComponentProps<ItemData>) => {
|
||||||
|
const { data, index, style, isScrolling } = props;
|
||||||
|
|
||||||
|
let card: React.ReactNode;
|
||||||
|
|
||||||
|
switch (data.type) {
|
||||||
|
case "collections": {
|
||||||
|
const {
|
||||||
|
collectionSummaries,
|
||||||
|
activeCollectionID,
|
||||||
|
onCollectionClick,
|
||||||
|
} = data;
|
||||||
|
const collectionSummary = collectionSummaries[index];
|
||||||
|
card = (
|
||||||
|
<CollectionListBarCard
|
||||||
|
key={collectionSummary.id}
|
||||||
|
activeCollectionID={activeCollectionID}
|
||||||
|
isScrolling={isScrolling}
|
||||||
|
collectionSummary={collectionSummary}
|
||||||
|
onCollectionClick={onCollectionClick}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case "people": {
|
||||||
|
const { people, activePerson } = data;
|
||||||
|
const person = people[index];
|
||||||
|
card = <PersonCard {...{ person, activePerson }} />;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return <div style={style}>{card}</div>;
|
||||||
|
}, areEqual);
|
||||||
|
|
||||||
const ScrollButtonBase: React.FC<
|
const ScrollButtonBase: React.FC<
|
||||||
React.ButtonHTMLAttributes<HTMLButtonElement>
|
React.ButtonHTMLAttributes<HTMLButtonElement>
|
||||||
> = (props) => (
|
> = (props) => (
|
||||||
@ -523,3 +520,26 @@ const Ellipse = styled(Typography)`
|
|||||||
line-clamp: 2;
|
line-clamp: 2;
|
||||||
-webkit-box-orient: vertical;
|
-webkit-box-orient: vertical;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
interface PersondCardProps {
|
||||||
|
person: Person;
|
||||||
|
activePerson: Person;
|
||||||
|
// onCollectionClick: (collectionID: number) => void;
|
||||||
|
// isScrolling?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
const PersonCard = ({ person, activePerson }: PersondCardProps) => (
|
||||||
|
<Box>
|
||||||
|
<CollectionCard
|
||||||
|
collectionTile={CollectionBarTile}
|
||||||
|
coverFile={person.displayFaceFile}
|
||||||
|
onClick={() => {
|
||||||
|
//onCollectionClick(collectionSummary.id);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<CollectionCardText collectionName={person.name} />
|
||||||
|
{/* <CollectionCardIcon collectionType={collectionSummary.type} /> */}
|
||||||
|
</CollectionCard>
|
||||||
|
{activePerson.id === person.id && <ActiveIndicator />}
|
||||||
|
</Box>
|
||||||
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user