(
+
+ `${props.className} ${
+ isActive ? props.activeClassName : ""
+ }`
+ }
+ >
+ {props.children}
+
+ ),
+});
+
export const AppBar = () => {
const [api] = useApi((state) => [state.api]);
const navigate = useNavigate();
@@ -110,16 +130,15 @@ export const AppBar = () => {
navigate("/login/index");
};
- const [librariesPopover, setLibrariesPopover] = useState(false);
+ const [librariesPopper, setLibrariesPopper] = useState(false);
const librariesText = useRef(null);
- const popoverEnter = (event) => {
- if (anchorEl !== event.currentTarget) {
- setLibrariesPopover(event.currentTarget);
- }
- };
- const popoverLeave = () => {
- setLibrariesPopover(null);
+ const handlePopper = (event) => {
+ if (librariesPopper) {
+ setLibrariesPopper(null);
+ } else {
+ setLibrariesPopper(event.currentTarget);
+ }
};
const [isBrowsingLibrary, setIsBrowsingLibrary] = useState(false);
@@ -190,16 +209,70 @@ export const AppBar = () => {
gap: "2.6em",
}}
>
-
+
+ {({ isActive }) =>
+ isActive ? (
+
+ ) : (
+
+ )
+ }
+
+
-
+ {/* {
: "appBar-text"
}
// onMouseLeave={popoverLeave}
- >
- Libraries
-
+ > */}
-
+ {({ TransitionProps }) => (
+
+
+
+ {libraries.isPending
+ ? "loading..."
+ : libraries.data.Items.map(
+ (
+ library,
+ ) => (
+
+ {Object.keys(
+ library.ImageTags,
+ ).includes(
+ "Primary",
+ ) ? (
+
+ ) : (
+
+ {" "}
+ {getTypeIcon(
+ library.CollectionType,
+ )}{" "}
+
+ {
+ library.Name
+ }
+
+
+ )}
+
+ ),
+ )}
+
+
+
+ )}
+
img {
+ border: 0px solid white;
+ width: inherit;
+ object-fit: cover;
+ height: 100%;
+ border-radius: 10px;
+ transition: border $transition-time-fast;
+ }
+ &-icon {
+ height: 100%;
+ width: inherit;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ flex-direction: column;
+ color: white !important;
+ background: rgb(255 255 255 / 0.1);
+ border: 0px solid white;
+ border-radius: 10px;
+ transition: border $transition-time-fast;
+ .material-symbols-rounded {
+ font-size: 3em;
+ }
+ }
&.active {
- background: $clr-gradient-default;
+ &::after {
+ opacity: 1;
+ }
+ > img {
+ border: 5px solid white;
+ }
+ .material-symbols-rounded {
+ font-variation-settings: "FILL" 1, "wght" 300, "GRAD" 25,
+ "opsz" 40;
+ }
+ .appBar-library-icon {
+ border: 5px solid white;
+ }
+ }
+ &-scrollContainer {
+ display: flex;
+ max-width: 35vw;
+ overflow: auto;
+ gap: 1em;
+ height: inherit;
+ padding: 15px;
+
+ // Magic scrollbar
+ &::-webkit-scrollbar {
+ &-thumb {
+ width: 150px;
+ }
+ &-track {
+ margin-left: 25px;
+ margin-right: 25px;
+ background: transparent !important;
+ }
+ }
}
}
}
diff --git a/src/utils/store/api.js b/src/utils/store/api.js
index e0347ac..5e23f8d 100644
--- a/src/utils/store/api.js
+++ b/src/utils/store/api.js
@@ -35,18 +35,13 @@ const jellyfin = new Jellyfin({
* @typedef {import("@jellyfin/sdk").Api} Api
*/
-export const useApi = create((set) => ({
+export const useApi = create(() => ({
/**
* @type {Api}
*/
api: null,
deviceId: localStorage.getItem("deviceId"),
jellyfin: jellyfin,
- createApi: (serverAddress, accessToken) =>
- set((state) => ({
- ...state,
- api: jellyfin.createApi(serverAddress, accessToken, axiosClient),
- })),
}));
/**