refactor: cleanup search animation
This commit is contained in:
2 files changed
+24
-11
No files matched your search
@@ -1,12 +1,10 @@
|
|||||||
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
||||||
import {
|
import {
|
||||||
alpha,
|
|
||||||
Box,
|
Box,
|
||||||
IconButton,
|
IconButton,
|
||||||
ListItem,
|
ListItem,
|
||||||
ListItemAvatar,
|
ListItemAvatar,
|
||||||
ListItemText,
|
ListItemText,
|
||||||
Typography,
|
|
||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||||
@@ -32,7 +30,6 @@ const QueueListItem = ({
|
|||||||
onPlay,
|
onPlay,
|
||||||
dragHandleProps,
|
dragHandleProps,
|
||||||
isEpisode,
|
isEpisode,
|
||||||
index,
|
|
||||||
className,
|
className,
|
||||||
sx,
|
sx,
|
||||||
}: QueueListItemProps) => {
|
}: QueueListItemProps) => {
|
||||||
@@ -219,16 +216,18 @@ const QueueListItem = ({
|
|||||||
<ListItemText
|
<ListItemText
|
||||||
primary={primaryText}
|
primary={primaryText}
|
||||||
secondary={secondaryText}
|
secondary={secondaryText}
|
||||||
primaryTypographyProps={{
|
slotProps={{
|
||||||
|
primary: {
|
||||||
noWrap: true,
|
noWrap: true,
|
||||||
variant: "body2",
|
variant: "body2",
|
||||||
fontWeight: active ? 700 : 500,
|
fontWeight: active ? 700 : 500,
|
||||||
sx: { mb: 0.5 },
|
sx: { mb: 0.5 },
|
||||||
}}
|
},
|
||||||
secondaryTypographyProps={{
|
secondary: {
|
||||||
noWrap: true,
|
noWrap: true,
|
||||||
variant: "caption",
|
variant: "caption",
|
||||||
sx: { opacity: 0.7 },
|
sx: { opacity: 0.7 },
|
||||||
|
},
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ import { ItemSortBy } from "@jellyfin/sdk/lib/generated-client";
|
|||||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||||
import { getSearchApi } from "@jellyfin/sdk/lib/utils/api/search-api";
|
import { getSearchApi } from "@jellyfin/sdk/lib/utils/api/search-api";
|
||||||
import {
|
import {
|
||||||
alpha,
|
|
||||||
Box,
|
Box,
|
||||||
Button,
|
Button,
|
||||||
Dialog,
|
Dialog,
|
||||||
|
Grow,
|
||||||
IconButton,
|
IconButton,
|
||||||
InputBase,
|
InputBase,
|
||||||
LinearProgress,
|
LinearProgress,
|
||||||
@@ -13,6 +13,7 @@ import {
|
|||||||
Typography,
|
Typography,
|
||||||
useTheme,
|
useTheme,
|
||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
|
import type { TransitionProps } from "@mui/material/transitions";
|
||||||
import { useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
import { useNavigate } from "@tanstack/react-router";
|
import { useNavigate } from "@tanstack/react-router";
|
||||||
import { register } from "@tauri-apps/plugin-global-shortcut";
|
import { register } from "@tauri-apps/plugin-global-shortcut";
|
||||||
@@ -32,6 +33,15 @@ import { useCentralStore } from "@/utils/store/central";
|
|||||||
import useSearchStore from "@/utils/store/search";
|
import useSearchStore from "@/utils/store/search";
|
||||||
import SearchItem from "./item";
|
import SearchItem from "./item";
|
||||||
|
|
||||||
|
const Transition = React.forwardRef(function Transition(
|
||||||
|
props: TransitionProps & {
|
||||||
|
children: React.ReactElement<any, any>;
|
||||||
|
},
|
||||||
|
ref: React.Ref<unknown>,
|
||||||
|
) {
|
||||||
|
return <Grow ref={ref} {...props} />;
|
||||||
|
});
|
||||||
|
|
||||||
const Search = () => {
|
const Search = () => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const { isOpen, handleClose, toggleSearchDialog } = useSearchStore(
|
const { isOpen, handleClose, toggleSearchDialog } = useSearchStore(
|
||||||
@@ -138,13 +148,13 @@ const Search = () => {
|
|||||||
return (
|
return (
|
||||||
<Dialog
|
<Dialog
|
||||||
open={isOpen}
|
open={isOpen}
|
||||||
onClose={handleClose}
|
slotProps={{
|
||||||
fullWidth
|
transition: Transition,
|
||||||
maxWidth="sm"
|
paper: {
|
||||||
PaperProps={{
|
|
||||||
sx: {
|
sx: {
|
||||||
backgroundColor: "rgba(20, 20, 30, 0.7)",
|
backgroundColor: "rgba(20, 20, 30, 0.7)",
|
||||||
backdropFilter: "blur(24px) saturate(180%)",
|
backdropFilter: "blur(24px) saturate(180%)",
|
||||||
|
willChange: "opacity, transform, backdrop-filter",
|
||||||
backgroundImage:
|
backgroundImage:
|
||||||
"linear-gradient(rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0))",
|
"linear-gradient(rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0))",
|
||||||
border: "1px solid rgba(255, 255, 255, 0.08)",
|
border: "1px solid rgba(255, 255, 255, 0.08)",
|
||||||
@@ -152,7 +162,11 @@ const Search = () => {
|
|||||||
borderRadius: 4,
|
borderRadius: 4,
|
||||||
overflow: "hidden",
|
overflow: "hidden",
|
||||||
},
|
},
|
||||||
|
},
|
||||||
}}
|
}}
|
||||||
|
onClose={handleClose}
|
||||||
|
fullWidth
|
||||||
|
maxWidth="sm"
|
||||||
>
|
>
|
||||||
<Box sx={{ position: "relative" }}>
|
<Box sx={{ position: "relative" }}>
|
||||||
<Stack
|
<Stack
|
||||||
|
|||||||
Reference in new issue
Block a user