Skip to content

armgit / ente

Public Imported from GitHub
0

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

refactor: rename template to view throughout codebase

anandbaburajan611d0a99bd36
diff --git a/web/apps/photos/src/components/Collections/CollectionShare.tsx b/web/apps/photos/src/components/Collections/CollectionShare.tsx
index e3711735dc..dd4d1ec88a 100644
--- a/web/apps/photos/src/components/Collections/CollectionShare.tsx
+++ b/web/apps/photos/src/components/Collections/CollectionShare.tsx
@@ -65,7 +65,7 @@ import {
deleteShareURL,
shareCollection,
unshareCollection,
- updateCollectionTemplate,
+ updateCollectionView,
updatePublicURL,
type CreatePublicURLAttributes,
type UpdatePublicURLAttributes,
@@ -1425,14 +1425,6 @@ const ManagePublicShareOptions: React.FC<ManagePublicShareOptionsProps> = ({
{...{ onRootClose, publicURL }}
onUpdate={handlePublicURLUpdate}
/>
- <ManageTemplate
- {...{
- collection,
- onRootClose,
- onRemotePull,
- setBlockingLoad,
- }}
- />
<RowButtonGroup>
<ManageDeviceLimit
{...{ onRootClose, publicURL }}
@@ -1449,6 +1441,14 @@ const ManagePublicShareOptions: React.FC<ManagePublicShareOptionsProps> = ({
onUpdate={handlePublicURLUpdate}
/>
</RowButtonGroup>
+ <ManageView
+ {...{
+ collection,
+ onRootClose,
+ onRemotePull,
+ setBlockingLoad,
+ }}
+ />
<RowButtonGroup>
<RowButton
startIcon={
@@ -1816,39 +1816,39 @@ const SetPublicLinkPassword: React.FC<SetPublicLinkPasswordProps> = ({
);
};
-interface ManageTemplateProps {
+interface ManageViewProps {
onRootClose: () => void;
collection: Collection;
onRemotePull: (opts?: RemotePullOpts) => Promise<void>;
setBlockingLoad: (value: boolean) => void;
}
-const ManageTemplate: React.FC<ManageTemplateProps> = ({
+const ManageView: React.FC<ManageViewProps> = ({
onRootClose,
collection,
onRemotePull,
setBlockingLoad,
}) => {
- const { show: showTemplateOptions, props: templateOptionsVisibilityProps } =
+ const { show: showViewOptions, props: viewOptionsVisibilityProps } =
useModalVisibility();
const [errorMessage, setErrorMessage] = useState("");
- const options = useMemo(() => templateOptions(), []);
+ const options = useMemo(() => viewOptions(), []);
- const currentTemplate =
- collection.pubMagicMetadata?.data?.template || "grouped";
+ const currentView =
+ collection.pubMagicMetadata?.data?.view || "grouped";
- const changeTemplateValue = (value: string) => async () => {
- if (value === currentTemplate) return;
+ const changeViewValue = (value: string) => async () => {
+ if (value === currentView) return;
setBlockingLoad(true);
setErrorMessage("");
try {
- await updateCollectionTemplate(collection, value);
+ await updateCollectionView(collection, value);
await onRemotePull({ silent: true });
- templateOptionsVisibilityProps.onClose();
+ viewOptionsVisibilityProps.onClose();
} catch (e) {
- log.error("Could not update collection template", e);
+ log.error("Could not update collection view", e);
setErrorMessage(t("generic_error"));
} finally {
setBlockingLoad(false);
@@ -1859,17 +1859,17 @@ const ManageTemplate: React.FC<ManageTemplateProps> = ({
<>
<RowButtonGroup>
<RowButton
- label={t("template")}
- caption={t(currentTemplate)}
- onClick={showTemplateOptions}
+ label="View"
+ caption={t(currentView)}
+ onClick={showViewOptions}
endIcon={<ChevronRightIcon />}
/>
</RowButtonGroup>
<TitledNestedSidebarDrawer
anchor="right"
- {...templateOptionsVisibilityProps}
+ {...viewOptionsVisibilityProps}
onRootClose={onRootClose}
- title={t("template")}
+ title="View"
>
<Stack sx={{ gap: "32px", py: "20px", px: "8px" }}>
<RowButtonGroup>
@@ -1877,10 +1877,10 @@ const ManageTemplate: React.FC<ManageTemplateProps> = ({
<React.Fragment key={value}>
<RowButton
fontWeight="regular"
- onClick={changeTemplateValue(value)}
+ onClick={changeViewValue(value)}
label={label}
endIcon={
- currentTemplate === value && (
+ currentView === value && (
<DoneIcon />
)
}
@@ -1905,7 +1905,7 @@ const ManageTemplate: React.FC<ManageTemplateProps> = ({
);
};
-const templateOptions = () => [
+const viewOptions = () => [
{ label: t("grouped"), value: "grouped" },
{ label: t("continuous"), value: "continuous" },
{ label: t("trip"), value: "trip" },
diff --git a/web/apps/photos/src/components/TripTemplate/MapEvents.tsx b/web/apps/photos/src/components/TripView/MapEvents.tsx
similarity index 100%
rename from web/apps/photos/src/components/TripTemplate/MapEvents.tsx
rename to web/apps/photos/src/components/TripView/MapEvents.tsx
diff --git a/web/apps/photos/src/components/TripTemplate/MobileCover.tsx b/web/apps/photos/src/components/TripView/MobileCover.tsx
similarity index 100%
rename from web/apps/photos/src/components/TripTemplate/MobileCover.tsx
rename to web/apps/photos/src/components/TripView/MobileCover.tsx
diff --git a/web/apps/photos/src/components/TripTemplate/MobileNavBar.tsx b/web/apps/photos/src/components/TripView/MobileNavBar.tsx
similarity index 100%
rename from web/apps/photos/src/components/TripTemplate/MobileNavBar.tsx
rename to web/apps/photos/src/components/TripView/MobileNavBar.tsx
diff --git a/web/apps/photos/src/components/TripTemplate/MobileTimelineLocation.tsx b/web/apps/photos/src/components/TripView/MobileTimelineLocation.tsx
similarity index 100%
rename from web/apps/photos/src/components/TripTemplate/MobileTimelineLocation.tsx
rename to web/apps/photos/src/components/TripView/MobileTimelineLocation.tsx
diff --git a/web/apps/photos/src/components/TripTemplate/MobileTripStarted.tsx b/web/apps/photos/src/components/TripView/MobileTripStarted.tsx
similarity index 100%
rename from web/apps/photos/src/components/TripTemplate/MobileTripStarted.tsx
rename to web/apps/photos/src/components/TripView/MobileTripStarted.tsx
diff --git a/web/apps/photos/src/components/TripTemplate/PhotoFan.tsx b/web/apps/photos/src/components/TripView/PhotoFan.tsx
similarity index 100%
rename from web/apps/photos/src/components/TripTemplate/PhotoFan.tsx
rename to web/apps/photos/src/components/TripView/PhotoFan.tsx
diff --git a/web/apps/photos/src/components/TripTemplate/TimelineBaseLine.tsx b/web/apps/photos/src/components/TripView/TimelineBaseLine.tsx
similarity index 100%
rename from web/apps/photos/src/components/TripTemplate/TimelineBaseLine.tsx
rename to web/apps/photos/src/components/TripView/TimelineBaseLine.tsx
diff --git a/web/apps/photos/src/components/TripTemplate/TimelineLocation.tsx b/web/apps/photos/src/components/TripView/TimelineLocation.tsx
similarity index 100%
rename from web/apps/photos/src/components/TripTemplate/TimelineLocation.tsx
rename to web/apps/photos/src/components/TripView/TimelineLocation.tsx
diff --git a/web/apps/photos/src/components/TripTemplate/TimelineProgressLine.tsx b/web/apps/photos/src/components/TripView/TimelineProgressLine.tsx
similarity index 100%
rename from web/apps/photos/src/components/TripTemplate/TimelineProgressLine.tsx
rename to web/apps/photos/src/components/TripView/TimelineProgressLine.tsx
diff --git a/web/apps/photos/src/components/TripTemplate/TopNavButtons.tsx b/web/apps/photos/src/components/TripView/TopNavButtons.tsx
similarity index 100%
rename from web/apps/photos/src/components/TripTemplate/TopNavButtons.tsx
rename to web/apps/photos/src/components/TripView/TopNavButtons.tsx
diff --git a/web/apps/photos/src/components/TripTemplate/TripCover.tsx b/web/apps/photos/src/components/TripView/TripCover.tsx
similarity index 100%
rename from web/apps/photos/src/components/TripTemplate/TripCover.tsx
rename to web/apps/photos/src/components/TripView/TripCover.tsx
diff --git a/web/apps/photos/src/components/TripTemplate/TripMap.tsx b/web/apps/photos/src/components/TripView/TripMap.tsx
similarity index 100%
rename from web/apps/photos/src/components/TripTemplate/TripMap.tsx
rename to web/apps/photos/src/components/TripView/TripMap.tsx
diff --git a/web/apps/photos/src/components/TripTemplate/TripStartedSection.tsx b/web/apps/photos/src/components/TripView/TripStartedSection.tsx
similarity index 100%
rename from web/apps/photos/src/components/TripTemplate/TripStartedSection.tsx
rename to web/apps/photos/src/components/TripView/TripStartedSection.tsx
diff --git a/web/apps/photos/src/components/TripTemplate/hooks/useDataProcessing.ts b/web/apps/photos/src/components/TripView/hooks/useDataProcessing.ts
similarity index 100%
rename from web/apps/photos/src/components/TripTemplate/hooks/useDataProcessing.ts
rename to web/apps/photos/src/components/TripView/hooks/useDataProcessing.ts
diff --git a/web/apps/photos/src/components/TripTemplate/hooks/useFileViewer.ts b/web/apps/photos/src/components/TripView/hooks/useFileViewer.ts
similarity index 100%
rename from web/apps/photos/src/components/TripTemplate/hooks/useFileViewer.ts
rename to web/apps/photos/src/components/TripView/hooks/useFileViewer.ts
diff --git a/web/apps/photos/src/components/TripTemplate/hooks/useLocationFetching.ts b/web/apps/photos/src/components/TripView/hooks/useLocationFetching.ts
similarity index 100%
rename from web/apps/photos/src/components/TripTemplate/hooks/useLocationFetching.ts
rename to web/apps/photos/src/components/TripView/hooks/useLocationFetching.ts
diff --git a/web/apps/photos/src/components/TripTemplate/hooks/useScrollHandling.ts b/web/apps/photos/src/components/TripView/hooks/useScrollHandling.ts
similarity index 100%
rename from web/apps/photos/src/components/TripTemplate/hooks/useScrollHandling.ts
rename to web/apps/photos/src/components/TripView/hooks/useScrollHandling.ts
diff --git a/web/apps/photos/src/components/TripTemplate/hooks/useThumbnailGeneration.ts b/web/apps/photos/src/components/TripView/hooks/useThumbnailGeneration.ts
similarity index 100%
rename from web/apps/photos/src/components/TripTemplate/hooks/useThumbnailGeneration.ts
rename to web/apps/photos/src/components/TripView/hooks/useThumbnailGeneration.ts
diff --git a/web/apps/photos/src/components/TripTemplate/index.tsx b/web/apps/photos/src/components/TripView/index.tsx
similarity index 99%
rename from web/apps/photos/src/components/TripTemplate/index.tsx
rename to web/apps/photos/src/components/TripView/index.tsx
index 70be24dc52..f0eaf2df52 100644
--- a/web/apps/photos/src/components/TripTemplate/index.tsx
+++ b/web/apps/photos/src/components/TripView/index.tsx
@@ -31,7 +31,7 @@ import { useThumbnailGeneration } from "./hooks/useThumbnailGeneration";
import type { JourneyPoint } from "./types";
import type { PositionInfo } from "./utils/scrollUtils";
-interface TripTemplateProps {
+interface TripViewProps {
files: EnteFile[];
collection?: Collection;
albumTitle?: string;
@@ -43,7 +43,7 @@ interface TripTemplateProps {
onAddPhotos?: () => void; // Callback for add photos button
}
-export const TripTemplate: React.FC<TripTemplateProps> = ({
+export const TripView: React.FC<TripViewProps> = ({
files,
collection,
albumTitle,
@@ -246,7 +246,7 @@ export const TripTemplate: React.FC<TripTemplateProps> = ({
const hasPhotoData = journeyData.length > 0;
return (
- <TripTemplateContainer>
+ <TripViewContainer>
{!openFileViewer &&
(isTouchDevice ? (
<MobileNavBar
@@ -522,12 +522,12 @@ export const TripTemplate: React.FC<TripTemplateProps> = ({
saveGroups={saveGroups}
onRemoveSaveGroup={onRemoveSaveGroup}
/>
- </TripTemplateContainer>
+ </TripViewContainer>
);
};
// Styled components
-const TripTemplateContainer = styled(Box)({
+const TripViewContainer = styled(Box)({
position: "relative",
width: "100%",
height: "100%",
diff --git a/web/apps/photos/src/components/TripTemplate/mapHelpers.ts b/web/apps/photos/src/components/TripView/mapHelpers.ts
similarity index 100%
rename from web/apps/photos/src/components/TripTemplate/mapHelpers.ts
rename to web/apps/photos/src/components/TripView/mapHelpers.ts
diff --git a/web/apps/photos/src/components/TripTemplate/types.ts b/web/apps/photos/src/components/TripView/types.ts
similarity index 100%
rename from web/apps/photos/src/components/TripTemplate/types.ts
rename to web/apps/photos/src/components/TripView/types.ts
diff --git a/web/apps/photos/src/components/TripTemplate/utils/dataProcessing.ts b/web/apps/photos/src/components/TripView/utils/dataProcessing.ts
similarity index 100%
rename from web/apps/photos/src/components/TripTemplate/utils/dataProcessing.ts
rename to web/apps/photos/src/components/TripView/utils/dataProcessing.ts
diff --git a/web/apps/photos/src/components/TripTemplate/utils/geocoding.ts b/web/apps/photos/src/components/TripView/utils/geocoding.ts
similarity index 100%
rename from web/apps/photos/src/components/TripTemplate/utils/geocoding.ts
rename to web/apps/photos/src/components/TripView/utils/geocoding.ts
diff --git a/web/apps/photos/src/components/TripTemplate/utils/scrollUtils.ts b/web/apps/photos/src/components/TripView/utils/scrollUtils.ts
similarity index 100%
rename from web/apps/photos/src/components/TripTemplate/utils/scrollUtils.ts
rename to web/apps/photos/src/components/TripView/utils/scrollUtils.ts
diff --git a/web/apps/photos/src/pages/shared-albums.tsx b/web/apps/photos/src/pages/shared-albums.tsx
index 4a3b509836..dc81037bf2 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 { TripTemplate } from "components/TripTemplate";
+import { TripView } from "components/TripView";
import { Upload } from "components/Upload";
import {
AccountsPageContents,
@@ -463,15 +463,15 @@ export default function PublicCollectionGallery() {
);
}
- const template = publicCollection?.pubMagicMetadata?.data.template || "grouped";
+ const view = publicCollection?.pubMagicMetadata?.data.view || "grouped";
return (
<FullScreenDropZone
disabled={shouldDisableDropzone}
onDrop={setDragAndDropFiles}
>
- {template === "trip" ? (
- <TripTemplate
+ {view === "trip" ? (
+ <TripView
files={publicFiles}
collection={publicCollection}
onAddPhotos={onAddPhotos}
@@ -514,7 +514,7 @@ export default function PublicCollectionGallery() {
selected={selected}
setSelected={setSelected}
activeCollectionID={PseudoCollectionID.all}
- disableGrouping={template === "continuous"}
+ disableGrouping={view === "continuous"}
onRemotePull={publicAlbumsRemotePull}
onVisualFeedback={handleVisualFeedback}
onAddSaveGroup={onAddSaveGroup}
diff --git a/web/packages/base/locales/en-US/translation.json b/web/packages/base/locales/en-US/translation.json
index 74d6bb458d..b914f12c75 100644
--- a/web/packages/base/locales/en-US/translation.json
+++ b/web/packages/base/locales/en-US/translation.json
@@ -698,7 +698,6 @@
"custom_domains_help": "For more information, see <a>help</a>",
"num_1": "1",
"num_2": "2",
- "template": "Template",
"grouped": "Grouped",
"continuous": "Continuous",
"trip": "Trip"
diff --git a/web/packages/media/collection.ts b/web/packages/media/collection.ts
index c8b348df46..fa3d36c2dc 100644
--- a/web/packages/media/collection.ts
+++ b/web/packages/media/collection.ts
@@ -676,13 +676,13 @@ export interface CollectionPublicMagicMetadataData {
*/
coverID?: number;
/**
- * The template type for the public collection view.
+ * The view type for the public collection display.
*
* Expected to be one of: "grouped", "continuous", "trip".
*
* When undefined, the UI defaults to "grouped" behavior.
*/
- template?: string;
+ view?: 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),
- template: z.string().nullish().transform(nullToUndefined),
+ view: z.string().nullish().transform(nullToUndefined),
});
/**
diff --git a/web/packages/new/photos/services/collection.ts b/web/packages/new/photos/services/collection.ts
index 554347864f..e09c7b746e 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 template type of a collection on remote.
+ * Change the view 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 template we want to change.
+ * @param collection The collection whose view we want to change.
*
- * @param template The template type ("grouped", "continuous", "trip").
+ * @param view The view type ("grouped", "continuous", "trip").
*/
-export const updateCollectionTemplate = async (
+export const updateCollectionView = async (
collection: Collection,
- template: string,
-) => updateCollectionPublicMagicMetadata(collection, { template });
+ view: string,
+) => updateCollectionPublicMagicMetadata(collection, { view });
/**
* Update the private magic metadata of a collection on remote.