Skip to content

Commit

Permalink
Feature a specific list of possible icon labels on the profile metada…
Browse files Browse the repository at this point in the history
…ta edit page
  • Loading branch information
ZMYaro committed Mar 15, 2023
1 parent 8c0b91c commit 473cd7d
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 8 deletions.
14 changes: 6 additions & 8 deletions components/settings/SettingsProfileMetadata.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,13 @@ const chooseIcon = (i: number, text: string) => {
<template #popper>
<div flex="~ wrap gap-1" max-w-60 m2 me1>
<CommonTooltip
v-for="(icon, text) in accountFieldIcons"
:key="icon"
:content="text"
v-for="label in suggestedAccountFields"
:key="accountFieldIcons[label]"
:content="label"
>
<template v-if="text !== 'Joined'">
<button type="button" btn-action-icon @click="chooseIcon(i - 1, text)">
<div text-xl :class="icon" />
</button>
</template>
<button type="button" btn-action-icon @click="chooseIcon(i - 1, label)">
<div text-xl :class="accountFieldIcons[label]" />
</button>
</CommonTooltip>
</div>
</template>
Expand Down
55 changes: 55 additions & 0 deletions composables/masto/icons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,61 @@ export const accountFieldIcons: Record<string, string> = Object.fromEntries(Obje
'Zhihu': 'i-ri:zhihu-line',
}).sort(([a], [b]) => a.localeCompare(b)))

/** Fields to suggest on the profile metadata edit page */
export const suggestedAccountFields: Array<string> = [
'Alipay',
'Bilibili',
'Birthday',
'Blog',
'Buy Me A Coffee',
'City',
'Dingding',
'Discord',
'Douban',
'E-mail',
'Facebook',
'GitHub',
'GitLab',
'GPG',
'Homepage',
'Instagram',
'IRC',
'Keyoxide',
'Ko-Fi',
'Languages',
'LinkedIn',
'Location',
'Mastodon',
'Matrix',
'Medium',
'Nintendo Switch',
'OpenPGP',
'Patreon',
'PayPal',
'PGP',
'Photos',
'PlayStation',
'Pronouns',
'QQ',
'Skype',
'Slack',
'Snapchat',
'Sponsors',
'Spotify',
'Steam',
'Substack',
'Telegram',
'Tumblr',
'Twitch',
'Twitter',
'Website',
'WeChat',
'Weibo',
'Xbox',
'YouTube',
'Zhihu',
]

const accountFieldIconsLowercase = Object.fromEntries(
Object.entries(accountFieldIcons).map(([k, v]) =>
[k.toLowerCase(), v],
Expand Down

0 comments on commit 473cd7d

Please sign in to comment.