style: update hero-carousel styling

This commit is contained in:
Prayag Prajapati committed 2024-06-08 17:52:05 +05:30
1 parent badc2b622f
commit 326b093210
27 files changed
+750 -382

No files matched your search

+8 -28
View File
@@ -1,5 +1,6 @@
import { type Api, Jellyfin } from "@jellyfin/sdk";
import React, { createContext, useContext, useRef, useState } from "react";
import React, { type ReactNode } from "react";
import { createContext, useContext, useState } from "react";
import { type StoreApi, createStore, useStore } from "zustand";
import { version as appVer } from "../../../package.json";
@@ -11,10 +12,7 @@ type ApiStore = {
api: Api;
deviceId: string | null;
jellyfin: Jellyfin;
createApi: (
serverAddress: string | undefined,
accessToken?: string | undefined,
) => void;
createApi: (serverAddress: string, accessToken?: string | undefined) => void;
};
export const axiosClient = axios.create({
@@ -42,22 +40,12 @@ export const jellyfin = new Jellyfin({
},
});
// export const useApi = create<{
// api: Api;
// deviceId: string | null;
// jellyfin: Jellyfin;
// }>(() => ({
// api: undefined,
// deviceId: deviceId,
// jellyfin: jellyfin,
// }));
export const ApiContext = createContext<StoreApi<ApiStore>>(undefined!);
export const ApiContext = createContext(null);
export const ApiProvider = ({ children }) => {
export const ApiProvider = ({ children }: { children: ReactNode }) => {
const [store] = useState(() =>
createStore<ApiStore>()((set) => ({
api: undefined,
api: undefined!,
deviceId: deviceId,
jellyfin: jellyfin,
createApi: (serverAddress, accessToken?) =>
@@ -74,7 +62,7 @@ export const ApiProvider = ({ children }) => {
};
}),
})),
)
);
return <ApiContext.Provider value={store}>{children}</ApiContext.Provider>;
};
@@ -84,12 +72,4 @@ export function useApiInContext<T>(selector?: (state: ApiStore) => T) {
throw new Error("Missing StoreProvider");
}
return useStore(store, selector!);
}
export const createApi = (
serverAddress: string | undefined,
accessToken: string | undefined,
) => {
const createApiFn = useApiInContext((s) => s.createApi);
createApiFn(serverAddress, accessToken);
};
}