| 1 | import type { StaticImageData } from 'next/image' |
| 2 | import bilibiliIcon from '@/assets/svgs/plat/bilibili.svg' |
| 3 | import douyinIcon from '@/assets/svgs/plat/douyin.svg' |
| 4 | import facebookIcon from '@/assets/svgs/plat/facebook.svg' |
| 5 | import gzhIcon from '@/assets/svgs/plat/gzh.svg' |
| 6 | import instagramIcon from '@/assets/svgs/plat/instagram.svg' |
| 7 | import ksIcon from '@/assets/svgs/plat/ks.svg' |
| 8 | import linkedinIcon from '@/assets/svgs/plat/linkedin.svg' |
| 9 | import pinterestIcon from '@/assets/svgs/plat/pinterest.svg' |
| 10 | import threadsIcon from '@/assets/svgs/plat/threads.svg' |
| 11 | import tiktokIcon from '@/assets/svgs/plat/tiktok.svg' |
| 12 | import twitterIcon from '@/assets/svgs/plat/twitter.svg' |
| 13 | import wxSphIcon from '@/assets/svgs/plat/wx-sph.svg' |
| 14 | import xhsIcon from '@/assets/svgs/plat/xhs.svg' |
| 15 | import youtubeIcon from '@/assets/svgs/plat/youtube.svg' |
| 16 | |
| 17 | export enum PlatType { |
| 18 | Tiktok = 'tiktok', |
| 19 | Douyin = 'douyin', |
| 20 | Xhs = 'xhs', |
| 21 | WxSph = 'wxSph', |
| 22 | KWAI = 'KWAI', |
| 23 | YouTube = 'youtube', |
| 24 | BILIBILI = 'bilibili', |
| 25 | Twitter = 'twitter', |
| 26 | WxGzh = 'wxGzh', |
| 27 | Facebook = 'facebook', |
| 28 | Instagram = 'instagram', |
| 29 | Threads = 'threads', |
| 30 | Pinterest = 'pinterest', |
| 31 | LinkedIn = 'linkedin', |
| 32 | } |
| 33 | |
| 34 | type PlatformIconAsset = string | StaticImageData |
| 35 | |
| 36 | export interface AccountPlatInfo { |
| 37 | name: string |
| 38 | icon: string |
| 39 | tips?: { |
| 40 | account?: string |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | function getIconSrc(asset: PlatformIconAsset) { |
| 45 | return typeof asset === 'string' ? asset : asset.src |
| 46 | } |
| 47 | |
| 48 | export const AccountPlatInfoMap = new Map<PlatType, AccountPlatInfo>([ |
| 49 | [PlatType.Tiktok, { name: 'TikTok', icon: getIconSrc(tiktokIcon) }], |
| 50 | [PlatType.Douyin, { name: 'Douyin', icon: getIconSrc(douyinIcon) }], |
| 51 | [PlatType.Xhs, { name: 'RedNote', icon: getIconSrc(xhsIcon) }], |
| 52 | [PlatType.WxSph, { name: 'WeChat Channels', icon: getIconSrc(wxSphIcon) }], |
| 53 | [PlatType.KWAI, { name: 'Kwai', icon: getIconSrc(ksIcon) }], |
| 54 | [PlatType.YouTube, { name: 'YouTube', icon: getIconSrc(youtubeIcon) }], |
| 55 | [PlatType.BILIBILI, { name: 'Bilibili', icon: getIconSrc(bilibiliIcon) }], |
| 56 | [PlatType.Twitter, { name: 'X', icon: getIconSrc(twitterIcon) }], |
| 57 | [PlatType.WxGzh, { name: 'WeChat Official Account', icon: getIconSrc(gzhIcon) }], |
| 58 | [PlatType.Facebook, { name: 'Facebook', icon: getIconSrc(facebookIcon) }], |
| 59 | [PlatType.Instagram, { name: 'Instagram', icon: getIconSrc(instagramIcon) }], |
| 60 | [PlatType.Threads, { name: 'Threads', icon: getIconSrc(threadsIcon) }], |
| 61 | [PlatType.Pinterest, { name: 'Pinterest', icon: getIconSrc(pinterestIcon) }], |
| 62 | [PlatType.LinkedIn, { name: 'LinkedIn', icon: getIconSrc(linkedinIcon) }], |
| 63 | ]) |
| 64 | |
| 65 | export const RegionSortedPlatInfoArr = Array.from(AccountPlatInfoMap.entries()) |
| 66 | |
| 67 | export function isPlatformAvailable(_platform: PlatType) { |
| 68 | return true |
| 69 | } |
| 70 |