/* * Copyright (C) Contributors to the Suwayomi project * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ import { TBaseTracker, TTrackRecord } from '@/lib/data/Trackers.ts'; import { TrackerUntrackedCard } from '@/components/tracker/TrackerUntrackedCard.tsx'; import { TrackerSearch } from '@/components/tracker/TrackerSearch.tsx'; import { TManga } from '@/typings.ts'; export enum TrackerMode { UNTRACKED, SEARCH, INFO, } export const TrackerCard = ({ tracker, mangaId, trackRecord, mode, setSearchMode, }: { tracker: TBaseTracker; mangaId: number; trackRecord?: TTrackRecord; mode: TrackerMode; setSearchMode: (id?: number) => void; }) => { if (mode === TrackerMode.UNTRACKED) { return setSearchMode(tracker.id)} />; } if (mode === TrackerMode.SEARCH) { return ( setSearchMode(undefined)} /> ); } return 'tracked'; };