diff --git a/src/assets/main.css b/src/assets/main.css index cf9787b..abe5e4c 100644 --- a/src/assets/main.css +++ b/src/assets/main.css @@ -345,6 +345,89 @@ html.platform-macos body { pointer-events: none; } +.ss-immersive-toolbar-segment { + position: relative; + height: 54px; + min-width: 0; + border: 1px solid color-mix(in srgb, var(--ss-border-color) 80%, transparent); + border-radius: 999px; + background: transparent; + box-shadow: 0 8px 30px rgba(0, 0, 0, 0.16); + padding: 0; + box-sizing: border-box; + isolation: isolate; +} + +.ss-immersive-toolbar-segment::before { + position: absolute; + inset: 0; + z-index: -1; + border-radius: inherit; + background-color: var(--ss-card-bg); + background: color-mix(in srgb, var(--ss-card-bg) 58%, transparent); + backdrop-filter: blur(18px) saturate(1.15); + -webkit-backdrop-filter: blur(18px) saturate(1.15); + content: ""; +} + +.ss-immersive-toolbar-segment .ss-immersive-toolbar-search.ant-input-affix-wrapper { + width: 100%; + height: 52px; + border: none !important; + border-radius: 999px; + background: color-mix(in srgb, var(--ss-card-bg) 58%, transparent) !important; + box-shadow: none !important; + backdrop-filter: blur(18px) saturate(1.15); + -webkit-backdrop-filter: blur(18px) saturate(1.15); + display: flex; + align-items: center; + padding: 0 14px; + line-height: 52px; +} + +.ss-immersive-toolbar-segment + .ss-immersive-toolbar-search.ant-input-affix-wrapper-focused, +.ss-immersive-toolbar-segment .ss-immersive-toolbar-search.ant-input-affix-wrapper:focus, +.ss-immersive-toolbar-segment .ss-immersive-toolbar-search.ant-input-affix-wrapper:hover { + border: none !important; + background: color-mix(in srgb, var(--ss-card-bg) 58%, transparent) !important; + box-shadow: none !important; +} + +.ss-immersive-toolbar-segment .ss-immersive-toolbar-search .ant-input { + height: 24px; + background: transparent !important; + line-height: 24px; + padding: 0; +} + +.ss-immersive-toolbar-segment .ss-immersive-toolbar-search .ant-input-prefix, +.ss-immersive-toolbar-segment .ss-immersive-toolbar-search .ant-input-suffix { + line-height: 1; +} + +.ss-immersive-toolbar-menu-segment { + flex: 0 0 54px; + display: flex; + align-items: center; + justify-content: center; +} + +.ss-immersive-toolbar-popover .ant-popover-inner { + border-radius: 12px; +} + +.ss-immersive-toolbar-menu { + width: min(232px, calc(100vw - 32px)); + display: flex; + flex-direction: column; + gap: 8px; +} + +.ss-immersive-toolbar-select-popup { + z-index: 1300; +} + .ss-settings-mobile-nav-list { display: flex; flex-direction: column; diff --git a/src/components/Home.tsx b/src/components/Home.tsx index e752238..da6b245 100644 --- a/src/components/Home.tsx +++ b/src/components/Home.tsx @@ -12,6 +12,7 @@ import { InputNumber, Divider, Dropdown, + Popover, } from "antd" import { SearchOutlined, @@ -19,6 +20,7 @@ import { UndoOutlined, UploadOutlined, CopyOutlined, + MenuOutlined, } from "@ant-design/icons" import { useTranslation } from "react-i18next" import { match, pinyin } from "pinyin-pro" @@ -118,6 +120,7 @@ export const Home: React.FC = ({ const [layoutType, setLayoutType] = useState("grouped") const [searchKeyword, setSearchKeyword] = useState("") const [showPinyinKeyboard, setShowPinyinKeyboard] = useState(false) + const [immersiveMenuOpen, setImmersiveMenuOpen] = useState(false) const [searchKeyboardLayout, setSearchKeyboardLayout] = useState("qwerty26") const [disableSearchKeyboard, setDisableSearchKeyboard] = useState(false) const canShowSearchKeyboard = !isMobile && !disableSearchKeyboard @@ -350,7 +353,7 @@ export const Home: React.FC = ({ }, []) useEffect(() => { - if (!immersiveMode) { + if (!immersiveMode || isPortraitMode) { setImmersiveToolbarWidth(null) return } @@ -377,7 +380,7 @@ export const Home: React.FC = ({ window.removeEventListener("resize", updateToolbarWidth) if (frameId !== null) cancelAnimationFrame(frameId) } - }, [immersiveMode, immersiveToolbarHorizontalPadding]) + }, [immersiveMode, immersiveToolbarHorizontalPadding, isPortraitMode]) useEffect(() => { return () => { @@ -439,6 +442,8 @@ export const Home: React.FC = ({ return immersiveToolbarRef.current ?? triggerNode.parentElement ?? document.body }, []) + const getDocumentBodyPopupContainer = useCallback(() => document.body, []) + const getDisplayText = (name: string) => { if (!name) return "" return name.length > 2 ? name.substring(name.length - 2) : name @@ -2946,6 +2951,123 @@ export const Home: React.FC = ({ ) + const immersiveActionButtonStyle: React.CSSProperties = { + width: "100%", + justifyContent: "center", + borderRadius: "8px", + } + + const immersiveMenuContent = ( +
+ setLayoutType(v as LayoutType)} + getPopupContainer={getDocumentBodyPopupContainer} + popupClassName="ss-immersive-toolbar-select-popup" + style={{ width: "100%" }} + options={[ + { value: "grouped", label: t("home.layoutBy.grouped") }, + { value: "squareGrid", label: t("home.layoutBy.squareGrid") }, + { value: "largeAvatar", label: t("home.layoutBy.largeAvatar") }, + ]} + /> + + + {!rewardMode && + (!batchMode ? ( + + ) : ( + + + + + + + ))} +
+ ) + return (
= ({ left: "50%", bottom: isPortraitMode ? "12px" : "16px", zIndex: 1100, - width: immersiveToolbarWidth ? `${immersiveToolbarWidth}px` : "max-content", + width: isPortraitMode + ? "calc(100vw - 20px)" + : immersiveToolbarWidth + ? `${immersiveToolbarWidth}px` + : "max-content", maxWidth: "calc(100vw - 20px)", - borderRadius: "999px", - border: "1px solid color-mix(in srgb, var(--ss-border-color) 80%, transparent)", - backgroundColor: "var(--ss-card-bg)", - background: "color-mix(in srgb, var(--ss-card-bg) 62%, transparent)", - backdropFilter: "blur(16px)", - WebkitBackdropFilter: "blur(16px)", - boxShadow: "0 8px 30px rgba(0, 0, 0, 0.16)", - padding: "10px", + display: isPortraitMode ? "flex" : undefined, + alignItems: isPortraitMode ? "center" : undefined, + justifyContent: isPortraitMode ? "flex-start" : undefined, + gap: isPortraitMode ? "4px" : undefined, + borderRadius: isPortraitMode ? undefined : "999px", + border: isPortraitMode + ? undefined + : "1px solid color-mix(in srgb, var(--ss-border-color) 80%, transparent)", + backgroundColor: isPortraitMode ? undefined : "var(--ss-card-bg)", + background: isPortraitMode + ? undefined + : "color-mix(in srgb, var(--ss-card-bg) 62%, transparent)", + backdropFilter: isPortraitMode ? undefined : "blur(16px)", + WebkitBackdropFilter: isPortraitMode ? undefined : "blur(16px)", + boxShadow: isPortraitMode ? undefined : "0 8px 30px rgba(0, 0, 0, 0.16)", + padding: isPortraitMode ? 0 : "10px", overflow: "visible", }} >
{ searchAreaRef.current = node - immersiveToolbarContentRef.current = node + immersiveToolbarContentRef.current = isPortraitMode ? null : node }} + className={isPortraitMode ? "ss-immersive-toolbar-segment" : undefined} style={{ - display: "inline-flex", + display: isPortraitMode ? "flex" : "inline-flex", alignItems: "center", gap: "8px", overflowX: "visible", - justifyContent: "flex-start", + justifyContent: isPortraitMode ? "center" : "flex-start", + flex: isPortraitMode ? "1 1 auto" : undefined, + minWidth: isPortraitMode ? 0 : undefined, }} > = ({ placeholder={t("home.searchPlaceholder")} prefix={} allowClear + className={isPortraitMode ? "ss-immersive-toolbar-search" : undefined} style={{ - width: isPortraitMode ? "170px" : "220px", + width: isPortraitMode ? "100%" : "220px", borderRadius: "999px", - flexShrink: 0, + flexShrink: isPortraitMode ? 1 : 0, }} /> - setLayoutType(v as LayoutType)} - getPopupContainer={getImmersivePopupContainer} - style={{ width: 126, flexShrink: 0 }} - options={[ - { value: "grouped", label: t("home.layoutBy.grouped") }, - { value: "squareGrid", label: t("home.layoutBy.squareGrid") }, - { value: "largeAvatar", label: t("home.layoutBy.largeAvatar") }, - ]} - /> - - -
{batchToolbar}
+ {!isPortraitMode && ( + <> + setLayoutType(v as LayoutType)} + getPopupContainer={getImmersivePopupContainer} + style={{ width: 126, flexShrink: 0 }} + options={[ + { value: "grouped", label: t("home.layoutBy.grouped") }, + { value: "squareGrid", label: t("home.layoutBy.squareGrid") }, + { value: "largeAvatar", label: t("home.layoutBy.largeAvatar") }, + ]} + /> + + +
{batchToolbar}
+ + )} {canShowSearchKeyboard && showPinyinKeyboard && (
= ({
)}
+ {isPortraitMode && ( + +
+
+
+ )}
{isPortraitMode ? (