Fixed socials order.
This commit is contained in:
		
							parent
							
								
									b41ee2e5cf
								
							
						
					
					
						commit
						3c598bdb6f
					
				|  | @ -32,30 +32,34 @@ body { | |||
| 	color: var(--primary); | ||||
| } | ||||
| 
 | ||||
| .icon.icon-twitter { | ||||
| .icon.icon-social.icon-twitter { | ||||
| 	fill: #008ad8; | ||||
| } | ||||
| 
 | ||||
| .icon.icon-onlyfans { | ||||
| .icon.icon-social.icon-onlyfans { | ||||
| 	fill: #00adef; | ||||
| } | ||||
| 
 | ||||
| .icon.icon-fansly { | ||||
| .icon.icon-social.icon-fansly { | ||||
| 	fill: #2699f6; | ||||
| } | ||||
| 
 | ||||
| .icon.icon-linktree { | ||||
| .icon.icon-social.icon-linktree { | ||||
| 	fill: #43e660; | ||||
| } | ||||
| 
 | ||||
| .icon.icon-pornhub { | ||||
| .icon.icon-social.icon-pornhub { | ||||
| 	fill: #ff9000; | ||||
| } | ||||
| 
 | ||||
| .icon.icon-cashapp { | ||||
| .icon.icon-social.icon-cashapp { | ||||
| 	fill: #00c853; | ||||
| } | ||||
| 
 | ||||
| .icon.icon-loyalfans { | ||||
| .icon.icon-social.icon-loyalfans { | ||||
| 	fill: #d90a16; | ||||
| } | ||||
| 
 | ||||
| .icon.icon-social { | ||||
| 	fill: var(--highlight-strong-10); | ||||
| } | ||||
|  |  | |||
|  | @ -75,15 +75,11 @@ | |||
| 							> | ||||
| 
 | ||||
| 							<datalist id="platforms"> | ||||
| 								<option value="onlyfans">OnlyFans</option> | ||||
| 								<option value="twitter">Twitter/X</option> | ||||
| 								<option value="instagram">Instagram</option> | ||||
| 								<option value="pornhub">PornHub</option> | ||||
| 								<option value="linktree">Linktree</option> | ||||
| 								<option value="fansly">Fansly</option> | ||||
| 								<option value="loyalfans">LoyalFans</option> | ||||
| 								<option value="manyvids">ManyVids</option> | ||||
| 								<option value="cashapp">Cash App</option> | ||||
| 								<option | ||||
| 									v-for="platformSlug in Object.keys(env.socials.urls)" | ||||
| 									:key="`platform-${platformSlug}`" | ||||
| 									:value="platformSlug" | ||||
| 								>{{ platformSlug }}</option> | ||||
| 							</datalist> | ||||
| 
 | ||||
| 							<input | ||||
|  |  | |||
|  | @ -70,11 +70,13 @@ module.exports = { | |||
| 		urls: { | ||||
| 			cashapp: 'https://cash.app/${handle}', // eslint-disable-line no-template-curly-in-string
 | ||||
| 			fansly: 'https://fansly.com/{handle}', | ||||
| 			instagram: 'https://www.instagram.com/{handle}', | ||||
| 			linktree: 'https://linktr.ee/{handle}', | ||||
| 			loyalfans: 'https://www.loyalfans.com/{handle}', | ||||
| 			manyvids: 'https://www.manyvids.com/Profile/{handle}/slug/Store/Videos', | ||||
| 			onlyfans: 'https://onlyfans.com/{handle}', | ||||
| 			pornhub: 'https://www.pornhub.com/model/{handle}', | ||||
| 			reddit: 'https://www.reddit.com/u/{handle}', | ||||
| 			twitter: 'https://x.com/{handle}', | ||||
| 		}, | ||||
| 		prefix: { | ||||
|  |  | |||
|  | @ -55,7 +55,7 @@ const keyMap = { | |||
| 	isCircumcised: 'circumcised', | ||||
| }; | ||||
| 
 | ||||
| const socialsOrder = ['onlyfans', 'twitter', null]; | ||||
| const socialsOrder = ['onlyfans', 'twitter', 'fansly', 'loyalfans', 'manyvids', 'pornhub', 'linktree', null]; | ||||
| 
 | ||||
| export function curateActor(actor, context = {}) { | ||||
| 	return { | ||||
|  | @ -121,7 +121,25 @@ export function curateActor(actor, context = {}) { | |||
| 			url: social.url, | ||||
| 			platform: social.platform, | ||||
| 			handle: social.handle, | ||||
| 		})).toSorted((socialA, socialB) => socialsOrder.indexOf(socialA.platform) - socialsOrder.indexOf(socialB.platform)), | ||||
| 		})).toSorted((socialA, socialB) => { | ||||
| 			if (socialA.platform && !socialB.platform) { | ||||
| 				return -1; | ||||
| 			} | ||||
| 
 | ||||
| 			if (socialB.platform && !socialA.platform) { | ||||
| 				return 1; | ||||
| 			} | ||||
| 
 | ||||
| 			if (socialsOrder.includes(socialA.platform) && !socialsOrder.includes(socialB.platform)) { | ||||
| 				return -1; | ||||
| 			} | ||||
| 
 | ||||
| 			if (socialsOrder.includes(socialB.platform) && !socialsOrder.includes(socialA.platform)) { | ||||
| 				return 1; | ||||
| 			} | ||||
| 
 | ||||
| 			return socialsOrder.indexOf(socialA.platform) - socialsOrder.indexOf(socialB.platform); | ||||
| 		}), | ||||
| 		profiles: context.profiles?.map((profile) => ({ | ||||
| 			id: profile.id, | ||||
| 			description: profile.description, | ||||
|  | @ -561,6 +579,7 @@ async function applyActorSocialsDelta(actorId, delta, trx) { | |||
| 			platform: social.platform, | ||||
| 			handle: social.handle, | ||||
| 			url: social.url, | ||||
| 			verified_at: knex.fn.now(), // manual add implies verification
 | ||||
| 		}))) | ||||
| 		.transacting(trx); | ||||
| } | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue