From: Jay Sitter <jay@jaysitter.com>
Date: Sun, 2 Jul 2023 23:47:12 +0000 (-0400)
Subject: fix: Move getRoleLabelPill to the only component that uses it
X-Git-Url: http://these/git/%7B%60%24%7BghostArchiveUrl%7D/%22%7Burl%7D/static/%24%7Bsubmission.url%7D?a=commitdiff_plain;h=6cb49967c230a9dc33de7967710d5bc83d9b96b3;p=lemmy-ui.git

fix: Move getRoleLabelPill to the only component that uses it
---

diff --git a/src/shared/components/common/user-badges.tsx b/src/shared/components/common/user-badges.tsx
index efd18f5..03a1cae 100644
--- a/src/shared/components/common/user-badges.tsx
+++ b/src/shared/components/common/user-badges.tsx
@@ -1,4 +1,3 @@
-import { getRoleLabelPill } from "@utils/app";
 import classNames from "classnames";
 import { Component } from "inferno";
 import { I18NextService } from "../../services";
@@ -13,6 +12,28 @@ interface UserBadgesProps {
   classNames?: string;
 }
 
+export function getRoleLabelPill({
+  label,
+  tooltip,
+  classes,
+  shrink = true,
+}: {
+  label: string;
+  tooltip: string;
+  classes?: string;
+  shrink?: boolean;
+}) {
+  return (
+    <span
+      className={`badge ${classes ?? "text-bg-light"}`}
+      aria-label={tooltip}
+      data-tippy-content={tooltip}
+    >
+      {shrink ? label[0].toUpperCase() : label}
+    </span>
+  );
+}
+
 export class UserBadges extends Component<UserBadgesProps> {
   render() {
     return (
diff --git a/src/shared/utils/app/get-role-label-pill.tsx b/src/shared/utils/app/get-role-label-pill.tsx
deleted file mode 100644
index b46f249..0000000
--- a/src/shared/utils/app/get-role-label-pill.tsx
+++ /dev/null
@@ -1,21 +0,0 @@
-export default function getRoleLabelPill({
-  label,
-  tooltip,
-  classes,
-  shrink = true,
-}: {
-  label: string;
-  tooltip: string;
-  classes?: string;
-  shrink?: boolean;
-}) {
-  return (
-    <span
-      className={`badge ${classes ?? "text-bg-light"}`}
-      aria-label={tooltip}
-      data-tippy-content={tooltip}
-    >
-      {shrink ? label[0].toUpperCase() : label}
-    </span>
-  );
-}
diff --git a/src/shared/utils/app/index.ts b/src/shared/utils/app/index.ts
index b2b0baa..9993ac7 100644
--- a/src/shared/utils/app/index.ts
+++ b/src/shared/utils/app/index.ts
@@ -29,7 +29,6 @@ import getDataTypeString from "./get-data-type-string";
 import getDepthFromComment from "./get-depth-from-comment";
 import getIdFromProps from "./get-id-from-props";
 import getRecipientIdFromProps from "./get-recipient-id-from-props";
-import getRoleLabelPill from "./get-role-label-pill";
 import getUpdatedSearchId from "./get-updated-search-id";
 import initializeSite from "./initialize-site";
 import insertCommentIntoTree from "./insert-comment-into-tree";
@@ -87,7 +86,6 @@ export {
   getDepthFromComment,
   getIdFromProps,
   getRecipientIdFromProps,
-  getRoleLabelPill,
   getUpdatedSearchId,
   initializeSite,
   insertCommentIntoTree,