Skip to content

Commit e93d167

Browse files
feat: replace compensation text labels with styled pills and add FaHandshake icon
1 parent 303268f commit e93d167

1 file changed

Lines changed: 29 additions & 9 deletions

File tree

‎src/app/resource/[slug]/page.js‎

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import resources from '@/../public/resources_wikidata.json';
33
import { redirect, permanentRedirect } from 'next/navigation';
44
import Link from 'next/link';
55
import { permanentDoi } from '@/data/config';
6-
import { FaCheckCircle, FaExternalLinkAlt, FaHeart, FaDollarSign, FaQuestionCircle, FaUniversity, FaBuilding, FaFlask, FaLandmark, FaInfoCircle, FaLaptop, FaMobileAlt, FaCog, FaShareAlt, FaMapMarkerAlt, FaGlobe, FaTag, FaClipboardList, FaUserCheck, FaUserFriends, FaCoins, FaListOl, FaUserShield, FaArrowRight, FaBox, FaBook, FaDatabase, FaCodeBranch } from 'react-icons/fa';
6+
import { FaCheckCircle, FaExternalLinkAlt, FaHeart, FaDollarSign, FaQuestionCircle, FaUniversity, FaBuilding, FaFlask, FaLandmark, FaInfoCircle, FaLaptop, FaMobileAlt, FaCog, FaShareAlt, FaMapMarkerAlt, FaGlobe, FaTag, FaClipboardList, FaUserCheck, FaUserFriends, FaCoins, FaListOl, FaUserShield, FaArrowRight, FaBox, FaBook, FaDatabase, FaCodeBranch, FaHandshake } from 'react-icons/fa';
77
import CopyButton from '@/components/CopyButton';
88
import wikidataStats from '@/data/wikidataStats.json';
99
import WikidataIcon from '@/components/WikidataIcon';
@@ -122,11 +122,33 @@ export default function ResourcePage({ params }) {
122122

123123
const isCitedOnWikidata = resource.resourceWikidataId && wikidataStats.items?.some(i => i.id === resource.resourceWikidataId);
124124

125-
const getCompensationIcon = (type) => {
126-
if (type === 'donation') return <span className="text-red-500 mr-2">❤️</span>;
127-
if (type === 'payment') return <span className="text-green-500 mr-2">💵</span>;
128-
if (type === 'mixed') return <span className="mr-2">❤️+💵</span>;
129-
return null;
125+
const renderCompensationPill = (type) => {
126+
switch(type) {
127+
case 'donation':
128+
return (
129+
<span className="inline-flex items-center bg-red-50 text-red-700 border border-red-100 text-md font-medium px-4 py-2 rounded-full">
130+
<FaHeart className="mr-2 text-red-500" /> Unpaid Donation
131+
</span>
132+
);
133+
case 'payment':
134+
return (
135+
<span className="inline-flex items-center bg-green-50 text-green-700 border border-green-100 text-md font-medium px-4 py-2 rounded-full">
136+
<FaDollarSign className="mr-2 text-green-600" /> Financial Compensation
137+
</span>
138+
);
139+
case 'mixed':
140+
return (
141+
<span className="inline-flex items-center bg-indigo-50 text-indigo-700 border border-indigo-100 text-md font-medium px-4 py-2 rounded-full">
142+
<FaHandshake className="mr-2 text-indigo-500" /> Mixed (Donation & Payment)
143+
</span>
144+
);
145+
default:
146+
return (
147+
<span className="inline-flex items-center bg-gray-100 text-gray-800 border border-gray-200 text-md font-medium px-4 py-2 rounded-full">
148+
{type ? type.charAt(0).toUpperCase() + type.slice(1) : 'Unknown'}
149+
</span>
150+
);
151+
}
130152
};
131153

132154
return (
@@ -257,9 +279,7 @@ export default function ResourcePage({ params }) {
257279
</div>
258280
<div>
259281
<h2 className="text-sm font-semibold uppercase tracking-wide text-gray-500 mb-4">Compensation</h2>
260-
<span className="inline-flex items-center bg-yellow-100 text-yellow-800 text-md font-medium px-4 py-2 rounded-full">
261-
{getCompensationIcon(resource.compensationType)} {resource.compensationType.charAt(0).toUpperCase() + resource.compensationType.slice(1)}
262-
</span>
282+
{renderCompensationPill(resource.compensationType)}
263283
</div>
264284
<div>
265285
<h2 className="text-sm font-semibold uppercase tracking-wide text-gray-500 mb-4">Entity Type</h2>

0 commit comments

Comments
 (0)