From 670a75048ebf4245c903678832a755d034e91c62 Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Mon, 6 Jan 2025 12:12:57 +0530 Subject: [PATCH] codemods + manual --- .../albums/components/UploaderNameInput.tsx | 9 ++- .../components/CollectionMappingChoice.tsx | 4 +- .../new/photos/components/DevSettings.tsx | 36 +++++----- .../new/photos/components/PeopleList.tsx | 14 ++-- .../new/photos/components/PlanSelector.tsx | 55 +++++++++------- .../new/photos/components/SearchBar.tsx | 23 ++++--- .../new/photos/components/WhatsNew.tsx | 4 +- .../new/photos/components/gallery/BarImpl.tsx | 30 +++++---- .../photos/components/gallery/ListHeader.tsx | 4 +- .../components/gallery/PeopleHeader.tsx | 10 +-- .../new/photos/components/gallery/index.tsx | 4 +- .../photos/components/sidebar/MLSettings.tsx | 66 +++++++++---------- .../components/sidebar/TwoFactorSettings.tsx | 13 ++-- web/packages/new/photos/pages/duplicates.tsx | 21 ++++-- 14 files changed, 166 insertions(+), 127 deletions(-) diff --git a/web/packages/new/albums/components/UploaderNameInput.tsx b/web/packages/new/albums/components/UploaderNameInput.tsx index 2b4c04e828..3bfca83ff0 100644 --- a/web/packages/new/albums/components/UploaderNameInput.tsx +++ b/web/packages/new/albums/components/UploaderNameInput.tsx @@ -54,21 +54,20 @@ export const UploaderNameInput: React.FC = ({ fullWidth > ({ padding: "24px 16px 0px 16px", svg: { width: "44px", height: "44px", }, - color: (theme) => theme.colors.stroke.muted, - }} + color: theme.colors.stroke.muted, + })} > {} {t("enter_name")} - - + {t("uploader_name_hint")} - {t("upload_to_choice")} + + {t("upload_to_choice")} + = ({ initialAPIOrigin, onClose }) => { ? form.errors.apiOrigin : " " /* always show an empty string to prevent a layout shift */ } - InputProps={{ - endAdornment: ( - - - + - - - - - ), + + + + + + ), + }, }} /> diff --git a/web/packages/new/photos/components/PeopleList.tsx b/web/packages/new/photos/components/PeopleList.tsx index 28455f4e66..82abf0fcdf 100644 --- a/web/packages/new/photos/components/PeopleList.tsx +++ b/web/packages/new/photos/components/PeopleList.tsx @@ -21,7 +21,11 @@ export const SearchPeopleList: React.FC = ({ const isSmallWidth = useIsSmallWidth(); return ( 3 ? "center" : "start" }} + sx={[ + people.length > 3 + ? { justifyContent: "center" } + : { justifyContent: "start" }, + ]} > {people.slice(0, isSmallWidth ? 6 : 7).map((person) => ( = ({ placeholderDimension, }) => { const [url, setURL] = useState(); - useEffect(() => { let didCancel = false; - void faceCrop(faceID, file).then((url) => !didCancel && setURL(url)); return () => { @@ -212,9 +214,9 @@ const FaceCropImageView: React.FC = ({ theme.colors.background.elevated2, - }} + sx={(theme) => ({ + backgroundColor: theme.colors.background.elevated2, + })} width={placeholderDimension} height={placeholderDimension} /> diff --git a/web/packages/new/photos/components/PlanSelector.tsx b/web/packages/new/photos/components/PlanSelector.tsx index 3d6982f792..002c718bff 100644 --- a/web/packages/new/photos/components/PlanSelector.tsx +++ b/web/packages/new/photos/components/PlanSelector.tsx @@ -229,7 +229,7 @@ const PlanSelectorCard: React.FC = ({ ); return ( - + {subscription && isSubscriptionActivePaid(subscription) ? ( ( <> - + {t("choose_plan")} @@ -318,7 +318,10 @@ const FreeSubscriptionPlanSelectorCard: React.FC< planPeriod={planPeriod} togglePeriod={togglePeriod} /> - + {t("two_months_free")} @@ -358,13 +361,13 @@ const PaidSubscriptionPlanSelectorCard: React.FC< children, }) => ( <> - + - + {t("subscription")} - + {bytesInGB(subscription.storage, 2)}{" "} {t("storage_unit.gb")} @@ -375,8 +378,8 @@ const PaidSubscriptionPlanSelectorCard: React.FC< - - + + `1px solid ${theme.palette.divider}`} - p={1.5} - borderRadius={(theme) => `${theme.shape.borderRadius}px`} + sx={(theme) => ({ + border: `1px solid ${theme.palette.divider}`, + borderRadius: `${theme.shape.borderRadius}px`, + gap: 3, + p: 1.5, + })} > - + {t("two_months_free")} {children} - - + + {!isSubscriptionCancelled(subscription) ? t("subscription_status_renewal_active", { date: subscription.expiryTime, @@ -543,7 +551,7 @@ const PlanRow: React.FC = ({ {bytesInGB(plan.storage)} - + {t("storage_unit.gb")} {popular && @@ -553,7 +561,7 @@ const PlanRow: React.FC = ({ ) && {t("POPULAR")}} - + = ({ size="large" onClick={handleClick} > - - + + {plan.price}{" "} {" "} - + {`/ ${ plan.period === "month" ? t("month_short") @@ -629,7 +640,7 @@ const FreePlanRow: React.FC = ({ onClose, storage }) => ( {t("free_plan_option")} - + {t("free_plan_description", { storage: formattedStorageByteSize(storage), })} @@ -657,7 +668,7 @@ interface AddOnBonusRowsProps { const AddOnBonusRows: React.FC = ({ addOnBonuses }) => ( <> {addOnBonuses.map((bonus, i) => ( - + ) => ( }} > ({ display: "inline-flex", // Match the default padding of the ValueContainer to make // the icon look properly spaced and aligned. pl: "8px", - color: (theme) => theme.colors.stroke.muted, - }} + color: theme.colors.stroke.muted, + })} > {iconForOption(props.getValue()[0])} @@ -433,7 +433,7 @@ const EmptyState: React.FC< const SearchPeopleHeader: React.FC = ({ onClick }) => ( - {t("people")} + {t("people")} ); @@ -456,14 +456,17 @@ const Option: React.FC> = (props) => ( ); const OptionContents = ({ data: option }: { data: SearchOption }) => ( - - + + {labelForOption(option)} ( > {option.suggestion.label} - + {t("photos_count", { count: option.fileCount })} - + {option.previewFiles.map((file) => ( = ({ open, onClose }) => { maxWidth="xs" fullWidth > - + - + {ut("What's new")} diff --git a/web/packages/new/photos/components/gallery/BarImpl.tsx b/web/packages/new/photos/components/gallery/BarImpl.tsx index 5786559998..1fff5897a4 100644 --- a/web/packages/new/photos/components/gallery/BarImpl.tsx +++ b/web/packages/new/photos/components/gallery/BarImpl.tsx @@ -218,7 +218,14 @@ export const GalleryBarImpl: React.FC = ({ ); const controls1 = isSmallWidth && ( - + {mode != "people" && ( <> = ({ ); const controls2 = !isSmallWidth && mode != "people" && ( - + propName != "active", })<{ active: boolean }>( - ({ active, theme }) => ` + ({ theme, active }) => ` p { color: ${active ? theme.colors.text.base : theme.colors.text.muted} } p:hover { color: ${theme.colors.text.base} } `, @@ -367,11 +381,9 @@ const ScrollButtonBase_ = styled("button")` border: none; padding: 0; margin: 0; - border-radius: 50%; background-color: ${({ theme }) => theme.colors.backdrop.muted}; color: ${({ theme }) => theme.colors.stroke.base}; - & > svg { border-radius: 50%; height: 30px; @@ -383,7 +395,6 @@ const ScrollButtonLeft = styled(ScrollButtonBase)` left: 0; text-align: right; transform: translate(-50%, 0%); - & > svg { transform: rotate(180deg); } @@ -465,7 +476,6 @@ const ListItem = memo((props: ListChildComponentProps) => { ); break; } - case "people": { const { people, activePerson, onSelectPerson } = data; const person = people[index]!; @@ -508,7 +518,7 @@ const CollectionBarCard: React.FC = ({ const CardText: React.FC = ({ children }) => ( - + {children} @@ -527,9 +537,7 @@ const CollectionBarCardIcon: React.FC = ({ {type == "favorites" && } {type == "archived" && ( ({ - color: theme.colors.white.muted, - })} + sx={(theme) => ({ color: theme.colors.white.muted })} /> )} {type == "outgoingShare" && } diff --git a/web/packages/new/photos/components/gallery/ListHeader.tsx b/web/packages/new/photos/components/gallery/ListHeader.tsx index c309cb15bd..1f59074b83 100644 --- a/web/packages/new/photos/components/gallery/ListHeader.tsx +++ b/web/packages/new/photos/components/gallery/ListHeader.tsx @@ -55,13 +55,13 @@ export const GalleryItemsSummary: React.FC = ({ - + {t("photos_count", { count: fileCount })} {endIcon && ( diff --git a/web/packages/new/photos/components/gallery/PeopleHeader.tsx b/web/packages/new/photos/components/gallery/PeopleHeader.tsx index 91bd6ff432..851f7b241b 100644 --- a/web/packages/new/photos/components/gallery/PeopleHeader.tsx +++ b/web/packages/new/photos/components/gallery/PeopleHeader.tsx @@ -651,7 +651,7 @@ const SuggestionsDialog: React.FC = ({ ? t("saved_choices") : t("review_suggestions")} - + {person.name ?? " "} @@ -698,8 +698,10 @@ const SuggestionsDialog: React.FC = ({ ) : state.suggestions.length == 0 ? ( {t("people_suggestions_empty")} @@ -760,7 +762,7 @@ const SuggestionOrChoiceList: React.FC = ({ }} > - + {/* Use the face count as as stand-in for the photo count */} {t("photos_count", { count: item.faces.length })} diff --git a/web/packages/new/photos/components/gallery/index.tsx b/web/packages/new/photos/components/gallery/index.tsx index 216e08a2bc..dda0130e07 100644 --- a/web/packages/new/photos/components/gallery/index.tsx +++ b/web/packages/new/photos/components/gallery/index.tsx @@ -38,7 +38,7 @@ export const SearchResultsHeader: React.FC = ({ fileCount, }) => ( - + {t("search_results")} = ({ }) => (