refactor: convert more files to typescript

This commit is contained in:
Prayag Prajapati committed 2024-11-25 17:33:30 +05:30
1 parent 81695a583d
commit a7eab72639
19 files changed
+93 -451

No files matched your search

+8 -5
View File
@@ -16,11 +16,11 @@ export default function LikeButton({
userId,
itemName,
}: {
itemId: string;
isFavorite: boolean;
queryKey: string[];
userId: string;
itemName: string;
itemId: string | undefined;
isFavorite: boolean | undefined;
queryKey: string[] | undefined;
userId: string | undefined;
itemName: string | undefined;
}) {
const api = useApiInContext((s) => s.api);
const queryClient = useQueryClient();
@@ -29,6 +29,9 @@ export default function LikeButton({
const handleLiking = async () => {
let result: UserItemDataDto = null!;
if (!api) return;
if (!userId) return;
if (!itemId) return;
if (!itemName) return;
if (isFavorite) {
result = (
await getUserLibraryApi(api).unmarkFavoriteItem({
+10 -5
View File
@@ -16,11 +16,11 @@ export default function MarkPlayedButton({
userId,
itemName,
}: {
itemId: string;
isPlayed: boolean;
queryKey: string[];
userId: string;
itemName: string;
itemId?: string;
isPlayed?: boolean;
queryKey?: string[];
userId?: string;
itemName?: string;
}) {
const api = useApiInContext((s) => s.api);
@@ -30,6 +30,11 @@ export default function MarkPlayedButton({
const handleMarking = async () => {
let result = null;
if (!api) return;
if (!api) return;
if (!userId) return;
if (!itemId) return;
if (!itemName) return;
if (!isPlayed) {
result = await getPlaystateApi(api).markPlayedItem({
userId: userId,
+1 -1
View File
@@ -53,7 +53,7 @@ type PlayButtonProps = {
iconOnly?: boolean;
audio?: boolean;
size?: "small" | "large" | "medium";
playlistItem?: BaseItemDto;
playlistItem?: boolean;
playlistItemId?: string;
trackIndex?: number;
};