This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

update emojis to pull from supabase

+21 -17
+21 -17
src/components/Resources/Resources.js
··· 12 12 const [showNewOnly, setShowNewOnly] = useState(false); 13 13 const [showScoreImpactOnly, setShowScoreImpactOnly] = useState(false); 14 14 const [isLoading, setIsLoading] = useState(true); 15 - 16 - // Category emojis mapping 17 - const categoryEmojis = { 18 - 'All': '🔍', 19 - 'Analytics': '📊', 20 - 'Services': '🛠️', 21 - 'Data': '💾', 22 - 'Network': '🔄', 23 - 'Clients': '📱', 24 - 'Moderation': '🛡️', 25 - 'Feeds': '📰', 26 - 'Visualizations': '🎨', 27 - 'Development': '👨‍💻', 28 - 'Guides': '📚', 29 - 'Misc': '🔮' 30 - }; 15 + // Add a new state to store category emojis from database 16 + const [categoryEmojis, setCategoryEmojis] = useState({ 17 + 'All': '🔍' // Default emoji for 'All' 18 + }); 31 19 32 20 // Load saved user preferences from localStorage 33 21 useEffect(() => { ··· 81 69 throw categoriesError; 82 70 } 83 71 72 + // Fetch all categories to build the emoji mapping 73 + const { data: allCategories, error: allCategoriesError } = await supabase 74 + .from('categories') 75 + .select('name, emoji'); 76 + 77 + if (allCategoriesError) { 78 + throw allCategoriesError; 79 + } 80 + 81 + // Build category emojis mapping 82 + const emojisMap = { 'All': '🔍' }; // Default for 'All' 83 + allCategories.forEach(category => { 84 + emojisMap[category.name] = category.emoji || '🔹'; // Fallback emoji if none in DB 85 + }); 86 + setCategoryEmojis(emojisMap); 87 + 84 88 // Then fetch the tags for each resource 85 89 const { data: resourceTags, error: tagsError } = await supabase 86 90 .from('resource_tags') ··· 102 106 categoriesByResource[item.resource_id].push({ 103 107 id: item.category.id, 104 108 name: item.category.name, 105 - emoji: item.category.emoji 109 + emoji: item.category.emoji || '🔹' // Fallback emoji if none in DB 106 110 }); 107 111 }); 108 112