/** * Component: Hardcover Shelf Form * Documentation: documentation/frontend/components.md */ 'use client'; import React from 'react'; import { Input } from './Input'; // --------------------------------------------------------------------------- // Status option definitions // --------------------------------------------------------------------------- const STATUS_OPTIONS = [ { id: '1', label: 'Want to Read', description: 'Books saved to read later', icon: ( ), }, { id: '2', label: 'Currently Reading', description: 'Books actively being read', icon: ( ), }, { id: '3', label: 'Read', description: 'Books already finished', icon: ( ), }, { id: '4', label: 'Did Not Finish', description: 'Books started but set aside', icon: ( ), }, ] as const; // --------------------------------------------------------------------------- // Types // --------------------------------------------------------------------------- export interface HardcoverFormProps { apiToken: string; setApiToken: (v: string) => void; listType: 'status' | 'custom'; setListType: (v: 'status' | 'custom') => void; statusId: string; setStatusId: (v: string) => void; customListId: string; setCustomListId: (v: string) => void; validationError: string; setValidationError: (v: string) => void; isLoading: boolean; success: boolean; } // --------------------------------------------------------------------------- // Component // --------------------------------------------------------------------------- export function HardcoverForm({ apiToken, setApiToken, listType, setListType, statusId, setStatusId, customListId, setCustomListId, validationError, setValidationError, isLoading, success, }: HardcoverFormProps) { const disabled = isLoading || success; const isTokenError = validationError === 'Hardcover API Token is required'; const isListError = !isTokenError && !!validationError; return (
{validationError}
)}Found under{' '} Settings → API {' '}on hardcover.app. Stored securely and never shared.
Which list should we watch?
Choose a reading status or one of your custom lists.
Status to sync
Paste the list URL from Hardcover, or enter just the slug (e.g.{' '}
my-audiobooks
) or a numeric ID.