mirror of
https://github.com/stoatchat/for-legacy-web.git
synced 2026-03-07 01:15:28 +00:00
Port friends menu over.
This commit is contained in:
@@ -12,7 +12,7 @@ import { AppContext } from "../../revoltjs/RevoltClient";
|
||||
interface Props {
|
||||
onClose: () => void;
|
||||
question: Children;
|
||||
field: Children;
|
||||
field?: Children;
|
||||
defaultValue?: string;
|
||||
callback: (value: string) => Promise<void>;
|
||||
}
|
||||
@@ -53,9 +53,9 @@ export function InputModal({
|
||||
]}
|
||||
onClose={onClose}
|
||||
>
|
||||
<Overline error={error} block>
|
||||
{ field ? <Overline error={error} block>
|
||||
{field}
|
||||
</Overline>
|
||||
</Overline> : (error && <Overline error={error} type="error" block />) }
|
||||
<InputBox
|
||||
value={value}
|
||||
onChange={e => setValue(e.currentTarget.value)}
|
||||
@@ -65,7 +65,7 @@ export function InputModal({
|
||||
}
|
||||
|
||||
type SpecialProps = { onClose: () => void } & (
|
||||
{ type: "create_group" | "create_server" | "set_custom_status" } |
|
||||
{ type: "create_group" | "create_server" | "set_custom_status" | "add_friend" } |
|
||||
{ type: "create_channel", server: string }
|
||||
)
|
||||
|
||||
@@ -144,6 +144,15 @@ export function SpecialInputModal(props: SpecialProps) {
|
||||
}
|
||||
/>;
|
||||
}
|
||||
case "add_friend": {
|
||||
return <InputModal
|
||||
onClose={onClose}
|
||||
question={"Add Friend"}
|
||||
callback={username =>
|
||||
client.users.addFriend(username)
|
||||
}
|
||||
/>;
|
||||
}
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Text } from "preact-i18n";
|
||||
import styles from './Prompt.module.scss';
|
||||
import { Children } from "../../../types/Preact";
|
||||
import { IntermediateContext, useIntermediate } from "../Intermediate";
|
||||
import { useIntermediate } from "../Intermediate";
|
||||
import InputBox from "../../../components/ui/InputBox";
|
||||
import Overline from "../../../components/ui/Overline";
|
||||
import UserIcon from "../../../components/common/UserIcon";
|
||||
@@ -82,7 +82,8 @@ export function SpecialPromptModal(props: SpecialProps) {
|
||||
actions={[
|
||||
{
|
||||
confirmation: true,
|
||||
style: 'contrast-error',
|
||||
contrast: true,
|
||||
error: true,
|
||||
text: <Text id="app.special.modals.actions.delete" />,
|
||||
onClick: async () => {
|
||||
setProcessing(true);
|
||||
@@ -162,7 +163,8 @@ export function SpecialPromptModal(props: SpecialProps) {
|
||||
actions={[
|
||||
{
|
||||
text: <Text id="app.special.modals.actions.kick" />,
|
||||
style: 'contrast-error',
|
||||
contrast: true,
|
||||
error: true,
|
||||
confirmation: true,
|
||||
onClick: async () => {
|
||||
setProcessing(true);
|
||||
@@ -200,7 +202,8 @@ export function SpecialPromptModal(props: SpecialProps) {
|
||||
actions={[
|
||||
{
|
||||
text: <Text id="app.special.modals.actions.ban" />,
|
||||
style: 'contrast-error',
|
||||
contrast: true,
|
||||
error: true,
|
||||
confirmation: true,
|
||||
onClick: async () => {
|
||||
setProcessing(true);
|
||||
|
||||
Reference in New Issue
Block a user