alpha
Login
or
Join now
atpota.to
/
cred.blue
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
This repository has no description
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Overview
Issues
Pulls
Pipelines
update emojis to pull from supabase
author
damedotblog
date
1 year ago
(Mar 3, 2025, 9:00 AM -0500)
commit
376f2b50
376f2b5035e707d9d13fdd8131d377831064ac93
parent
fc3b4f54
fc3b4f54c331f90a76969dcaf2a479dbc51e4580
+21
-17
1 changed file
Expand all
Collapse all
Unified
Split
src
components
Resources
Resources.js
+21
-17
src/components/Resources/Resources.js
Reviewed
···
12
12
const [showNewOnly, setShowNewOnly] = useState(false);
13
13
const [showScoreImpactOnly, setShowScoreImpactOnly] = useState(false);
14
14
const [isLoading, setIsLoading] = useState(true);
15
15
-
16
16
-
// Category emojis mapping
17
17
-
const categoryEmojis = {
18
18
-
'All': '🔍',
19
19
-
'Analytics': '📊',
20
20
-
'Services': '🛠️',
21
21
-
'Data': '💾',
22
22
-
'Network': '🔄',
23
23
-
'Clients': '📱',
24
24
-
'Moderation': '🛡️',
25
25
-
'Feeds': '📰',
26
26
-
'Visualizations': '🎨',
27
27
-
'Development': '👨💻',
28
28
-
'Guides': '📚',
29
29
-
'Misc': '🔮'
30
30
-
};
15
15
+
// Add a new state to store category emojis from database
16
16
+
const [categoryEmojis, setCategoryEmojis] = useState({
17
17
+
'All': '🔍' // Default emoji for 'All'
18
18
+
});
31
19
32
20
// Load saved user preferences from localStorage
33
21
useEffect(() => {
···
81
69
throw categoriesError;
82
70
}
83
71
72
72
+
// Fetch all categories to build the emoji mapping
73
73
+
const { data: allCategories, error: allCategoriesError } = await supabase
74
74
+
.from('categories')
75
75
+
.select('name, emoji');
76
76
+
77
77
+
if (allCategoriesError) {
78
78
+
throw allCategoriesError;
79
79
+
}
80
80
+
81
81
+
// Build category emojis mapping
82
82
+
const emojisMap = { 'All': '🔍' }; // Default for 'All'
83
83
+
allCategories.forEach(category => {
84
84
+
emojisMap[category.name] = category.emoji || '🔹'; // Fallback emoji if none in DB
85
85
+
});
86
86
+
setCategoryEmojis(emojisMap);
87
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
105
-
emoji: item.category.emoji
109
109
+
emoji: item.category.emoji || '🔹' // Fallback emoji if none in DB
106
110
});
107
111
});
108
112