mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-02 19:42:24 -06:00
[chore] Settings refactor 2: the re-refactoring-ing (#2866)
* [chore] Bit more refactoring of settings panel * fix up some remaining things * groovy baby yeah! * remove unused Suspense
This commit is contained in:
parent
7a1e639483
commit
aecf74951c
41 changed files with 1360 additions and 958 deletions
|
|
@ -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>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue