π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
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.tsxindex 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><RowButtonstartIcon={@@ -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><TitledNestedSidebarDraweranchor="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}><RowButtonfontWeight="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.tsxsimilarity index 100%rename from web/apps/photos/src/components/TripTemplate/MapEvents.tsxrename to web/apps/photos/src/components/TripView/MapEvents.tsxdiff --git a/web/apps/photos/src/components/TripTemplate/MobileCover.tsx b/web/apps/photos/src/components/TripView/MobileCover.tsxsimilarity index 100%rename from web/apps/photos/src/components/TripTemplate/MobileCover.tsxrename to web/apps/photos/src/components/TripView/MobileCover.tsxdiff --git a/web/apps/photos/src/components/TripTemplate/MobileNavBar.tsx b/web/apps/photos/src/components/TripView/MobileNavBar.tsxsimilarity index 100%rename from web/apps/photos/src/components/TripTemplate/MobileNavBar.tsxrename to web/apps/photos/src/components/TripView/MobileNavBar.tsxdiff --git a/web/apps/photos/src/components/TripTemplate/MobileTimelineLocation.tsx b/web/apps/photos/src/components/TripView/MobileTimelineLocation.tsxsimilarity index 100%rename from web/apps/photos/src/components/TripTemplate/MobileTimelineLocation.tsxrename to web/apps/photos/src/components/TripView/MobileTimelineLocation.tsxdiff --git a/web/apps/photos/src/components/TripTemplate/MobileTripStarted.tsx b/web/apps/photos/src/components/TripView/MobileTripStarted.tsxsimilarity index 100%rename from web/apps/photos/src/components/TripTemplate/MobileTripStarted.tsxrename to web/apps/photos/src/components/TripView/MobileTripStarted.tsxdiff --git a/web/apps/photos/src/components/TripTemplate/PhotoFan.tsx b/web/apps/photos/src/components/TripView/PhotoFan.tsxsimilarity index 100%rename from web/apps/photos/src/components/TripTemplate/PhotoFan.tsxrename to web/apps/photos/src/components/TripView/PhotoFan.tsxdiff --git a/web/apps/photos/src/components/TripTemplate/TimelineBaseLine.tsx b/web/apps/photos/src/components/TripView/TimelineBaseLine.tsxsimilarity index 100%rename from web/apps/photos/src/components/TripTemplate/TimelineBaseLine.tsxrename to web/apps/photos/src/components/TripView/TimelineBaseLine.tsxdiff --git a/web/apps/photos/src/components/TripTemplate/TimelineLocation.tsx b/web/apps/photos/src/components/TripView/TimelineLocation.tsxsimilarity index 100%rename from web/apps/photos/src/components/TripTemplate/TimelineLocation.tsxrename to web/apps/photos/src/components/TripView/TimelineLocation.tsxdiff --git a/web/apps/photos/src/components/TripTemplate/TimelineProgressLine.tsx b/web/apps/photos/src/components/TripView/TimelineProgressLine.tsxsimilarity index 100%rename from web/apps/photos/src/components/TripTemplate/TimelineProgressLine.tsxrename to web/apps/photos/src/components/TripView/TimelineProgressLine.tsxdiff --git a/web/apps/photos/src/components/TripTemplate/TopNavButtons.tsx b/web/apps/photos/src/components/TripView/TopNavButtons.tsxsimilarity index 100%rename from web/apps/photos/src/components/TripTemplate/TopNavButtons.tsxrename to web/apps/photos/src/components/TripView/TopNavButtons.tsxdiff --git a/web/apps/photos/src/components/TripTemplate/TripCover.tsx b/web/apps/photos/src/components/TripView/TripCover.tsxsimilarity index 100%rename from web/apps/photos/src/components/TripTemplate/TripCover.tsxrename to web/apps/photos/src/components/TripView/TripCover.tsxdiff --git a/web/apps/photos/src/components/TripTemplate/TripMap.tsx b/web/apps/photos/src/components/TripView/TripMap.tsxsimilarity index 100%rename from web/apps/photos/src/components/TripTemplate/TripMap.tsxrename to web/apps/photos/src/components/TripView/TripMap.tsxdiff --git a/web/apps/photos/src/components/TripTemplate/TripStartedSection.tsx b/web/apps/photos/src/components/TripView/TripStartedSection.tsxsimilarity index 100%rename from web/apps/photos/src/components/TripTemplate/TripStartedSection.tsxrename to web/apps/photos/src/components/TripView/TripStartedSection.tsxdiff --git a/web/apps/photos/src/components/TripTemplate/hooks/useDataProcessing.ts b/web/apps/photos/src/components/TripView/hooks/useDataProcessing.tssimilarity index 100%rename from web/apps/photos/src/components/TripTemplate/hooks/useDataProcessing.tsrename to web/apps/photos/src/components/TripView/hooks/useDataProcessing.tsdiff --git a/web/apps/photos/src/components/TripTemplate/hooks/useFileViewer.ts b/web/apps/photos/src/components/TripView/hooks/useFileViewer.tssimilarity index 100%rename from web/apps/photos/src/components/TripTemplate/hooks/useFileViewer.tsrename to web/apps/photos/src/components/TripView/hooks/useFileViewer.tsdiff --git a/web/apps/photos/src/components/TripTemplate/hooks/useLocationFetching.ts b/web/apps/photos/src/components/TripView/hooks/useLocationFetching.tssimilarity index 100%rename from web/apps/photos/src/components/TripTemplate/hooks/useLocationFetching.tsrename to web/apps/photos/src/components/TripView/hooks/useLocationFetching.tsdiff --git a/web/apps/photos/src/components/TripTemplate/hooks/useScrollHandling.ts b/web/apps/photos/src/components/TripView/hooks/useScrollHandling.tssimilarity index 100%rename from web/apps/photos/src/components/TripTemplate/hooks/useScrollHandling.tsrename to web/apps/photos/src/components/TripView/hooks/useScrollHandling.tsdiff --git a/web/apps/photos/src/components/TripTemplate/hooks/useThumbnailGeneration.ts b/web/apps/photos/src/components/TripView/hooks/useThumbnailGeneration.tssimilarity index 100%rename from web/apps/photos/src/components/TripTemplate/hooks/useThumbnailGeneration.tsrename to web/apps/photos/src/components/TripView/hooks/useThumbnailGeneration.tsdiff --git a/web/apps/photos/src/components/TripTemplate/index.tsx b/web/apps/photos/src/components/TripView/index.tsxsimilarity index 99%rename from web/apps/photos/src/components/TripTemplate/index.tsxrename to web/apps/photos/src/components/TripView/index.tsxindex 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.tssimilarity index 100%rename from web/apps/photos/src/components/TripTemplate/mapHelpers.tsrename to web/apps/photos/src/components/TripView/mapHelpers.tsdiff --git a/web/apps/photos/src/components/TripTemplate/types.ts b/web/apps/photos/src/components/TripView/types.tssimilarity index 100%rename from web/apps/photos/src/components/TripTemplate/types.tsrename to web/apps/photos/src/components/TripView/types.tsdiff --git a/web/apps/photos/src/components/TripTemplate/utils/dataProcessing.ts b/web/apps/photos/src/components/TripView/utils/dataProcessing.tssimilarity index 100%rename from web/apps/photos/src/components/TripTemplate/utils/dataProcessing.tsrename to web/apps/photos/src/components/TripView/utils/dataProcessing.tsdiff --git a/web/apps/photos/src/components/TripTemplate/utils/geocoding.ts b/web/apps/photos/src/components/TripView/utils/geocoding.tssimilarity index 100%rename from web/apps/photos/src/components/TripTemplate/utils/geocoding.tsrename to web/apps/photos/src/components/TripView/utils/geocoding.tsdiff --git a/web/apps/photos/src/components/TripTemplate/utils/scrollUtils.ts b/web/apps/photos/src/components/TripView/utils/scrollUtils.tssimilarity index 100%rename from web/apps/photos/src/components/TripTemplate/utils/scrollUtils.tsrename to web/apps/photos/src/components/TripView/utils/scrollUtils.tsdiff --git a/web/apps/photos/src/pages/shared-albums.tsx b/web/apps/photos/src/pages/shared-albums.tsxindex 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 (<FullScreenDropZonedisabled={shouldDisableDropzone}onDrop={setDragAndDropFiles}>- {template === "trip" ? (- <TripTemplate+ {view === "trip" ? (+ <TripViewfiles={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.jsonindex 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.tsindex 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.tsindex 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.