π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
refactor: rename TripView to TripLayout and view to layout throughout codebase
anandbaburajana2a37fca36e6
diff --git a/web/apps/photos/src/components/Collections/CollectionShare.tsx b/web/apps/photos/src/components/Collections/CollectionShare.tsxindex 588c8b3f75..9a01ae2b82 100644--- a/web/apps/photos/src/components/Collections/CollectionShare.tsx+++ b/web/apps/photos/src/components/Collections/CollectionShare.tsx@@ -64,7 +64,7 @@ import {deleteShareURL,shareCollection,unshareCollection,- updateCollectionView,+ updateCollectionLayout,updatePublicURL,type CreatePublicURLAttributes,type UpdatePublicURLAttributes,@@ -1416,7 +1416,7 @@ const ManagePublicShareOptions: React.FC<ManagePublicShareOptionsProps> = ({title={t("share_album")}><Stack sx={{ gap: 3, py: "20px", px: "8px" }}>- <ManageView+ <ManageLayout{...{collection,onRootClose,@@ -1812,38 +1812,38 @@ const SetPublicLinkPassword: React.FC<SetPublicLinkPasswordProps> = ({);};-interface ManageViewProps {+interface ManageLayoutProps {onRootClose: () => void;collection: Collection;onRemotePull: (opts?: RemotePullOpts) => Promise<void>;setBlockingLoad: (value: boolean) => void;}-const ManageView: React.FC<ManageViewProps> = ({+const ManageLayout: React.FC<ManageLayoutProps> = ({onRootClose,collection,onRemotePull,setBlockingLoad,}) => {- const { show: showViewOptions, props: viewOptionsVisibilityProps } =+ const { show: showLayoutOptions, props: layoutOptionsVisibilityProps } =useModalVisibility();const [errorMessage, setErrorMessage] = useState("");- const options = useMemo(() => viewOptions(), []);+ const options = useMemo(() => layoutOptions(), []);- const currentView = collection.pubMagicMetadata?.data?.view || "grouped";+ const currentLayout = collection.pubMagicMetadata?.data?.layout || "grouped";- const changeViewValue = (value: string) => async () => {- if (value === currentView) return;+ const changeLayoutValue = (value: string) => async () => {+ if (value === currentLayout) return;setBlockingLoad(true);setErrorMessage("");try {- await updateCollectionView(collection, value);+ await updateCollectionLayout(collection, value);await onRemotePull({ silent: true });- viewOptionsVisibilityProps.onClose();+ layoutOptionsVisibilityProps.onClose();} catch (e) {- log.error("Could not update collection view", e);+ log.error("Could not update collection layout", e);setErrorMessage(t("generic_error"));} finally {setBlockingLoad(false);@@ -1854,17 +1854,17 @@ const ManageView: React.FC<ManageViewProps> = ({<><RowButtonGroup><RowButton- label="View"- caption={t(currentView)}- onClick={showViewOptions}+ label="Layout"+ caption={t(currentLayout)}+ onClick={showLayoutOptions}endIcon={<ChevronRightIcon />}/></RowButtonGroup><TitledNestedSidebarDraweranchor="right"- {...viewOptionsVisibilityProps}+ {...layoutOptionsVisibilityProps}onRootClose={onRootClose}- title="View"+ title="Layout"><Stack sx={{ gap: "32px", py: "20px", px: "8px" }}><RowButtonGroup>@@ -1872,10 +1872,10 @@ const ManageView: React.FC<ManageViewProps> = ({<React.Fragment key={value}><RowButtonfontWeight="regular"- onClick={changeViewValue(value)}+ onClick={changeLayoutValue(value)}label={label}endIcon={- currentView === value && <DoneIcon />+ currentLayout === value && <DoneIcon />}/>{index != options.length - 1 && (@@ -1898,7 +1898,7 @@ const ManageView: React.FC<ManageViewProps> = ({);};-const viewOptions = () => [+const layoutOptions = () => [{ label: t("grouped"), value: "grouped" },{ label: t("continuous"), value: "continuous" },{ label: t("trip"), value: "trip" },diff --git a/web/apps/photos/src/components/TripView/MapEvents.tsx b/web/apps/photos/src/components/TripLayout/MapEvents.tsxsimilarity index 100%rename from web/apps/photos/src/components/TripView/MapEvents.tsxrename to web/apps/photos/src/components/TripLayout/MapEvents.tsxdiff --git a/web/apps/photos/src/components/TripView/MobileCover.tsx b/web/apps/photos/src/components/TripLayout/MobileCover.tsxsimilarity index 100%rename from web/apps/photos/src/components/TripView/MobileCover.tsxrename to web/apps/photos/src/components/TripLayout/MobileCover.tsxdiff --git a/web/apps/photos/src/components/TripView/MobileNavBar.tsx b/web/apps/photos/src/components/TripLayout/MobileNavBar.tsxsimilarity index 100%rename from web/apps/photos/src/components/TripView/MobileNavBar.tsxrename to web/apps/photos/src/components/TripLayout/MobileNavBar.tsxdiff --git a/web/apps/photos/src/components/TripView/MobileTimelineLocation.tsx b/web/apps/photos/src/components/TripLayout/MobileTimelineLocation.tsxsimilarity index 100%rename from web/apps/photos/src/components/TripView/MobileTimelineLocation.tsxrename to web/apps/photos/src/components/TripLayout/MobileTimelineLocation.tsxdiff --git a/web/apps/photos/src/components/TripView/MobileTripStarted.tsx b/web/apps/photos/src/components/TripLayout/MobileTripStarted.tsxsimilarity index 100%rename from web/apps/photos/src/components/TripView/MobileTripStarted.tsxrename to web/apps/photos/src/components/TripLayout/MobileTripStarted.tsxdiff --git a/web/apps/photos/src/components/TripView/PhotoFan.tsx b/web/apps/photos/src/components/TripLayout/PhotoFan.tsxsimilarity index 100%rename from web/apps/photos/src/components/TripView/PhotoFan.tsxrename to web/apps/photos/src/components/TripLayout/PhotoFan.tsxdiff --git a/web/apps/photos/src/components/TripView/TimelineBaseLine.tsx b/web/apps/photos/src/components/TripLayout/TimelineBaseLine.tsxsimilarity index 100%rename from web/apps/photos/src/components/TripView/TimelineBaseLine.tsxrename to web/apps/photos/src/components/TripLayout/TimelineBaseLine.tsxdiff --git a/web/apps/photos/src/components/TripView/TimelineLocation.tsx b/web/apps/photos/src/components/TripLayout/TimelineLocation.tsxsimilarity index 100%rename from web/apps/photos/src/components/TripView/TimelineLocation.tsxrename to web/apps/photos/src/components/TripLayout/TimelineLocation.tsxdiff --git a/web/apps/photos/src/components/TripView/TimelineProgressLine.tsx b/web/apps/photos/src/components/TripLayout/TimelineProgressLine.tsxsimilarity index 100%rename from web/apps/photos/src/components/TripView/TimelineProgressLine.tsxrename to web/apps/photos/src/components/TripLayout/TimelineProgressLine.tsxdiff --git a/web/apps/photos/src/components/TripView/TopNavButtons.tsx b/web/apps/photos/src/components/TripLayout/TopNavButtons.tsxsimilarity index 100%rename from web/apps/photos/src/components/TripView/TopNavButtons.tsxrename to web/apps/photos/src/components/TripLayout/TopNavButtons.tsxdiff --git a/web/apps/photos/src/components/TripView/TripCover.tsx b/web/apps/photos/src/components/TripLayout/TripCover.tsxsimilarity index 100%rename from web/apps/photos/src/components/TripView/TripCover.tsxrename to web/apps/photos/src/components/TripLayout/TripCover.tsxdiff --git a/web/apps/photos/src/components/TripView/TripMap.tsx b/web/apps/photos/src/components/TripLayout/TripMap.tsxsimilarity index 100%rename from web/apps/photos/src/components/TripView/TripMap.tsxrename to web/apps/photos/src/components/TripLayout/TripMap.tsxdiff --git a/web/apps/photos/src/components/TripView/TripStartedSection.tsx b/web/apps/photos/src/components/TripLayout/TripStartedSection.tsxsimilarity index 100%rename from web/apps/photos/src/components/TripView/TripStartedSection.tsxrename to web/apps/photos/src/components/TripLayout/TripStartedSection.tsxdiff --git a/web/apps/photos/src/components/TripView/hooks/useDataProcessing.ts b/web/apps/photos/src/components/TripLayout/hooks/useDataProcessing.tssimilarity index 100%rename from web/apps/photos/src/components/TripView/hooks/useDataProcessing.tsrename to web/apps/photos/src/components/TripLayout/hooks/useDataProcessing.tsdiff --git a/web/apps/photos/src/components/TripView/hooks/useFileViewer.ts b/web/apps/photos/src/components/TripLayout/hooks/useFileViewer.tssimilarity index 100%rename from web/apps/photos/src/components/TripView/hooks/useFileViewer.tsrename to web/apps/photos/src/components/TripLayout/hooks/useFileViewer.tsdiff --git a/web/apps/photos/src/components/TripView/hooks/useLocationFetching.ts b/web/apps/photos/src/components/TripLayout/hooks/useLocationFetching.tssimilarity index 100%rename from web/apps/photos/src/components/TripView/hooks/useLocationFetching.tsrename to web/apps/photos/src/components/TripLayout/hooks/useLocationFetching.tsdiff --git a/web/apps/photos/src/components/TripView/hooks/useScrollHandling.ts b/web/apps/photos/src/components/TripLayout/hooks/useScrollHandling.tssimilarity index 100%rename from web/apps/photos/src/components/TripView/hooks/useScrollHandling.tsrename to web/apps/photos/src/components/TripLayout/hooks/useScrollHandling.tsdiff --git a/web/apps/photos/src/components/TripView/hooks/useThumbnailGeneration.ts b/web/apps/photos/src/components/TripLayout/hooks/useThumbnailGeneration.tssimilarity index 100%rename from web/apps/photos/src/components/TripView/hooks/useThumbnailGeneration.tsrename to web/apps/photos/src/components/TripLayout/hooks/useThumbnailGeneration.tsdiff --git a/web/apps/photos/src/components/TripView/index.tsx b/web/apps/photos/src/components/TripLayout/index.tsxsimilarity index 99%rename from web/apps/photos/src/components/TripView/index.tsxrename to web/apps/photos/src/components/TripLayout/index.tsxindex 75da13ecd2..b67ea74bd3 100644--- a/web/apps/photos/src/components/TripView/index.tsx+++ b/web/apps/photos/src/components/TripLayout/index.tsx@@ -30,7 +30,7 @@ import { useThumbnailGeneration } from "./hooks/useThumbnailGeneration";import type { JourneyPoint } from "./types";import type { PositionInfo } from "./utils/scrollUtils";-interface TripViewProps {+interface TripLayoutProps {files: EnteFile[];collection?: Collection;albumTitle?: string;@@ -42,7 +42,7 @@ interface TripViewProps {onAddPhotos?: () => void; // Callback for add photos button}-export const TripView: React.FC<TripViewProps> = ({+export const TripLayout: React.FC<TripLayoutProps> = ({files,collection,albumTitle,@@ -256,7 +256,7 @@ export const TripView: React.FC<TripViewProps> = ({const hasPhotoData = journeyData.length > 0;return (- <TripViewContainer>+ <TripLayoutContainer>{!openFileViewer &&(isTouchDevice ? (<MobileNavBar@@ -532,12 +532,12 @@ export const TripView: React.FC<TripViewProps> = ({saveGroups={saveGroups}onRemoveSaveGroup={onRemoveSaveGroup}/>- </TripViewContainer>+ </TripLayoutContainer>);};// Styled components-const TripViewContainer = styled(Box)({+const TripLayoutContainer = styled(Box)({position: "relative",width: "100%",height: "100%",diff --git a/web/apps/photos/src/components/TripView/mapHelpers.ts b/web/apps/photos/src/components/TripLayout/mapHelpers.tssimilarity index 100%rename from web/apps/photos/src/components/TripView/mapHelpers.tsrename to web/apps/photos/src/components/TripLayout/mapHelpers.tsdiff --git a/web/apps/photos/src/components/TripView/types.ts b/web/apps/photos/src/components/TripLayout/types.tssimilarity index 100%rename from web/apps/photos/src/components/TripView/types.tsrename to web/apps/photos/src/components/TripLayout/types.tsdiff --git a/web/apps/photos/src/components/TripView/utils/dataProcessing.ts b/web/apps/photos/src/components/TripLayout/utils/dataProcessing.tssimilarity index 100%rename from web/apps/photos/src/components/TripView/utils/dataProcessing.tsrename to web/apps/photos/src/components/TripLayout/utils/dataProcessing.tsdiff --git a/web/apps/photos/src/components/TripView/utils/geocoding.ts b/web/apps/photos/src/components/TripLayout/utils/geocoding.tssimilarity index 100%rename from web/apps/photos/src/components/TripView/utils/geocoding.tsrename to web/apps/photos/src/components/TripLayout/utils/geocoding.tsdiff --git a/web/apps/photos/src/components/TripView/utils/scrollUtils.ts b/web/apps/photos/src/components/TripLayout/utils/scrollUtils.tssimilarity index 100%rename from web/apps/photos/src/components/TripView/utils/scrollUtils.tsrename to web/apps/photos/src/components/TripLayout/utils/scrollUtils.tsdiff --git a/web/apps/photos/src/pages/shared-albums.tsx b/web/apps/photos/src/pages/shared-albums.tsxindex dc81037bf2..cc0d040779 100644--- a/web/apps/photos/src/pages/shared-albums.tsx+++ b/web/apps/photos/src/pages/shared-albums.tsx@@ -17,7 +17,7 @@ import Typography from "@mui/material/Typography";import { DownloadStatusNotifications } from "components/DownloadStatusNotifications";import { type FileListHeaderOrFooter } from "components/FileList";import { FileListWithViewer } from "components/FileListWithViewer";-import { TripView } from "components/TripView";+import { TripLayout } from "components/TripLayout";import { Upload } from "components/Upload";import {AccountsPageContents,@@ -463,15 +463,15 @@ export default function PublicCollectionGallery() {);}- const view = publicCollection?.pubMagicMetadata?.data.view || "grouped";+ const layout = publicCollection?.pubMagicMetadata?.data.layout || "grouped";return (<FullScreenDropZonedisabled={shouldDisableDropzone}onDrop={setDragAndDropFiles}>- {view === "trip" ? (- <TripView+ {layout === "trip" ? (+ <TripLayoutfiles={publicFiles}collection={publicCollection}onAddPhotos={onAddPhotos}@@ -514,7 +514,7 @@ export default function PublicCollectionGallery() {selected={selected}setSelected={setSelected}activeCollectionID={PseudoCollectionID.all}- disableGrouping={view === "continuous"}+ disableGrouping={layout === "continuous"}onRemotePull={publicAlbumsRemotePull}onVisualFeedback={handleVisualFeedback}onAddSaveGroup={onAddSaveGroup}diff --git a/web/packages/media/collection.ts b/web/packages/media/collection.tsindex fa3d36c2dc..d9243843db 100644--- a/web/packages/media/collection.ts+++ b/web/packages/media/collection.ts@@ -676,13 +676,13 @@ export interface CollectionPublicMagicMetadataData {*/coverID?: number;/**- * The view type for the public collection display.+ * The layout type for the public collection display.** Expected to be one of: "grouped", "continuous", "trip".** When undefined, the UI defaults to "grouped" behavior.*/- view?: string;+ layout?: string;}/**@@ -691,7 +691,7 @@ export interface CollectionPublicMagicMetadataData {export const CollectionPublicMagicMetadataData = z.looseObject({asc: z.boolean().nullish().transform(nullToUndefined),coverID: z.number().nullish().transform(nullToUndefined),- view: z.string().nullish().transform(nullToUndefined),+ layout: z.string().nullish().transform(nullToUndefined),});/**diff --git a/web/packages/new/photos/services/collection.ts b/web/packages/new/photos/services/collection.tsindex e09c7b746e..71fce1d933 100644--- a/web/packages/new/photos/services/collection.ts+++ b/web/packages/new/photos/services/collection.ts@@ -1037,20 +1037,20 @@ export const updateCollectionSortOrder = async () => updateCollectionPublicMagicMetadata(collection, { asc });/**- * Change the view type of a collection on remote.+ * Change the layout type of a collection on remote.** Remote only, does not modify local state.** This function works only for collections owned by the user.*- * @param collection The collection whose view we want to change.+ * @param collection The collection whose layout we want to change.*- * @param view The view type ("grouped", "continuous", "trip").+ * @param layout The layout type ("grouped", "continuous", "trip").*/-export const updateCollectionView = async (+export const updateCollectionLayout = async (collection: Collection,- view: string,-) => updateCollectionPublicMagicMetadata(collection, { view });+ layout: string,+) => updateCollectionPublicMagicMetadata(collection, { layout });/*** Update the private magic metadata of a collection on remote.