From e587cfa7928a966ad95c5db17e6c4894d419af75 Mon Sep 17 00:00:00 2001 From: kpdve Date: Wed, 2 Apr 2025 17:43:13 +0200 Subject: [PATCH 1/2] feat(app): trusted user container --- .../dtos/user-profile.dto.ts | 1 + src/containers/trusted-user.container.tsx | 77 +++++++++++++++++++ src/features/creator/creator.view.tsx | 2 + 3 files changed, 80 insertions(+) create mode 100644 src/containers/trusted-user.container.tsx diff --git a/src/api-4markdown-contracts/dtos/user-profile.dto.ts b/src/api-4markdown-contracts/dtos/user-profile.dto.ts index a51b243ec..dc1c29132 100644 --- a/src/api-4markdown-contracts/dtos/user-profile.dto.ts +++ b/src/api-4markdown-contracts/dtos/user-profile.dto.ts @@ -27,6 +27,7 @@ type UserProfileDto = { twitterUrl: string | null; fbUrl: string | null; blogUrl: string | null; + isTrusted: boolean | null; }; export type { UserProfileDto }; diff --git a/src/containers/trusted-user.container.tsx b/src/containers/trusted-user.container.tsx new file mode 100644 index 000000000..b242d22ae --- /dev/null +++ b/src/containers/trusted-user.container.tsx @@ -0,0 +1,77 @@ +import React from 'react'; +import type { ReactNode, DetailedHTMLProps, ButtonHTMLAttributes } from 'react'; +import { useYourUserProfileState } from 'store/your-user-profile'; +import { MdVerified, MdGppBad, MdGppMaybe } from 'react-icons/md'; +import c from 'classnames'; + +interface TooltipProps + extends DetailedHTMLProps< + ButtonHTMLAttributes, + HTMLButtonElement + > { + text: string; + children: ReactNode; + className?: string; +} + +const Tooltip = ({ text, children, className }: TooltipProps) => ( +
+ {children} + + {text} + +
+); + +const TrustedUserContainer = () => { + const yourUserProfile = useYourUserProfileState(); + + if (yourUserProfile.is !== `ok`) { + return ( + + + + + + ); + } + + const isVerified = yourUserProfile.user?.isTrusted; + + return ( + + + {isVerified ? : } + + + ); +}; + +export { TrustedUserContainer }; diff --git a/src/features/creator/creator.view.tsx b/src/features/creator/creator.view.tsx index 6e02efa43..9c9be797a 100644 --- a/src/features/creator/creator.view.tsx +++ b/src/features/creator/creator.view.tsx @@ -36,6 +36,7 @@ import { isInvalidSelection, getSelectedText, } from 'development-kit/textarea-utils'; +import { TrustedUserContainer } from 'containers/trusted-user.container'; const CreatorErrorModalContainer = React.lazy( () => import(`./containers/creator-error-modal.container`), @@ -320,6 +321,7 @@ const CreatorView = () => {
From 1c9983b12e670e266be29c5603c0bcaf7ccee59d Mon Sep 17 00:00:00 2001 From: kpdve Date: Wed, 2 Apr 2025 18:01:08 +0200 Subject: [PATCH 2/2] feat(app): add isTrusted to docs-display.cy.ts --- cypress/e2e/docs-display.cy.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/cypress/e2e/docs-display.cy.ts b/cypress/e2e/docs-display.cy.ts index e4a87582f..3806c6d41 100644 --- a/cypress/e2e/docs-display.cy.ts +++ b/cypress/e2e/docs-display.cy.ts @@ -48,6 +48,7 @@ const getUserProfileResponse: { result: UserProfileDto } = { githubUrl: null, twitterUrl: null, linkedInUrl: null, + isTrusted: null, }, };