summaryrefslogtreecommitdiff
path: root/web/source/settings/views/moderation/reports/username.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'web/source/settings/views/moderation/reports/username.tsx')
-rw-r--r--web/source/settings/views/moderation/reports/username.tsx36
1 files changed, 24 insertions, 12 deletions
diff --git a/web/source/settings/views/moderation/reports/username.tsx b/web/source/settings/views/moderation/reports/username.tsx
index 6fba0b804..294d97e8b 100644
--- a/web/source/settings/views/moderation/reports/username.tsx
+++ b/web/source/settings/views/moderation/reports/username.tsx
@@ -19,8 +19,14 @@
import React from "react";
import { Link } from "wouter";
+import { AdminAccount } from "../../../lib/types/account";
-export default function Username({ user, link = true }) {
+interface UsernameProps {
+ user: AdminAccount;
+ link?: string;
+}
+
+export default function Username({ user, link }: UsernameProps) {
let className = "user";
let isLocal = user.domain == null;
@@ -36,19 +42,25 @@ export default function Username({ user, link = true }) {
? { fa: "fa-home", info: "Local user" }
: { fa: "fa-external-link-square", info: "Remote user" };
- let Element: any = "div";
- let href: any = null;
-
- if (link) {
- Element = Link;
- href = `/settings/admin/accounts/${user.id}`;
- }
-
- return (
- <Element className={className} to={href}>
+ const content = (
+ <>
<span className="acct">@{user.account.acct}</span>
<i className={`fa fa-fw ${icon.fa}`} aria-hidden="true" title={icon.info} />
<span className="sr-only">{icon.info}</span>
- </Element>
+ </>
);
+
+ if (link) {
+ return (
+ <Link className={className} to={link}>
+ {content}
+ </Link>
+ );
+ } else {
+ return (
+ <div className={className}>
+ {content}
+ </div>
+ );
+ }
}