ommit
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
This commit is contained in:
1 parent
cbb750a413
commit
497b9a2fc5
42 files changed
+945
-354
No files matched your search
@@ -0,0 +1,117 @@
|
||||
/* Titlebar status: a tiny spinner that resolves into check / warning. */
|
||||
.app-status {
|
||||
--status-accent: rgb(255 255 255 / 0.8);
|
||||
|
||||
position: relative;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 2.35rem;
|
||||
height: 2.35rem;
|
||||
flex: 0 0 auto;
|
||||
border-radius: 50%;
|
||||
color: var(--status-accent);
|
||||
opacity: 0;
|
||||
transform: scale(0.92);
|
||||
pointer-events: none;
|
||||
transition:
|
||||
opacity 0.18s ease,
|
||||
transform 0.18s ease,
|
||||
background-color 0.15s ease,
|
||||
color 0.18s ease;
|
||||
}
|
||||
|
||||
.app-status--loading,
|
||||
.app-status--success,
|
||||
.app-status--warning,
|
||||
.app-status--error,
|
||||
.app-status--info {
|
||||
opacity: 1;
|
||||
transform: scale(1);
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
/* Same hover language as the other titlebar icon buttons. */
|
||||
.app-status--loading:hover,
|
||||
.app-status--success:hover,
|
||||
.app-status--warning:hover,
|
||||
.app-status--error:hover,
|
||||
.app-status--info:hover {
|
||||
background: rgb(255 255 255 / 0.1);
|
||||
}
|
||||
|
||||
.app-status--loading {
|
||||
--status-accent: rgb(255 255 255 / 0.8);
|
||||
}
|
||||
|
||||
.app-status--success {
|
||||
--status-accent: #65e6a3;
|
||||
}
|
||||
|
||||
.app-status--warning {
|
||||
--status-accent: #ffc46b;
|
||||
}
|
||||
|
||||
.app-status--error {
|
||||
--status-accent: #ff8a7a;
|
||||
}
|
||||
|
||||
.app-status--info {
|
||||
--status-accent: #8fd0ff;
|
||||
}
|
||||
|
||||
.app-status__icon {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
.material-symbols-rounded {
|
||||
font-size: 1.35rem;
|
||||
}
|
||||
}
|
||||
|
||||
.app-status__spinner {
|
||||
width: 1.05rem;
|
||||
height: 1.05rem;
|
||||
border: 2px solid currentColor;
|
||||
border-right-color: transparent;
|
||||
border-radius: 50%;
|
||||
animation: app-status-spin 0.8s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes app-status-spin {
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
/* On auth screens the titlebar is hidden; keep the same feedback as a plain
|
||||
icon next to the window controls, without a separate badge around it. */
|
||||
.app-status--floating {
|
||||
position: fixed;
|
||||
top: calc(10px + var(--safe-top));
|
||||
right: calc(150px + var(--safe-right, 0px));
|
||||
z-index: 1002;
|
||||
filter: drop-shadow(0 2px 6px rgb(0 0 0 / 0.5));
|
||||
}
|
||||
|
||||
html.is-android .app-status--floating {
|
||||
right: 12px;
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
.app-status {
|
||||
width: 2.15rem;
|
||||
height: 2.15rem;
|
||||
}
|
||||
|
||||
.app-status--floating {
|
||||
top: calc(8px + var(--safe-top));
|
||||
right: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
/* Notifications are rendered as the titlebar status instead of toasts. */
|
||||
.notistack-SnackbarContainer {
|
||||
display: none !important;
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
import { Tooltip } from "@mui/material";
|
||||
import { useLocation } from "@tanstack/react-router";
|
||||
import { AnimatePresence, motion } from "motion/react";
|
||||
import React from "react";
|
||||
import { shouldShowTitlebar } from "@/components/appTitlebar/routeVisibility";
|
||||
import {
|
||||
type AppStatusPhase,
|
||||
useAppStatusStore,
|
||||
} from "@/utils/store/appStatus";
|
||||
|
||||
import "./appStatus.scss";
|
||||
|
||||
const ICONS: Record<Exclude<AppStatusPhase, "idle" | "loading">, string> = {
|
||||
success: "check",
|
||||
warning: "warning",
|
||||
error: "warning",
|
||||
info: "info",
|
||||
};
|
||||
|
||||
export const AppStatusIndicator = ({
|
||||
floating = false,
|
||||
}: {
|
||||
floating?: boolean;
|
||||
}) => {
|
||||
const phase = useAppStatusStore((state) => state.phase);
|
||||
const message = useAppStatusStore((state) => state.message);
|
||||
|
||||
if (phase === "idle") {
|
||||
return floating ? null : (
|
||||
<span className="app-status app-status--idle" aria-hidden="true" />
|
||||
);
|
||||
}
|
||||
|
||||
const body = (
|
||||
<span
|
||||
className={`app-status app-status--${phase}${
|
||||
floating ? " app-status--floating" : ""
|
||||
}`}
|
||||
role="status"
|
||||
aria-live="polite"
|
||||
aria-label={message}
|
||||
>
|
||||
<AnimatePresence mode="wait" initial={false}>
|
||||
<motion.span
|
||||
key={phase}
|
||||
className="app-status__icon"
|
||||
initial={{ opacity: 0, scale: 0.55, rotate: -18 }}
|
||||
animate={{ opacity: 1, scale: 1, rotate: 0 }}
|
||||
exit={{ opacity: 0, scale: 0.55, rotate: 18 }}
|
||||
transition={{ type: "spring", stiffness: 520, damping: 30 }}
|
||||
>
|
||||
{phase === "loading" ? (
|
||||
<span className="app-status__spinner" />
|
||||
) : (
|
||||
<span className="material-symbols-rounded">{ICONS[phase]}</span>
|
||||
)}
|
||||
</motion.span>
|
||||
</AnimatePresence>
|
||||
</span>
|
||||
);
|
||||
|
||||
return (
|
||||
<Tooltip title={message} placement="bottom" arrow>
|
||||
{body}
|
||||
</Tooltip>
|
||||
);
|
||||
};
|
||||
|
||||
/** Shows the indicator over players/auth screens where the titlebar is hidden. */
|
||||
export const AppStatusOverlay = () => {
|
||||
const { pathname } = useLocation();
|
||||
if (shouldShowTitlebar(pathname)) return null;
|
||||
// The video player renders the indicator inside its own OSD action pill,
|
||||
// next to share / SyncPlay / settings, so no floating copy is needed.
|
||||
if (pathname === "/player") return null;
|
||||
return <AppStatusIndicator floating />;
|
||||
};
|
||||
Reference in new issue
Block a user