cleanup
This commit is contained in:
parent
d3b18bbcd2
commit
47569d2ffa
@ -29,7 +29,7 @@ export function openGuildProfileModal(guild: Guild) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const enum TabsE {
|
const enum Tabs {
|
||||||
ServerInfo,
|
ServerInfo,
|
||||||
Friends,
|
Friends,
|
||||||
BlockedUsers
|
BlockedUsers
|
||||||
@ -48,6 +48,11 @@ const fetched = {
|
|||||||
blocked: false
|
blocked: false
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const dateFormat = new Intl.DateTimeFormat(void 0, { timeStyle: "short", dateStyle: "medium" });
|
||||||
|
function renderTimestampFromId(id: string) {
|
||||||
|
return dateFormat.format(SnowflakeUtils.extractTimestamp(id));
|
||||||
|
}
|
||||||
|
|
||||||
function GuildProfileModal({ guild }: GuildProps) {
|
function GuildProfileModal({ guild }: GuildProps) {
|
||||||
const [friendCount, setFriendCount] = useState<number>();
|
const [friendCount, setFriendCount] = useState<number>();
|
||||||
const [blockedCount, setBlockedCount] = useState<number>();
|
const [blockedCount, setBlockedCount] = useState<number>();
|
||||||
@ -57,7 +62,7 @@ function GuildProfileModal({ guild }: GuildProps) {
|
|||||||
fetched.blocked = false;
|
fetched.blocked = false;
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const [currentTab, setCurrentTab] = useState(TabsE.ServerInfo);
|
const [currentTab, setCurrentTab] = useState(Tabs.ServerInfo);
|
||||||
|
|
||||||
const bannerUrl = guild.banner && IconUtils.getGuildBannerURL({
|
const bannerUrl = guild.banner && IconUtils.getGuildBannerURL({
|
||||||
id: guild.id,
|
id: guild.id,
|
||||||
@ -73,7 +78,7 @@ function GuildProfileModal({ guild }: GuildProps) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={cl("root")}>
|
<div className={cl("root")}>
|
||||||
{bannerUrl && currentTab === TabsE.ServerInfo && (
|
{bannerUrl && currentTab === Tabs.ServerInfo && (
|
||||||
<img
|
<img
|
||||||
className={cl("banner")}
|
className={cl("banner")}
|
||||||
src={bannerUrl}
|
src={bannerUrl}
|
||||||
@ -106,40 +111,35 @@ function GuildProfileModal({ guild }: GuildProps) {
|
|||||||
onItemSelect={setCurrentTab}
|
onItemSelect={setCurrentTab}
|
||||||
>
|
>
|
||||||
<TabBar.Item
|
<TabBar.Item
|
||||||
className={cl("tab", { selected: currentTab === TabsE.ServerInfo })}
|
className={cl("tab", { selected: currentTab === Tabs.ServerInfo })}
|
||||||
id={TabsE.ServerInfo}
|
id={Tabs.ServerInfo}
|
||||||
>
|
>
|
||||||
Server Info
|
Server Info
|
||||||
</TabBar.Item>
|
</TabBar.Item>
|
||||||
<TabBar.Item
|
<TabBar.Item
|
||||||
className={cl("tab", { selected: currentTab === TabsE.Friends })}
|
className={cl("tab", { selected: currentTab === Tabs.Friends })}
|
||||||
id={TabsE.Friends}
|
id={Tabs.Friends}
|
||||||
>
|
>
|
||||||
Friends{friendCount !== undefined ? ` (${friendCount})` : ""}
|
Friends{friendCount !== undefined ? ` (${friendCount})` : ""}
|
||||||
</TabBar.Item>
|
</TabBar.Item>
|
||||||
<TabBar.Item
|
<TabBar.Item
|
||||||
className={cl("tab", { selected: currentTab === TabsE.BlockedUsers })}
|
className={cl("tab", { selected: currentTab === Tabs.BlockedUsers })}
|
||||||
id={TabsE.BlockedUsers}
|
id={Tabs.BlockedUsers}
|
||||||
>
|
>
|
||||||
Blocked Users{blockedCount !== undefined ? ` (${blockedCount})` : ""}
|
Blocked Users{blockedCount !== undefined ? ` (${blockedCount})` : ""}
|
||||||
</TabBar.Item>
|
</TabBar.Item>
|
||||||
</TabBar>
|
</TabBar>
|
||||||
|
|
||||||
<div className={cl("tab-content")}>
|
<div className={cl("tab-content")}>
|
||||||
{currentTab === TabsE.ServerInfo && <ServerInfoTab guild={guild} />}
|
{currentTab === Tabs.ServerInfo && <ServerInfoTab guild={guild} />}
|
||||||
{currentTab === TabsE.Friends && <FriendsTab guild={guild} setCount={setFriendCount} />}
|
{currentTab === Tabs.Friends && <FriendsTab guild={guild} setCount={setFriendCount} />}
|
||||||
{currentTab === TabsE.BlockedUsers && <BlockedUsersTab guild={guild} setCount={setBlockedCount} />}
|
{currentTab === Tabs.BlockedUsers && <BlockedUsersTab guild={guild} setCount={setBlockedCount} />}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const dateFormat = new Intl.DateTimeFormat(void 0, { timeStyle: "short", dateStyle: "medium" });
|
|
||||||
function renderTimestampFromId(id: string) {
|
|
||||||
return dateFormat.format(SnowflakeUtils.extractTimestamp(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
function Owner(guildId: string, owner: User) {
|
function Owner(guildId: string, owner: User) {
|
||||||
const guildAvatar = GuildMemberStore.getMember(guildId, owner.id)?.avatar;
|
const guildAvatar = GuildMemberStore.getMember(guildId, owner.id)?.avatar;
|
||||||
const ownerAvatarUrl =
|
const ownerAvatarUrl =
|
||||||
|
Loading…
Reference in New Issue
Block a user