diff --git a/external/lang b/external/lang index faafd6e4..42e050b7 160000 --- a/external/lang +++ b/external/lang @@ -1 +1 @@ -Subproject commit faafd6e4f3cf955d6cb684d9bec9de31e62f301a +Subproject commit 42e050b7dff9e9b8a4207b78bb8a7d8dbae9a92c diff --git a/package.json b/package.json index b71375ac..124662d8 100644 --- a/package.json +++ b/package.json @@ -124,8 +124,8 @@ "react-virtualized-auto-sizer": "^1.0.5", "react-virtuoso": "^1.10.4", "redux": "^4.1.0", - "revolt-api": "^0.5.3-alpha.8-patch.0", - "revolt.js": "^5.1.0-alpha.7", + "revolt-api": "0.5.3-alpha.10", + "revolt.js": "^5.1.0-alpha.10", "rimraf": "^3.0.2", "sass": "^1.35.1", "shade-blend-color": "^1.0.0", diff --git a/src/components/common/user/UserBadges.tsx b/src/components/common/user/UserBadges.tsx new file mode 100644 index 00000000..9ca07621 --- /dev/null +++ b/src/components/common/user/UserBadges.tsx @@ -0,0 +1,133 @@ +import { Shield } from "@styled-icons/boxicons-regular"; +import { Badges } from "revolt-api/types/Users"; +import styled from "styled-components"; + +import { Localizer, Text } from "preact-i18n"; + +import Tooltip from "../Tooltip"; + +const BadgesBase = styled.div` + gap: 8px; + display: flex; + margin-top: 4px; + flex-direction: row; + + img { + width: 32px; + height: 32px; + } +`; + +interface Props { + badges: number; + uid?: string; +} + +export default function UserBadges({ badges, uid }: Props) { + return ( + + + {badges & Badges.Founder ? ( + + }> + + + ) : ( + <> + )} + {badges & Badges.Developer ? ( + }> + + + ) : ( + <> + )} + {badges & Badges.Translator ? ( + + }> + { + window.open( + "https://weblate.insrt.uk/projects/revolt/web-app/", + "_blank", + ); + }} + /> + + ) : ( + <> + )} + {badges & Badges.EarlyAdopter ? ( + + }> + + + ) : ( + <> + )} + {badges & Badges.ResponsibleDisclosure ? ( + + }> + + + ) : ( + <> + )} + {badges & Badges.Supporter ? ( + + }> + { + window.open( + "https://insrt.uk/donate", + "_blank", + ); + }} + /> + + ) : ( + <> + )} + {badges & Badges.ReservedRelevantJokeBadge1 ? ( + + + + ) : ( + <> + )} + {badges & Badges.Paw ? ( + + + + ) : ( + <> + )} + {uid === "01EX2NCWQ0CHS3QJF0FEQS1GR4" ? ( + + + + ) : ( + <> + )} + + + ); +} diff --git a/src/context/intermediate/popovers/UserProfile.module.scss b/src/context/intermediate/popovers/UserProfile.module.scss index 2341364b..764b045d 100644 --- a/src/context/intermediate/popovers/UserProfile.module.scss +++ b/src/context/intermediate/popovers/UserProfile.module.scss @@ -115,18 +115,6 @@ } } -.badges { - gap: 8px; - display: flex; - margin-top: 4px; - flex-direction: row; - - img { - width: 32px; - height: 32px; - } -} - .entries { gap: 8px; display: flex; diff --git a/src/context/intermediate/popovers/UserProfile.tsx b/src/context/intermediate/popovers/UserProfile.tsx index af8192c2..ef4a64db 100644 --- a/src/context/intermediate/popovers/UserProfile.tsx +++ b/src/context/intermediate/popovers/UserProfile.tsx @@ -1,5 +1,4 @@ -import { Money } from "@styled-icons/boxicons-regular"; -import { Envelope, Edit, UserPlus, Shield } from "@styled-icons/boxicons-solid"; +import { Envelope, Edit, UserPlus } from "@styled-icons/boxicons-solid"; import { observer } from "mobx-react-lite"; import { Link, useHistory } from "react-router-dom"; import { Profile, RelationshipStatus } from "revolt-api/types/Users"; @@ -13,6 +12,7 @@ import { useContext, useEffect, useLayoutEffect, useState } from "preact/hooks"; import ChannelIcon from "../../../components/common/ChannelIcon"; import ServerIcon from "../../../components/common/ServerIcon"; import Tooltip from "../../../components/common/Tooltip"; +import UserBadges from "../../../components/common/user/UserBadges"; import UserIcon from "../../../components/common/user/UserIcon"; import { Username } from "../../../components/common/user/UserShort"; import UserStatus from "../../../components/common/user/UserStatus"; @@ -300,87 +300,7 @@ export const UserProfile = observer( )} {badges > 0 && ( -
- - {badges & Badges.Developer ? ( - - }> - - - ) : ( - <> - )} - {badges & Badges.Translator ? ( - - }> - { - window.open( - "https://weblate.insrt.uk/projects/revolt/web-app/", - "_blank", - ); - }} - /> - - ) : ( - <> - )} - {badges & Badges.EarlyAdopter ? ( - - }> - - - ) : ( - <> - )} - {badges & Badges.Supporter ? ( - - }> - { - window.open( - "https://insrt.uk/donate", - "_blank", - ); - }} - /> - - ) : ( - <> - )} - {badges & - Badges.ResponsibleDisclosure ? ( - - }> - - - ) : ( - <> - )} - -
+ )} {profile?.content && (
diff --git a/yarn.lock b/yarn.lock index e68ae46a..416df47a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3647,15 +3647,20 @@ reusify@^1.0.4: resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== -revolt-api@^0.5.3-alpha.8-patch.0: - version "0.5.3-alpha.8-patch.0" - resolved "https://registry.yarnpkg.com/revolt-api/-/revolt-api-0.5.3-alpha.8-patch.0.tgz#3c9f981f8100a89aec1299bc110453cf01c51f89" - integrity sha512-ghupcB1nJS7fCiD41L4u+QudFoBWGE381uW4s8cuHsQS3bFXgzAH1lgtjYNoFgrVUekqQAcHWote8Kn2sOABAQ== +revolt-api@0.5.3-alpha.10: + version "0.5.3-alpha.10" + resolved "https://registry.yarnpkg.com/revolt-api/-/revolt-api-0.5.3-alpha.10.tgz#973f7d63dbce5ddb0c5ec17c7e89a0474770d66f" + integrity sha512-v+eSPLWpiqmfHafPDeCF1nvd4Ff43ktyvVgGHt7aQN2v9Qm1BFrmpWHWoDPeZpXlW6mtpo+1t74nLK6VCsZ+VA== -revolt.js@^5.1.0-alpha.7: - version "5.1.0-alpha.7" - resolved "https://registry.yarnpkg.com/revolt.js/-/revolt.js-5.1.0-alpha.7.tgz#20fe8d3390b95f351361e5bc70e8a1b31467ae69" - integrity sha512-4FLh4MEql0kt83h6++jmQ2F4KGNer3odKkRs7avliu4wEJpQDmUD21anChO41Uv1gHBZMXIFdrYt5OCK384pSg== +revolt-api@^0.5.3-alpha.9: + version "0.5.3-alpha.9" + resolved "https://registry.yarnpkg.com/revolt-api/-/revolt-api-0.5.3-alpha.9.tgz#46e75b7d8f9c6702df39039b829dddbb7897f237" + integrity sha512-L8K9uPV3ME8bLdtWm8L9iPQvFM0GghA+5LzmWFjd6Gbn56u22ZYub2lABi4iHrWgeA2X41dGSsuSBgHSlts9Og== + +revolt.js@^5.1.0-alpha.10: + version "5.1.0-alpha.10" + resolved "https://registry.yarnpkg.com/revolt.js/-/revolt.js-5.1.0-alpha.10.tgz#e393ac8524e629d3359135651b23b044c0cc9b7b" + integrity sha512-wEmBMJkZE/oWy6mzVZg1qw5QC9CE+Gb7sTFlJl+C4pbXfTJWAtY311Tjbd2tX8w3ohYDmN338bVfCW4cOQ8GXQ== dependencies: axios "^0.21.4" eventemitter3 "^4.0.7" @@ -3664,6 +3669,7 @@ revolt.js@^5.1.0-alpha.7: lodash.defaultsdeep "^4.6.1" lodash.isequal "^4.5.0" mobx "^6.3.2" + revolt-api "^0.5.3-alpha.9" ulid "^2.3.0" ws "^8.2.2"