2021-07-05 11:23:23 +01:00
|
|
|
import { Wrench } from "@styled-icons/boxicons-solid";
|
2021-07-29 12:41:28 +01:00
|
|
|
import { isObservable, isObservableProp } from "mobx";
|
|
|
|
import { observer } from "mobx-react-lite";
|
2021-07-14 14:42:22 +01:00
|
|
|
import { Channels } from "revolt.js/dist/api/objects";
|
2021-07-05 11:23:23 +01:00
|
|
|
|
2021-06-19 20:24:11 +01:00
|
|
|
import { useContext } from "preact/hooks";
|
2021-07-05 11:23:23 +01:00
|
|
|
|
2021-06-19 20:24:11 +01:00
|
|
|
import PaintCounter from "../../lib/PaintCounter";
|
2021-07-05 11:23:23 +01:00
|
|
|
import { TextReact } from "../../lib/i18n";
|
|
|
|
|
2021-06-19 20:24:11 +01:00
|
|
|
import { AppContext } from "../../context/revoltjs/RevoltClient";
|
2021-07-29 12:41:28 +01:00
|
|
|
import { useUserPermission } from "../../context/revoltjs/hooks";
|
2021-07-05 11:23:23 +01:00
|
|
|
|
2021-07-29 12:41:28 +01:00
|
|
|
import UserIcon from "../../components/common/user/UserIcon";
|
2021-07-05 11:23:23 +01:00
|
|
|
import Header from "../../components/ui/Header";
|
2021-06-19 20:24:11 +01:00
|
|
|
|
2021-07-29 12:41:28 +01:00
|
|
|
import { useData } from "../../mobx/State";
|
|
|
|
|
2021-06-19 20:24:11 +01:00
|
|
|
export default function Developer() {
|
2021-07-05 11:25:20 +01:00
|
|
|
// const voice = useContext(VoiceContext);
|
|
|
|
const client = useContext(AppContext);
|
|
|
|
const userPermission = useUserPermission(client.user!._id);
|
2021-06-19 20:24:11 +01:00
|
|
|
|
2021-07-05 11:25:20 +01:00
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<Header placement="primary">
|
|
|
|
<Wrench size="24" />
|
|
|
|
Developer Tab
|
|
|
|
</Header>
|
|
|
|
<div style={{ padding: "16px" }}>
|
|
|
|
<PaintCounter always />
|
|
|
|
</div>
|
|
|
|
<div style={{ padding: "16px" }}>
|
|
|
|
<b>User ID:</b> {client.user!._id} <br />
|
|
|
|
<b>Permission against self:</b> {userPermission} <br />
|
|
|
|
</div>
|
|
|
|
<div style={{ padding: "16px" }}>
|
|
|
|
<TextReact
|
|
|
|
id="login.open_mail_provider"
|
|
|
|
fields={{ provider: <b>GAMING!</b> }}
|
|
|
|
/>
|
|
|
|
</div>
|
2021-07-29 12:41:28 +01:00
|
|
|
<ObserverTest />
|
|
|
|
<ObserverTest2 />
|
|
|
|
<ObserverTest3 />
|
|
|
|
<ObserverTest4 />
|
2021-07-05 11:25:20 +01:00
|
|
|
<div style={{ padding: "16px" }}>
|
|
|
|
{/*<span>
|
2021-06-19 20:24:11 +01:00
|
|
|
<b>Voice Status:</b> {VoiceStatus[voice.status]}
|
|
|
|
</span>
|
|
|
|
<br />
|
|
|
|
<span>
|
|
|
|
<b>Voice Room ID:</b> {voice.roomId || "undefined"}
|
|
|
|
</span>
|
|
|
|
<br />
|
|
|
|
<span>
|
|
|
|
<b>Voice Participants:</b> [
|
|
|
|
{Array.from(voice.participants.keys()).join(", ")}]
|
|
|
|
</span>
|
|
|
|
<br />*/}
|
2021-07-05 11:25:20 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
2021-06-19 20:24:11 +01:00
|
|
|
}
|
2021-07-14 14:42:22 +01:00
|
|
|
|
2021-07-29 12:41:28 +01:00
|
|
|
const ObserverTest = observer(() => {
|
|
|
|
const client = useContext(AppContext);
|
|
|
|
const store = useData();
|
|
|
|
return (
|
|
|
|
<div style={{ padding: "16px" }}>
|
|
|
|
<p>
|
|
|
|
username:{" "}
|
|
|
|
{store.users.get(client.user!._id)?.username ?? "no user!"}
|
|
|
|
<PaintCounter small />
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
});
|
2021-07-14 14:42:22 +01:00
|
|
|
|
2021-07-29 12:41:28 +01:00
|
|
|
const ObserverTest2 = observer(() => {
|
|
|
|
const client = useContext(AppContext);
|
|
|
|
const store = useData();
|
|
|
|
return (
|
|
|
|
<div style={{ padding: "16px" }}>
|
|
|
|
<p>
|
|
|
|
status:{" "}
|
|
|
|
{JSON.stringify(store.users.get(client.user!._id)?.status) ??
|
|
|
|
"none"}
|
|
|
|
<PaintCounter small />
|
|
|
|
</p>
|
|
|
|
</div>
|
2021-07-14 14:42:22 +01:00
|
|
|
);
|
2021-07-29 12:41:28 +01:00
|
|
|
});
|
2021-07-14 14:42:22 +01:00
|
|
|
|
2021-07-29 12:41:28 +01:00
|
|
|
const ObserverTest3 = observer(() => {
|
|
|
|
const client = useContext(AppContext);
|
|
|
|
const store = useData();
|
2021-07-14 14:42:22 +01:00
|
|
|
return (
|
|
|
|
<div style={{ padding: "16px" }}>
|
2021-07-29 12:41:28 +01:00
|
|
|
<p>
|
|
|
|
avatar{" "}
|
|
|
|
<UserIcon
|
|
|
|
size={64}
|
|
|
|
attachment={
|
|
|
|
store.users.get(client.user!._id)?.avatar ?? undefined
|
|
|
|
}
|
|
|
|
/>
|
2021-07-14 14:42:22 +01:00
|
|
|
<PaintCounter small />
|
2021-07-29 12:41:28 +01:00
|
|
|
</p>
|
2021-07-14 14:42:22 +01:00
|
|
|
</div>
|
|
|
|
);
|
2021-07-29 12:41:28 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
const ObserverTest4 = observer(() => {
|
|
|
|
const client = useContext(AppContext);
|
|
|
|
const store = useData();
|
|
|
|
return (
|
|
|
|
<div style={{ padding: "16px" }}>
|
|
|
|
<p>
|
|
|
|
status text:{" "}
|
|
|
|
{JSON.stringify(
|
|
|
|
store.users.get(client.user!._id)?.status?.text,
|
|
|
|
) ?? "none"}
|
|
|
|
<PaintCounter small />
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
});
|