Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

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.tsx
index 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>
<TitledNestedSidebarDrawer
anchor="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}>
<RowButton
fontWeight="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.tsx
similarity index 100%
rename from web/apps/photos/src/components/TripView/MapEvents.tsx
rename to web/apps/photos/src/components/TripLayout/MapEvents.tsx
diff --git a/web/apps/photos/src/components/TripView/MobileCover.tsx b/web/apps/photos/src/components/TripLayout/MobileCover.tsx
similarity index 100%
rename from web/apps/photos/src/components/TripView/MobileCover.tsx
rename to web/apps/photos/src/components/TripLayout/MobileCover.tsx
diff --git a/web/apps/photos/src/components/TripView/MobileNavBar.tsx b/web/apps/photos/src/components/TripLayout/MobileNavBar.tsx
similarity index 100%
rename from web/apps/photos/src/components/TripView/MobileNavBar.tsx
rename to web/apps/photos/src/components/TripLayout/MobileNavBar.tsx
diff --git a/web/apps/photos/src/components/TripView/MobileTimelineLocation.tsx b/web/apps/photos/src/components/TripLayout/MobileTimelineLocation.tsx
similarity index 100%
rename from web/apps/photos/src/components/TripView/MobileTimelineLocation.tsx
rename to web/apps/photos/src/components/TripLayout/MobileTimelineLocation.tsx
diff --git a/web/apps/photos/src/components/TripView/MobileTripStarted.tsx b/web/apps/photos/src/components/TripLayout/MobileTripStarted.tsx
similarity index 100%
rename from web/apps/photos/src/components/TripView/MobileTripStarted.tsx
rename to web/apps/photos/src/components/TripLayout/MobileTripStarted.tsx
diff --git a/web/apps/photos/src/components/TripView/PhotoFan.tsx b/web/apps/photos/src/components/TripLayout/PhotoFan.tsx
similarity index 100%
rename from web/apps/photos/src/components/TripView/PhotoFan.tsx
rename to web/apps/photos/src/components/TripLayout/PhotoFan.tsx
diff --git a/web/apps/photos/src/components/TripView/TimelineBaseLine.tsx b/web/apps/photos/src/components/TripLayout/TimelineBaseLine.tsx
similarity index 100%
rename from web/apps/photos/src/components/TripView/TimelineBaseLine.tsx
rename to web/apps/photos/src/components/TripLayout/TimelineBaseLine.tsx
diff --git a/web/apps/photos/src/components/TripView/TimelineLocation.tsx b/web/apps/photos/src/components/TripLayout/TimelineLocation.tsx
similarity index 100%
rename from web/apps/photos/src/components/TripView/TimelineLocation.tsx
rename to web/apps/photos/src/components/TripLayout/TimelineLocation.tsx
diff --git a/web/apps/photos/src/components/TripView/TimelineProgressLine.tsx b/web/apps/photos/src/components/TripLayout/TimelineProgressLine.tsx
similarity index 100%
rename from web/apps/photos/src/components/TripView/TimelineProgressLine.tsx
rename to web/apps/photos/src/components/TripLayout/TimelineProgressLine.tsx
diff --git a/web/apps/photos/src/components/TripView/TopNavButtons.tsx b/web/apps/photos/src/components/TripLayout/TopNavButtons.tsx
similarity index 100%
rename from web/apps/photos/src/components/TripView/TopNavButtons.tsx
rename to web/apps/photos/src/components/TripLayout/TopNavButtons.tsx
diff --git a/web/apps/photos/src/components/TripView/TripCover.tsx b/web/apps/photos/src/components/TripLayout/TripCover.tsx
similarity index 100%
rename from web/apps/photos/src/components/TripView/TripCover.tsx
rename to web/apps/photos/src/components/TripLayout/TripCover.tsx
diff --git a/web/apps/photos/src/components/TripView/TripMap.tsx b/web/apps/photos/src/components/TripLayout/TripMap.tsx
similarity index 100%
rename from web/apps/photos/src/components/TripView/TripMap.tsx
rename to web/apps/photos/src/components/TripLayout/TripMap.tsx
diff --git a/web/apps/photos/src/components/TripView/TripStartedSection.tsx b/web/apps/photos/src/components/TripLayout/TripStartedSection.tsx
similarity index 100%
rename from web/apps/photos/src/components/TripView/TripStartedSection.tsx
rename to web/apps/photos/src/components/TripLayout/TripStartedSection.tsx
diff --git a/web/apps/photos/src/components/TripView/hooks/useDataProcessing.ts b/web/apps/photos/src/components/TripLayout/hooks/useDataProcessing.ts
similarity index 100%
rename from web/apps/photos/src/components/TripView/hooks/useDataProcessing.ts
rename to web/apps/photos/src/components/TripLayout/hooks/useDataProcessing.ts
diff --git a/web/apps/photos/src/components/TripView/hooks/useFileViewer.ts b/web/apps/photos/src/components/TripLayout/hooks/useFileViewer.ts
similarity index 100%
rename from web/apps/photos/src/components/TripView/hooks/useFileViewer.ts
rename to web/apps/photos/src/components/TripLayout/hooks/useFileViewer.ts
diff --git a/web/apps/photos/src/components/TripView/hooks/useLocationFetching.ts b/web/apps/photos/src/components/TripLayout/hooks/useLocationFetching.ts
similarity index 100%
rename from web/apps/photos/src/components/TripView/hooks/useLocationFetching.ts
rename to web/apps/photos/src/components/TripLayout/hooks/useLocationFetching.ts
diff --git a/web/apps/photos/src/components/TripView/hooks/useScrollHandling.ts b/web/apps/photos/src/components/TripLayout/hooks/useScrollHandling.ts
similarity index 100%
rename from web/apps/photos/src/components/TripView/hooks/useScrollHandling.ts
rename to web/apps/photos/src/components/TripLayout/hooks/useScrollHandling.ts
diff --git a/web/apps/photos/src/components/TripView/hooks/useThumbnailGeneration.ts b/web/apps/photos/src/components/TripLayout/hooks/useThumbnailGeneration.ts
similarity index 100%
rename from web/apps/photos/src/components/TripView/hooks/useThumbnailGeneration.ts
rename to web/apps/photos/src/components/TripLayout/hooks/useThumbnailGeneration.ts
diff --git a/web/apps/photos/src/components/TripView/index.tsx b/web/apps/photos/src/components/TripLayout/index.tsx
similarity index 99%
rename from web/apps/photos/src/components/TripView/index.tsx
rename to web/apps/photos/src/components/TripLayout/index.tsx
index 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.ts
similarity index 100%
rename from web/apps/photos/src/components/TripView/mapHelpers.ts
rename to web/apps/photos/src/components/TripLayout/mapHelpers.ts
diff --git a/web/apps/photos/src/components/TripView/types.ts b/web/apps/photos/src/components/TripLayout/types.ts
similarity index 100%
rename from web/apps/photos/src/components/TripView/types.ts
rename to web/apps/photos/src/components/TripLayout/types.ts
diff --git a/web/apps/photos/src/components/TripView/utils/dataProcessing.ts b/web/apps/photos/src/components/TripLayout/utils/dataProcessing.ts
similarity index 100%
rename from web/apps/photos/src/components/TripView/utils/dataProcessing.ts
rename to web/apps/photos/src/components/TripLayout/utils/dataProcessing.ts
diff --git a/web/apps/photos/src/components/TripView/utils/geocoding.ts b/web/apps/photos/src/components/TripLayout/utils/geocoding.ts
similarity index 100%
rename from web/apps/photos/src/components/TripView/utils/geocoding.ts
rename to web/apps/photos/src/components/TripLayout/utils/geocoding.ts
diff --git a/web/apps/photos/src/components/TripView/utils/scrollUtils.ts b/web/apps/photos/src/components/TripLayout/utils/scrollUtils.ts
similarity index 100%
rename from web/apps/photos/src/components/TripView/utils/scrollUtils.ts
rename to web/apps/photos/src/components/TripLayout/utils/scrollUtils.ts
diff --git a/web/apps/photos/src/pages/shared-albums.tsx b/web/apps/photos/src/pages/shared-albums.tsx
index 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 (
<FullScreenDropZone
disabled={shouldDisableDropzone}
onDrop={setDragAndDropFiles}
>
- {view === "trip" ? (
- <TripView
+ {layout === "trip" ? (
+ <TripLayout
files={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.ts
index 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.ts
index 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.