chore: window resize handles, UI cleanup and type fixes
Continuous Integration / build_web (push) Failing after 0s
Continuous Integration / build (macos-latest) (push) Skipped
Continuous Integration / build (ubuntu-22.04) (push) Skipped
Continuous Integration / build (windows-11-arm) (push) Skipped
Continuous Integration / build (windows-latest) (push) Skipped
Continuous Integration / nightly_release (push) Skipped
Continuous Integration / build_web (push) Failing after 0s
Continuous Integration / build (macos-latest) (push) Skipped
Continuous Integration / build (ubuntu-22.04) (push) Skipped
Continuous Integration / build (windows-11-arm) (push) Skipped
Continuous Integration / build (windows-latest) (push) Skipped
Continuous Integration / nightly_release (push) Skipped
Adds edge resize handles for frameless Windows/Linux windows, reserves space for the custom titlebar, and fixes assorted unused imports, error-boundary typing and image decoding hints.
This commit is contained in:
1 parent
6675a55957
commit
ae5a2133fa
22 files changed
+161
-35
No files matched your search
@@ -18,6 +18,7 @@
|
||||
"notification:default",
|
||||
"core:webview:allow-internal-toggle-devtools",
|
||||
"core:window:allow-start-dragging",
|
||||
"core:window:allow-start-resize-dragging",
|
||||
"core:window:allow-minimize",
|
||||
"core:window:allow-maximize",
|
||||
"core:window:allow-unmaximize",
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"desktop-capability":{"identifier":"desktop-capability","description":"","local":true,"windows":["main"],"permissions":["window-state:default","global-shortcut:default","global-shortcut:allow-is-registered","global-shortcut:allow-register","global-shortcut:allow-unregister","shell:default"],"platforms":["macOS","windows","linux"]},"main-capabilities":{"identifier":"main-capabilities","description":"Capability for desktop window","local":true,"windows":["main"],"permissions":["store:allow-get","store:allow-set","store:allow-save","store:allow-clear","store:allow-delete","store:allow-keys","store:allow-load","updater:allow-check","updater:allow-download-and-install","updater:allow-download","updater:allow-install","notification:default","core:webview:allow-internal-toggle-devtools","core:window:allow-start-dragging","core:window:allow-minimize","core:window:allow-maximize","core:window:allow-unmaximize","core:window:allow-toggle-maximize","core:window:allow-close","core:window:allow-is-maximized","dialog:default","upload:allow-download","clipboard-manager:allow-write-text","shell:default","shell:allow-open"]},"migrated":{"identifier":"migrated","description":"permissions that were migrated from v1","local":true,"windows":["main"],"permissions":["core:path:default","core:event:default","core:window:default","core:app:default","core:resources:default","core:menu:default","core:tray:default","core:window:allow-set-fullscreen","shell:default"]}}
|
||||
{"desktop-capability":{"identifier":"desktop-capability","description":"","local":true,"windows":["main"],"permissions":["window-state:default","global-shortcut:default","global-shortcut:allow-is-registered","global-shortcut:allow-register","global-shortcut:allow-unregister","shell:default"],"platforms":["macOS","windows","linux"]},"main-capabilities":{"identifier":"main-capabilities","description":"Capability for desktop window","local":true,"windows":["main"],"permissions":["store:allow-get","store:allow-set","store:allow-save","store:allow-clear","store:allow-delete","store:allow-keys","store:allow-load","updater:allow-check","updater:allow-download-and-install","updater:allow-download","updater:allow-install","notification:default","core:webview:allow-internal-toggle-devtools","core:window:allow-start-dragging","core:window:allow-start-resize-dragging","core:window:allow-minimize","core:window:allow-maximize","core:window:allow-unmaximize","core:window:allow-toggle-maximize","core:window:allow-close","core:window:allow-is-maximized","dialog:default","upload:allow-download","clipboard-manager:allow-write-text","shell:default","shell:allow-open"]},"migrated":{"identifier":"migrated","description":"permissions that were migrated from v1","local":true,"windows":["main"],"permissions":["core:path:default","core:event:default","core:window:default","core:app:default","core:resources:default","core:menu:default","core:tray:default","core:window:allow-set-fullscreen","shell:default"]}}
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
type ImageType,
|
||||
} from "@jellyfin/sdk/lib/generated-client";
|
||||
import { useNavigate } from "@tanstack/react-router";
|
||||
import React, { memo, type Ref, useCallback, useState } from "react";
|
||||
import React, { memo, type Ref, useCallback } from "react";
|
||||
import { ErrorBoundary } from "react-error-boundary";
|
||||
import { useInView } from "react-intersection-observer";
|
||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||
@@ -110,6 +110,7 @@ const CardContent = ({
|
||||
{image && (
|
||||
<img
|
||||
alt={item.Name ?? "blink"}
|
||||
decoding="async"
|
||||
src={
|
||||
api && image
|
||||
? overrideIcon === "User"
|
||||
|
||||
@@ -146,7 +146,12 @@ const Carousel = ({
|
||||
aria-label={item.Name ?? "Featured item"}
|
||||
>
|
||||
{imageUrl ? (
|
||||
<img src={imageUrl} alt="" loading="lazy" />
|
||||
<img
|
||||
src={imageUrl}
|
||||
alt=""
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
/>
|
||||
) : (
|
||||
<div className="cinema-trending-placeholder">
|
||||
<span className="material-symbols-rounded">
|
||||
|
||||
@@ -102,6 +102,7 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
|
||||
className={`hero-carousel-background-image${heroArtwork.isPortrait ? " is-poster" : ""}`}
|
||||
src={heroArtwork.url}
|
||||
loading="eager"
|
||||
decoding="async"
|
||||
/>
|
||||
) : (
|
||||
<div className="hero-carousel-background-icon-container">
|
||||
|
||||
@@ -4,7 +4,7 @@ import {
|
||||
type ListItemProps,
|
||||
ListItemText,
|
||||
} from "@mui/material";
|
||||
import { createLink, Link } from "@tanstack/react-router";
|
||||
import { createLink } from "@tanstack/react-router";
|
||||
import React, { forwardRef, type ReactNode } from "react";
|
||||
|
||||
interface MUIListItemLinkProps extends ListItemProps<"a"> {
|
||||
|
||||
@@ -3,7 +3,6 @@ import { useNProgress } from "@tanem/react-nprogress";
|
||||
import { useIsFetching, useIsMutating } from "@tanstack/react-query";
|
||||
import { useRouterState } from "@tanstack/react-router";
|
||||
import React, { useMemo } from "react";
|
||||
import { createPortal } from "react-dom";
|
||||
|
||||
export default function NProgress() {
|
||||
const isQueryFetching = useIsFetching();
|
||||
|
||||
@@ -195,9 +195,6 @@ const BubbleSlider = () => {
|
||||
};
|
||||
const imgUrlParams = new URLSearchParams(imgUrlParamsObject).toString();
|
||||
|
||||
const _imageAspectRatio =
|
||||
trickplayResolution.Width / trickplayResolution.Height;
|
||||
|
||||
trickplayStyle = {
|
||||
backgroundImage: `url(${api?.basePath}/Videos/${itemId}/Trickplay/${trickplayResolution.Width}/${index}.jpg?${imgUrlParams})`,
|
||||
backgroundPositionX: `${backgroundOffsetX}px`,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Box, Button } from "@mui/material";
|
||||
import { Button } from "@mui/material";
|
||||
import { AnimatePresence, motion } from "motion/react";
|
||||
import React from "react";
|
||||
import { useShallow } from "zustand/shallow";
|
||||
|
||||
@@ -13,7 +13,7 @@ const LibraryItemsSkeleton = () => {
|
||||
justifyContent: "center",
|
||||
}}
|
||||
>
|
||||
{Array.from(new Array(18)).map((item, index) => (
|
||||
{Array.from(new Array(18)).map((_, index) => (
|
||||
<Skeleton
|
||||
key={index}
|
||||
variant="rounded"
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { LoadingButton } from "@mui/lab";
|
||||
import {
|
||||
Box,
|
||||
Button,
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
import { getCurrentWindow } from "@tauri-apps/api/window";
|
||||
import React from "react";
|
||||
|
||||
const isMac = navigator.userAgent.includes("Macintosh");
|
||||
|
||||
type Direction =
|
||||
| "North"
|
||||
| "South"
|
||||
| "East"
|
||||
| "West"
|
||||
| "NorthEast"
|
||||
| "NorthWest"
|
||||
| "SouthEast"
|
||||
| "SouthWest";
|
||||
|
||||
const handles: Array<{ className: string; direction: Direction }> = [
|
||||
{ className: "n", direction: "North" },
|
||||
{ className: "s", direction: "South" },
|
||||
{ className: "e", direction: "East" },
|
||||
{ className: "w", direction: "West" },
|
||||
{ className: "ne", direction: "NorthEast" },
|
||||
{ className: "nw", direction: "NorthWest" },
|
||||
{ className: "se", direction: "SouthEast" },
|
||||
{ className: "sw", direction: "SouthWest" },
|
||||
];
|
||||
|
||||
/**
|
||||
* Edge/corner resize handles for the frameless Windows/Linux window. Native
|
||||
* decorations are removed there, so the OS no longer gives us resize borders.
|
||||
*/
|
||||
const WindowResizeHandles = () => {
|
||||
if (isMac) return null;
|
||||
|
||||
return (
|
||||
<div className="window-resize-handles" aria-hidden="true">
|
||||
{handles.map(({ className, direction }) => (
|
||||
<div
|
||||
key={direction}
|
||||
className={`window-resize-handle ${className}`}
|
||||
onPointerDown={(event) => {
|
||||
if (event.button !== 0) return;
|
||||
event.preventDefault();
|
||||
getCurrentWindow()
|
||||
.startResizeDragging(direction)
|
||||
.catch((error) =>
|
||||
console.warn("Could not resize window", error),
|
||||
);
|
||||
}}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default WindowResizeHandles;
|
||||
@@ -47,6 +47,82 @@ html.is-linux body.has-window-chrome #root {
|
||||
padding-top: 44px;
|
||||
}
|
||||
|
||||
.window-resize-handles {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 10002;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.window-resize-handle {
|
||||
position: absolute;
|
||||
pointer-events: auto;
|
||||
|
||||
&.n,
|
||||
&.s {
|
||||
left: 8px;
|
||||
right: 8px;
|
||||
height: 6px;
|
||||
cursor: ns-resize;
|
||||
}
|
||||
|
||||
&.n {
|
||||
top: 0;
|
||||
}
|
||||
|
||||
&.s {
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
&.e,
|
||||
&.w {
|
||||
top: 8px;
|
||||
bottom: 8px;
|
||||
width: 6px;
|
||||
cursor: ew-resize;
|
||||
}
|
||||
|
||||
&.e {
|
||||
right: 0;
|
||||
}
|
||||
|
||||
&.w {
|
||||
left: 0;
|
||||
}
|
||||
|
||||
&.ne,
|
||||
&.nw,
|
||||
&.se,
|
||||
&.sw {
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
}
|
||||
|
||||
&.ne {
|
||||
top: 0;
|
||||
right: 0;
|
||||
cursor: nesw-resize;
|
||||
}
|
||||
|
||||
&.nw {
|
||||
top: 0;
|
||||
left: 0;
|
||||
cursor: nwse-resize;
|
||||
}
|
||||
|
||||
&.se {
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
cursor: nwse-resize;
|
||||
}
|
||||
|
||||
&.sw {
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
cursor: nesw-resize;
|
||||
}
|
||||
}
|
||||
|
||||
.window-chrome {
|
||||
position: fixed;
|
||||
inset: 0 0 auto;
|
||||
|
||||
@@ -31,6 +31,7 @@ import RouterLoading from "@/components/routerLoading";
|
||||
import Search from "@/components/search";
|
||||
import Updater from "@/components/updater";
|
||||
import WindowChrome from "@/components/windowControls/windowChrome";
|
||||
import WindowResizeHandles from "@/components/windowControls/resizeHandles";
|
||||
|
||||
type ApiContext = {
|
||||
api: Api | undefined;
|
||||
@@ -58,6 +59,7 @@ export const Route = createRootRouteWithContext<ApiContext>()({
|
||||
<RemoteControlDialog />
|
||||
<AppBar />
|
||||
<WindowChrome />
|
||||
<WindowResizeHandles />
|
||||
<AudioPlayer />
|
||||
<PlaybackSync />
|
||||
<OverlayScrollbar />
|
||||
|
||||
@@ -64,18 +64,15 @@ function Library() {
|
||||
const currentLib = useSuspenseQuery(
|
||||
getLibraryQueryOptions(api, user?.Id, id),
|
||||
);
|
||||
const _initLibrary = useLibraryStateStore((s) => s.initLibrary);
|
||||
const updateLibrary = useLibraryStateStore((s) => s.updateLibrary);
|
||||
const { currentViewType: storeViewType, libraryName: storeLibraryName } =
|
||||
useLibraryStateStore(
|
||||
useShallow((s) => {
|
||||
const sl = s.libraries[id || ""];
|
||||
return {
|
||||
currentViewType: sl?.currentViewType,
|
||||
libraryName: sl?.libraryName,
|
||||
} as const;
|
||||
}),
|
||||
);
|
||||
const { libraryName: storeLibraryName } = useLibraryStateStore(
|
||||
useShallow((s) => {
|
||||
const sl = s.libraries[id || ""];
|
||||
return {
|
||||
libraryName: sl?.libraryName,
|
||||
} as const;
|
||||
}),
|
||||
);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (!id || !currentLib.data) return;
|
||||
|
||||
@@ -381,8 +381,6 @@ function SearchResultsList({ categories, query, api, user }: any) {
|
||||
|
||||
// Let's use a timeout or assume if no results update to true after X time.
|
||||
|
||||
const _hasAnyResults = Object.values(resultsStatus).some((v) => v);
|
||||
|
||||
return (
|
||||
<Box sx={{ display: "flex", flexDirection: "column", gap: "1em", pb: 4 }}>
|
||||
{categories.map((cat: any) => (
|
||||
|
||||
@@ -3,7 +3,7 @@ import React, { useCallback, useEffect } from "react";
|
||||
import { useBackdropStore } from "@/utils/store/backdrop";
|
||||
|
||||
import "./settings.scss";
|
||||
import { Divider, IconButton, List, Typography } from "@mui/material";
|
||||
import { IconButton, List, Typography } from "@mui/material";
|
||||
import { useShallow } from "zustand/shallow";
|
||||
import BackButton from "@/components/buttons/backButton";
|
||||
import ListItemLink from "@/components/listItemLink";
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
import {
|
||||
alpha,
|
||||
Button,
|
||||
Card,
|
||||
CardActions,
|
||||
CardContent,
|
||||
Chip,
|
||||
Grid,
|
||||
IconButton,
|
||||
Typography,
|
||||
useTheme,
|
||||
} from "@mui/material";
|
||||
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { createFileRoute } from "@tanstack/react-router";
|
||||
@@ -30,7 +27,6 @@ export const Route = createFileRoute("/_api/settings/changeServer/")({
|
||||
});
|
||||
|
||||
function ChangeServerRoute() {
|
||||
const _theme = useTheme();
|
||||
const queryClient = useQueryClient();
|
||||
const createApi = useApiInContext((s) => s.createApi);
|
||||
const { enqueueSnackbar } = useSnackbar();
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import LoadingButton from "@mui/lab/LoadingButton";
|
||||
import { yellow } from "@mui/material/colors";
|
||||
import Grid from "@mui/material/Grid";
|
||||
import TextField from "@mui/material/TextField";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import { useMutation } from "@tanstack/react-query";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { BaseItemDtoQueryResult } from "@jellyfin/sdk/lib/generated-client";
|
||||
import type { UseQueryResult, useQuery } from "@tanstack/react-query";
|
||||
import type { UseQueryResult } from "@tanstack/react-query";
|
||||
import type React from "react";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
|
||||
@@ -54,13 +54,14 @@ const CentralContext = createContext<StoreApi<CentralStore>>(null!);
|
||||
export const CentralProvider = ({ children }: { children: ReactNode }) => {
|
||||
const [store] = useState(() =>
|
||||
createStore<CentralStore>()((set) => ({
|
||||
defaultServerOnDisk: async () => await getDefaultServer(),
|
||||
defaultServerOnDisk: async () => (await getDefaultServer()) ?? null,
|
||||
defaultServerInfoOnDisk: async () => {
|
||||
const a = await getDefaultServer();
|
||||
return await getServer(a);
|
||||
if (!a) return undefined;
|
||||
return (await getServer(a)) ?? undefined;
|
||||
},
|
||||
allServersOnDisk: async () => await getAllServers(),
|
||||
userOnDisk: async () => await getUser(),
|
||||
userOnDisk: async () => (await getUser()) ?? null,
|
||||
clientVersion: version,
|
||||
currentUser: null,
|
||||
fetchCurrentUser: async (api) => {
|
||||
|
||||
@@ -3,7 +3,6 @@ import type {
|
||||
MediaSegmentDtoQueryResult,
|
||||
PlaybackInfoResponse,
|
||||
} from "@jellyfin/sdk/lib/generated-client";
|
||||
import type IntroMediaInfo from "./introMediaInfo";
|
||||
|
||||
interface PlayResult {
|
||||
item: BaseItemDtoQueryResult | undefined;
|
||||
|
||||
Reference in new issue
Block a user