Skip to content

armgit / ente

Public Imported from GitHub
0

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

merge(photos):sync-main-and-preserve-search-dialog

Aswin Asok4cc1649dda15
diff --cc web/apps/photos/src/components/gallery/NormalNavbarContents.tsx
index 0000000000,471a070840..7c76430bc2
mode 000000,100644..100644
--- a/web/apps/photos/src/components/gallery/NormalNavbarContents.tsx
+++ b/web/apps/photos/src/components/gallery/NormalNavbarContents.tsx
@@@ -1,0 -1,57 +1,57 @@@
+ import { SearchBar, type SearchBarProps } from "@/components/SearchBar";
+ import { uploadManager } from "@/services/upload-manager";
+ import { Upload01Icon } from "@hugeicons/core-free-icons";
+ import { HugeiconsIcon } from "@hugeicons/react";
+ import MenuIcon from "@mui/icons-material/Menu";
+ import { IconButton } from "@mui/material";
+ import type { ButtonishProps } from "ente-base/components/mui";
+ import { FocusVisibleButton } from "ente-base/components/mui/FocusVisibleButton";
+ import { useIsSmallWidth } from "ente-base/components/utils/hooks";
+ import { t } from "i18next";
+
+ type NormalNavbarContentsProps = SearchBarProps & {
+ onSidebar: () => void;
+ onUpload: () => void;
+ };
+
+ export const NormalNavbarContents: React.FC<NormalNavbarContentsProps> = ({
+ onSidebar,
+ onUpload,
+ ...props
+ }) => (
+ <>
- {!props.isInSearchMode && <SidebarButton onClick={onSidebar} />}
++ <SidebarButton onClick={onSidebar} />
+ <SearchBar {...props} />
- {!props.isInSearchMode && <UploadButton onClick={onUpload} />}
++ <UploadButton onClick={onUpload} />
+ </>
+ );
+
+ const SidebarButton: React.FC<ButtonishProps> = ({ onClick }) => (
+ <IconButton {...{ onClick }}>
+ <MenuIcon />
+ </IconButton>
+ );
+
+ export const UploadButton: React.FC<ButtonishProps> = ({ onClick }) => {
+ const disabled = uploadManager.isUploadInProgress();
+ const isSmallWidth = useIsSmallWidth();
+
+ const icon = <HugeiconsIcon icon={Upload01Icon} size={20} />;
+
+ return (
+ <>
+ {isSmallWidth ? (
+ <IconButton {...{ onClick, disabled }}>{icon}</IconButton>
+ ) : (
+ <FocusVisibleButton
+ color="secondary"
+ startIcon={icon}
+ sx={{ borderRadius: "16px" }}
+ {...{ onClick, disabled }}
+ >
+ {t("upload")}
+ </FocusVisibleButton>
+ )}
+ </>
+ );
+ };