diff --git a/public/images/base-badge.png b/public/images/base-badge.png new file mode 100644 index 0000000000..d136e45d05 Binary files /dev/null and b/public/images/base-badge.png differ diff --git a/src/components/Article/Detail/Sidebar.tsx b/src/components/Article/Detail/Sidebar.tsx index 7ba4d8e62f..84cd00be8c 100644 --- a/src/components/Article/Detail/Sidebar.tsx +++ b/src/components/Article/Detail/Sidebar.tsx @@ -4,7 +4,7 @@ import { IconList, IconPaperclip } from '@tabler/icons-react'; import { AttachmentCard } from '~/components/Article/Detail/AttachmentCard'; import { TableOfContent } from '~/components/Article/Detail/TableOfContent'; -import { CreatorCardV2 } from '~/components/CreatorCard/CreatorCard'; +import { SmartCreatorCard } from '~/components/CreatorCard/CreatorCard'; import { useHeadingsData } from '~/hooks/useHeadingsData'; import { hideMobile } from '~/libs/sx-helpers'; import type { ArticleGetById } from '~/server/services/article.service'; @@ -78,7 +78,7 @@ export function Sidebar({ articleId, attachments, creator }: Props) { )} - + ); diff --git a/src/components/Bounty/AwardBountyAction.tsx b/src/components/Bounty/AwardBountyAction.tsx index 05c4e40705..16cadf3daf 100644 --- a/src/components/Bounty/AwardBountyAction.tsx +++ b/src/components/Bounty/AwardBountyAction.tsx @@ -9,7 +9,7 @@ import { showErrorNotification, showSuccessNotification } from '~/utils/notifica import { BountyGetById } from '~/types/router'; import { useCurrentUser } from '~/hooks/useCurrentUser'; import { getBountyCurrency } from '~/components/Bounty/bounty.utils'; -import { CreatorCardV2 } from '~/components/CreatorCard/CreatorCard'; +import { SmartCreatorCard } from '~/components/CreatorCard/CreatorCard'; import { formatDate } from '~/utils/date-helpers'; import { useTrackEvent } from '../TrackView/track.utils'; @@ -172,7 +172,7 @@ export const AwardBountyAction = ({ Entry added on {formatDate(bountyEntry.createdAt)} by - + )} diff --git a/src/components/CreatorCard/CreatorCard.tsx b/src/components/CreatorCard/CreatorCard.tsx index 324503f4a5..0b20f9d4f4 100644 --- a/src/components/CreatorCard/CreatorCard.tsx +++ b/src/components/CreatorCard/CreatorCard.tsx @@ -22,7 +22,7 @@ import { formatDate } from '~/utils/date-helpers'; import { sortDomainLinks } from '~/utils/domain-link'; import { trpc } from '~/utils/trpc'; import { TipBuzzButton } from '../Buzz/TipBuzzButton'; -import { UserStatBadges } from '../UserStatBadges/UserStatBadges'; +import { UserStatBadges, UserStatBadgesV2 } from '../UserStatBadges/UserStatBadges'; import { getEdgeUrl } from '~/client-utils/cf-images-utils'; import { BadgeCosmetic, @@ -35,6 +35,7 @@ import { isDefined } from '~/utils/type-guards'; import { BadgeDisplay, Username } from '../User/Username'; import { createServerSideProps } from '~/server/utils/server-side-helpers'; import { UserPublicSettingsSchema } from '~/server/schema/user.schema'; +import { useFeatureFlags } from '~/providers/FeatureFlagsProvider'; const useStyles = createStyles((theme) => ({ profileDetailsContainer: { @@ -66,6 +67,7 @@ export function CreatorCard({ tipBuzzEntityType, tipBuzzEntityId, withActions = true, + ...cardProps }: Props) { const { data } = trpc.user.getCreator.useQuery( { id: user.id }, @@ -90,86 +92,46 @@ export function CreatorCard({ if (!creator || user.id === -1) return null; - const backgroundImage = creator.cosmetics.find(({ cosmetic }) => - cosmetic ? cosmetic.type === 'ProfileBackground' : undefined - )?.cosmetic as Omit; - return ( - + - - - - - {withActions && ( - - - - - - )} - - - - {stats && ( - + + + {withActions && ( + + - )} - - - + + + + )} + + + + {stats && ( + + )} + + {creator.links && creator.links.length > 0 ? ( {stats && displayStats.length > 0 && ( - ; type PropsV2 = { user: UserWithCosmetics; @@ -425,3 +387,13 @@ type PropsV2 = { useEquippedCosmetics?: boolean; startDisplayOverwrite?: string[]; } & Omit; + +export const SmartCreatorCard = (props: PropsV2) => { + const featureFlags = useFeatureFlags(); + + if (featureFlags.cosmeticShop) { + return ; + } + + return ; +}; diff --git a/src/components/IconBadge/IconBadge.tsx b/src/components/IconBadge/IconBadge.tsx index da62b93264..f05a35bb75 100644 --- a/src/components/IconBadge/IconBadge.tsx +++ b/src/components/IconBadge/IconBadge.tsx @@ -42,7 +42,7 @@ export function IconBadge({ icon, children, tooltip, href, ...props }: IconBadge } export type IconBadgeProps = { - icon: React.ReactNode; + icon?: React.ReactNode; tooltip?: React.ReactNode; onClick?: React.MouseEventHandler | undefined; //eslint-disable-line href?: string; diff --git a/src/components/Image/Detail/ImageDetail.tsx b/src/components/Image/Detail/ImageDetail.tsx index 1bddff7837..305c274386 100644 --- a/src/components/Image/Detail/ImageDetail.tsx +++ b/src/components/Image/Detail/ImageDetail.tsx @@ -56,7 +56,7 @@ import { containerQuery } from '~/utils/mantine-css-helpers'; import { ProfileBackgroundCosmetic } from '~/server/selectors/cosmetic.selector'; import { getEdgeUrl } from '~/client-utils/cf-images-utils'; import { applyCosmeticThemeColors } from '~/libs/sx-helpers'; -import { CreatorCardV2 } from '~/components/CreatorCard/CreatorCard'; +import { SmartCreatorCard } from '~/components/CreatorCard/CreatorCard'; export function ImageDetail() { const { classes, cx, theme } = useStyles(); @@ -113,7 +113,7 @@ export function ImageDetail() { - + - + {onSite && ( ) => ( + + + {`${label} + + {icon} + + + + + {value} + + + +); + export function UserStatBadgesV2({ followers, favorites, @@ -146,118 +195,42 @@ export function UserStatBadgesV2({ const theme = useMantineTheme(); return ( - - - - {uploads != null ? ( - } - icon={} - sx={ - colorOverrides - ? { color: colorOverrides.textColor ?? theme.colors.gray[0] } - : undefined - } - size="lg" - // @ts-ignore: transparent variant does work - variant="transparent" - > - - {abbreviateNumber(uploads)} - - - ) : null} - {followers != null ? ( - } - href={username ? `/user/${username}/followers` : undefined} - icon={} - sx={ - colorOverrides - ? { color: colorOverrides.textColor ?? theme.colors.gray[0] } - : undefined - } - size="lg" - // @ts-ignore: transparent variant does work - variant="transparent" - > - - {abbreviateNumber(followers)} - - - ) : null} - {favorites != null ? ( - } - icon={} - sx={ - colorOverrides - ? { color: colorOverrides.textColor ?? theme.colors.gray[0] } - : undefined - } - // @ts-ignore: transparent variant does work - variant="transparent" - size="lg" - > - - {abbreviateNumber(favorites)} - - - ) : null} - {downloads != null ? ( - } - icon={} - sx={ - colorOverrides - ? { color: colorOverrides.textColor ?? theme.colors.gray[0] } - : undefined - } - // @ts-ignore: transparent variant does work - variant="transparent" - size="lg" - > - - {abbreviateNumber(downloads)} - - - ) : null} - {answers != null && answers > 0 ? ( - } - icon={} - sx={ - colorOverrides - ? { color: colorOverrides.textColor ?? theme.colors.gray[0] } - : undefined - } - // @ts-ignore: transparent variant does work - variant="transparent" - size="lg" - > - - {abbreviateNumber(answers)} - - - ) : null} - - + + {uploads != null ? ( + } + label="Uploads" + value={abbreviateNumber(uploads)} + /> + ) : null} + {followers != null ? ( + } + label="Followers" + value={abbreviateNumber(followers)} + /> + ) : null} + {favorites != null ? ( + } + label="Likes" + value={abbreviateNumber(favorites)} + /> + ) : null} + {downloads != null ? ( + } + label="Downloads" + value={abbreviateNumber(downloads)} + /> + ) : null} + {answers != null && answers > 0 ? ( + } + label="Answers" + value={abbreviateNumber(answers)} + /> + ) : null} ); } diff --git a/src/pages/bounties/[id]/entries/[entryId]/index.tsx b/src/pages/bounties/[id]/entries/[entryId]/index.tsx index d80dac4e48..a6fc5e8e24 100644 --- a/src/pages/bounties/[id]/entries/[entryId]/index.tsx +++ b/src/pages/bounties/[id]/entries/[entryId]/index.tsx @@ -64,7 +64,7 @@ import { IconDotsVertical } from '@tabler/icons-react'; import { ReportMenuItem } from '~/components/MenuItems/ReportMenuItem'; import { ReportEntity } from '~/server/schema/report.schema'; import { openContext } from '~/providers/CustomModalsProvider'; -import { CreatorCardV2 } from '~/components/CreatorCard/CreatorCard'; +import { SmartCreatorCard } from '~/components/CreatorCard/CreatorCard'; import { formatDate } from '~/utils/date-helpers'; import { TrackView } from '~/components/TrackView/TrackView'; import { RenderHtml } from '~/components/RenderHtml/RenderHtml'; @@ -262,7 +262,7 @@ export default function BountyEntryDetailsPage({ )} - + )} diff --git a/src/server/services/feature-flags.service.ts b/src/server/services/feature-flags.service.ts index 56c186e0a4..1903821d28 100644 --- a/src/server/services/feature-flags.service.ts +++ b/src/server/services/feature-flags.service.ts @@ -89,6 +89,7 @@ const featureFlags = createFeatureFlags({ vault: ['mod'], draftMode: ['mod'], membershipsV2: ['mod'], + cosmeticShop: ['mod'], }); export const featureFlagKeys = Object.keys(featureFlags) as FeatureFlagKey[];