mirror of
https://github.com/revoltchat/revite.git
synced 2024-12-26 23:42:11 -05:00
feat: implement logic for status changer in mobile settings
This commit is contained in:
parent
66d3e7c616
commit
e758b23ac3
1 changed files with 31 additions and 6 deletions
|
@ -25,16 +25,19 @@ import { LIBRARY_VERSION } from "revolt.js";
|
||||||
import styled from "styled-components";
|
import styled from "styled-components";
|
||||||
|
|
||||||
import styles from "./Settings.module.scss";
|
import styles from "./Settings.module.scss";
|
||||||
|
import { openContextMenu } from "preact-context-menu";
|
||||||
import { Text } from "preact-i18n";
|
import { Text } from "preact-i18n";
|
||||||
import { useContext } from "preact/hooks";
|
import { useContext } from "preact/hooks";
|
||||||
|
|
||||||
import { useApplicationState } from "../../mobx/State";
|
import { useApplicationState } from "../../mobx/State";
|
||||||
|
|
||||||
|
import { useIntermediate } from "../../context/intermediate/Intermediate";
|
||||||
import RequiresOnline from "../../context/revoltjs/RequiresOnline";
|
import RequiresOnline from "../../context/revoltjs/RequiresOnline";
|
||||||
import { AppContext, LogOutContext } from "../../context/revoltjs/RevoltClient";
|
import { AppContext, LogOutContext } from "../../context/revoltjs/RevoltClient";
|
||||||
|
|
||||||
import UserIcon from "../../components/common/user/UserIcon";
|
import UserIcon from "../../components/common/user/UserIcon";
|
||||||
import { Username } from "../../components/common/user/UserShort";
|
import { Username } from "../../components/common/user/UserShort";
|
||||||
|
import UserStatus from "../../components/common/user/UserStatus";
|
||||||
import LineDivider from "../../components/ui/LineDivider";
|
import LineDivider from "../../components/ui/LineDivider";
|
||||||
|
|
||||||
import ButtonItem from "../../components/navigation/items/ButtonItem";
|
import ButtonItem from "../../components/navigation/items/ButtonItem";
|
||||||
|
@ -115,6 +118,7 @@ export default observer(() => {
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
const client = useContext(AppContext);
|
const client = useContext(AppContext);
|
||||||
const logout = useContext(LogOutContext);
|
const logout = useContext(LogOutContext);
|
||||||
|
const { openScreen } = useIntermediate();
|
||||||
const experiments = useApplicationState().experiments;
|
const experiments = useApplicationState().experiments;
|
||||||
|
|
||||||
function switchPage(to?: string) {
|
function switchPage(to?: string) {
|
||||||
|
@ -319,17 +323,38 @@ export default observer(() => {
|
||||||
}
|
}
|
||||||
indexHeader={
|
indexHeader={
|
||||||
<AccountHeader>
|
<AccountHeader>
|
||||||
{/*<div className="account">
|
<div className="account">
|
||||||
<UserIcon size={64} target={client.user!} />
|
<UserIcon
|
||||||
|
size={64}
|
||||||
|
target={client.user!}
|
||||||
|
status
|
||||||
|
onClick={() => openContextMenu("Status")}
|
||||||
|
/>
|
||||||
<div className="details">
|
<div className="details">
|
||||||
<Username user={client.user!} prefixAt />
|
<Username user={client.user!} prefixAt />
|
||||||
Status goes here
|
<UserStatus user={client.user!} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="statusChanger">
|
<div className="statusChanger">
|
||||||
<div className="status">Change your status...</div>
|
<a
|
||||||
<Trash size={24} />
|
className="status"
|
||||||
</div>*/}
|
onClick={() =>
|
||||||
|
openScreen({
|
||||||
|
id: "special_input",
|
||||||
|
type: "set_custom_status",
|
||||||
|
})
|
||||||
|
}>
|
||||||
|
Change your status...
|
||||||
|
</a>
|
||||||
|
{client.user!.status?.text && (
|
||||||
|
<Trash
|
||||||
|
size={24}
|
||||||
|
onClick={() =>
|
||||||
|
client.users.edit({ remove: "StatusText" })
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
</AccountHeader>
|
</AccountHeader>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Reference in a new issue