Skip to content
Merged
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
55620b3
fix(gotjunk): Fix icon visibility on map with dark backgrounds
Foundup Nov 8, 2025
9ab1254
fix(gotjunk): Fix classification bug and add duplicate item debugging
Foundup Nov 8, 2025
3a7d635
fix(gotjunk): Add body scroll lock to PigeonMapView
Foundup Nov 8, 2025
488727d
feat(gotjunk): Adaptive sidebar icon visibility on map view
Foundup Nov 8, 2025
60bdd41
fix(gotjunk): Ensure sidebar floats above map with pointer events
Foundup Nov 8, 2025
07bd28d
Resolve merge conflict: keep getButtonStyle() helper for adaptive sty…
Foundup Nov 8, 2025
7161ed4
Merge branch 'main' of https://github.com/Foundup/Foundups-Agent
Foundup Nov 8, 2025
a943e66
Merge branch 'main' of https://github.com/Foundup/Foundups-Agent
Foundup Nov 8, 2025
c533506
Merge branch 'main' of https://github.com/Foundup/Foundups-Agent
Foundup Nov 8, 2025
3cc696a
Merge branch 'main' of https://github.com/Foundup/Foundups-Agent
Foundup Nov 8, 2025
250f696
Merge branch 'main' of https://github.com/Foundup/Foundups-Agent
Foundup Nov 8, 2025
3f48095
Merge branch 'main' of https://github.com/Foundup/Foundups-Agent
Foundup Nov 8, 2025
0cc7992
Merge branch 'main' of https://github.com/Foundup/Foundups-Agent
Foundup Nov 8, 2025
e31d586
Merge branch 'main' of https://github.com/Foundup/Foundups-Agent
Foundup Nov 8, 2025
bc720e4
Merge branch 'main' of https://github.com/Foundup/Foundups-Agent
Foundup Nov 9, 2025
1429b14
Merge branch 'main' of https://github.com/Foundup/Foundups-Agent
Foundup Nov 9, 2025
78c1584
Merge branch 'main' of https://github.com/Foundup/Foundups-Agent
Foundup Nov 9, 2025
8ad26d2
Merge branch 'main' of https://github.com/Foundup/Foundups-Agent
Foundup Nov 9, 2025
435c44a
Merge branch 'main' of https://github.com/Foundup/Foundups-Agent
Foundup Nov 9, 2025
01832ae
Merge branch 'main' of https://github.com/Foundup/Foundups-Agent
Foundup Nov 9, 2025
01fc8e4
Merge branch 'main' of https://github.com/Foundup/Foundups-Agent
Foundup Nov 9, 2025
d7cfb92
Merge branch 'main' of https://github.com/Foundup/Foundups-Agent
Foundup Nov 9, 2025
5cc0b06
Merge branch 'main' of https://github.com/Foundup/Foundups-Agent
Foundup Nov 9, 2025
8a75787
Merge branch 'main' of https://github.com/Foundup/Foundups-Agent
Foundup Nov 9, 2025
0c666cf
Merge branches 'main' and 'main' of https://github.com/Foundup/Foundu…
Foundup Nov 9, 2025
5d8d1d1
Merge branch 'main' of https://github.com/Foundup/Foundups-Agent
Foundup Nov 9, 2025
7edb89d
Merge branch 'main' of https://github.com/Foundup/Foundups-Agent
Foundup Nov 9, 2025
ba94ea4
Merge branch 'main' of https://github.com/Foundup/Foundups-Agent
Foundup Nov 9, 2025
bfe7dfd
docs(gotjunk): Update ModLog with 2025-11-09 session changes
Foundup Nov 9, 2025
cb510aa
Merge branch 'main' of https://github.com/Foundup/Foundups-Agent
Foundup Nov 9, 2025
23d6562
fix(gotjunk): Prevent duplicate item creation race condition
Foundup Nov 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
123 changes: 67 additions & 56 deletions modules/foundups/gotjunk/frontend/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ const App: React.FC = () => {

// === CLASSIFICATION STATE ===
const [pendingClassificationItem, setPendingClassificationItem] = useState<{blob: Blob, url: string, location?: {latitude: number, longitude: number}} | null>(null);
const [isProcessingClassification, setIsProcessingClassification] = useState(false);

// === FULLSCREEN REVIEW STATE (My Items tab) ===
const [reviewingItem, setReviewingItem] = useState<CapturedItem | null>(null);
Expand Down Expand Up @@ -259,73 +260,83 @@ const App: React.FC = () => {
};

const handleClassify = async (classification: ItemClassification, discountPercent?: number, bidDurationHours?: number) => {
console.log('[GotJunk] handleClassify called:', { classification, discountPercent, bidDurationHours, hasPending: !!pendingClassificationItem });
console.log('[GotJunk] handleClassify called:', { classification, discountPercent, bidDurationHours, hasPending: !!pendingClassificationItem, isProcessing: isProcessingClassification });

if (!pendingClassificationItem) {
console.warn('[GotJunk] handleClassify called but no pendingClassificationItem!');
// Prevent duplicate calls (race condition guard)
if (!pendingClassificationItem || isProcessingClassification) {
console.warn('[GotJunk] handleClassify called but no pendingClassificationItem or already processing!');
return;
}

// Immediately capture the item data and clear pending state to prevent race conditions
const { blob, url, location } = pendingClassificationItem;
setPendingClassificationItem(null);
setIsProcessingClassification(true);

// Calculate price based on classification
// TODO: Get originalPrice from Google Vision API
const defaultPrice = 100; // Placeholder until Vision API integration
let price = 0;

// Use provided values or defaults
const finalDiscountPercent = discountPercent || 75;
const finalBidDurationHours = bidDurationHours || 48;
console.log('[GotJunk] Classification processing started, pending item cleared');

if (classification === 'free') {
price = 0;
} else if (classification === 'discount') {
// Use the selected discount percentage
price = defaultPrice * (1 - finalDiscountPercent / 100);
} else if (classification === 'bid') {
price = defaultPrice * 0.5; // Starting bid at 50% OFF
}
try {
// Calculate price based on classification
// TODO: Get originalPrice from Google Vision API
const defaultPrice = 100; // Placeholder until Vision API integration
let price = 0;

// Use provided values or defaults
const finalDiscountPercent = discountPercent || 75;
const finalBidDurationHours = bidDurationHours || 48;

if (classification === 'free') {
price = 0;
} else if (classification === 'discount') {
// Use the selected discount percentage
price = defaultPrice * (1 - finalDiscountPercent / 100);
} else if (classification === 'bid') {
price = defaultPrice * 0.5; // Starting bid at 50% OFF
}

const newItem: CapturedItem = {
id: `item-${Date.now()}`,
blob,
url,
status: 'draft',
ownership: 'mine',
classification,
price,
originalPrice: defaultPrice,
discountPercent: classification === 'discount' ? finalDiscountPercent : undefined,
bidDurationHours: classification === 'bid' ? finalBidDurationHours : undefined,
createdAt: Date.now(),
...location,
};
const newItem: CapturedItem = {
id: `item-${Date.now()}`,
blob,
url,
status: 'draft',
ownership: 'mine',
classification,
price,
originalPrice: defaultPrice,
discountPercent: classification === 'discount' ? finalDiscountPercent : undefined,
bidDurationHours: classification === 'bid' ? finalBidDurationHours : undefined,
createdAt: Date.now(),
...location,
};

console.log('[GotJunk] Saving new item:', { id: newItem.id, classification, price });
await storage.saveItem(newItem);
console.log('[GotJunk] Saving new item:', { id: newItem.id, classification, price });
await storage.saveItem(newItem);

setMyDrafts(current => {
console.log('[GotJunk] Adding to myDrafts, current count:', current.length);
return [newItem, ...current];
});
setMyDrafts(current => {
console.log('[GotJunk] Adding to myDrafts, current count:', current.length);
return [newItem, ...current];
});

// Clear pending item
setPendingClassificationItem(null);
console.log('[GotJunk] Cleared pendingClassificationItem');

// Liberty Alert: If keyword detected during video recording, create alert
if (libertyEnabled && keywordDetected && blob.type.startsWith('video/')) {
console.log('🧊 Liberty Alert - Creating ice cube marker for video');
const alert: LibertyAlert = {
id: `alert-${Date.now()}`,
location: location || { latitude: 0, longitude: 0 },
message: 'Liberty Alert - Keyword detected',
video_url: newItem.url,
timestamp: Date.now(),
};
setLibertyAlerts(prev => [alert, ...prev]);
console.log('🧊 Ice cube marker created on map!');
setKeywordDetected(false);
console.log('[GotJunk] Item successfully created and added to drafts');

// Liberty Alert: If keyword detected during video recording, create alert
if (libertyEnabled && keywordDetected && blob.type.startsWith('video/')) {
console.log('🧊 Liberty Alert - Creating ice cube marker for video');
const alert: LibertyAlert = {
id: `alert-${Date.now()}`,
location: location || { latitude: 0, longitude: 0 },
message: 'Liberty Alert - Keyword detected',
video_url: newItem.url,
timestamp: Date.now(),
};
setLibertyAlerts(prev => [alert, ...prev]);
console.log('🧊 Ice cube marker created on map!');
setKeywordDetected(false);
}
} finally {
// Always reset processing flag, even if there's an error
setIsProcessingClassification(false);
console.log('[GotJunk] Classification processing complete, flag reset');
}
};

Expand Down