diff --git a/src/components/BlueprintsQueue.tsx b/src/components/BlueprintsQueue.tsx index c5955e9..7bb1aff 100644 --- a/src/components/BlueprintsQueue.tsx +++ b/src/components/BlueprintsQueue.tsx @@ -33,8 +33,8 @@ import { Trash2, Plus, RefreshCw, Check, Search } from 'lucide-react'; import { getTypeIconUrl, fetchTypeName, TypeInfo } from '@/lib/api'; const CLICKHOUSE_URL = "https://mclickhouse.site.quack-lab.dev"; -const CLICKHOUSE_USER = "indy_jobs_ro_user"; -const CLICKHOUSE_PASSWORD = "Q9Cd5Z3j72NypTdNwKV7E7H83mv35mRc"; +const CLICKHOUSE_USER = "indy_jobs_rw_user"; +const CLICKHOUSE_PASSWORD = "66e8LU69M3dvzi9YZSkaA6WHGRt6TGGz"; const TYPESENSE_URL = "https://eve-typesense.site.quack-lab.dev"; const TYPESENSE_KEY = "#L46&&8UeJGE675zRR3kqzd6K!k6an7w"; @@ -46,15 +46,13 @@ const CLICKHOUSE_WRITE_PASSWORD = CLICKHOUSE_PASSWORD; export interface BlueprintQueueItem { id: string; type_id: number; - quantity: number | null; - added_by: string; added_at: string; completed: boolean; } async function fetchBlueprintQueue(): Promise { const query = ` - SELECT id, type_id, quantity, added_by, added_at, completed + SELECT id, type_id, added_at, completed FROM default.blueprint_queue WHERE completed = 0 ORDER BY added_at ASC @@ -80,11 +78,10 @@ async function fetchBlueprintQueue(): Promise { })); } -async function addToQueue(typeId: number, quantity: number | null, addedBy: string): Promise { - const quantityValue = quantity !== null ? quantity : 'NULL'; +async function addToQueue(typeId: number): Promise { const query = ` - INSERT INTO default.blueprint_queue (type_id, quantity, added_by) - VALUES (${typeId}, ${quantityValue}, '${addedBy.replace(/'/g, "''")}') + INSERT INTO default.blueprint_queue (type_id) + VALUES (${typeId}) `; const response = await fetch(`${CLICKHOUSE_URL}/?query=${encodeURIComponent(query)}`, { @@ -166,7 +163,7 @@ interface TypesenseHit { async function searchTypes(query: string): Promise { if (!query || query.length < 2) return []; - + const response = await fetch( `${TYPESENSE_URL}/collections/invTypes/documents/search?q=${encodeURIComponent(query)}&query_by=typeName&per_page=10`, { @@ -189,8 +186,6 @@ export function BlueprintsQueue() { const [searchResults, setSearchResults] = useState([]); const [selectedType, setSelectedType] = useState(null); const [showDropdown, setShowDropdown] = useState(false); - const [newQuantity, setNewQuantity] = useState(''); - const [addedBy, setAddedBy] = useState(() => localStorage.getItem('blueprint-queue-user') || ''); const dropdownRef = useRef(null); const searchInputRef = useRef(null); @@ -230,13 +225,12 @@ export function BlueprintsQueue() { }, []); const addMutation = useMutation({ - mutationFn: ({ typeId, quantity, by }: { typeId: number; quantity: number | null; by: string }) => - addToQueue(typeId, quantity, by), + mutationFn: ({ typeId }: { typeId: number }) => + addToQueue(typeId), onSuccess: () => { queryClient.invalidateQueries({ queryKey: ['blueprint-queue'] }); setSearchQuery(''); setSelectedType(null); - setNewQuantity(''); }, }); @@ -258,13 +252,9 @@ export function BlueprintsQueue() { const handleAdd = useCallback(() => { if (!selectedType) return; - - const quantity = newQuantity ? parseInt(newQuantity, 10) : null; - const by = addedBy.trim() || 'Unknown'; - - localStorage.setItem('blueprint-queue-user', by); - addMutation.mutate({ typeId: selectedType.typeID, quantity, by }); - }, [selectedType, newQuantity, addedBy, addMutation]); + + addMutation.mutate({ typeId: selectedType.typeID }); + }, [selectedType, addMutation]); if (error) { return ( @@ -317,25 +307,6 @@ export function BlueprintsQueue() { )} -
- - setNewQuantity(e.target.value)} - className="h-9" - /> -
-
- - setAddedBy(e.target.value)} - className="h-9" - /> -