mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-22 07:00:58 -05:00
feat: add correct submit buttons to form modals
This commit is contained in:
parent
f9c6f5cd9d
commit
705dcd001b
16 changed files with 91 additions and 34 deletions
|
@ -73,7 +73,7 @@
|
|||
"@hcaptcha/react-hcaptcha": "^0.3.6",
|
||||
"@insertish/vite-plugin-babel-macros": "^1.0.5",
|
||||
"@preact/preset-vite": "^2.0.0",
|
||||
"@revoltchat/ui": "1.0.65",
|
||||
"@revoltchat/ui": "1.0.69",
|
||||
"@rollup/plugin-replace": "^2.4.2",
|
||||
"@styled-icons/boxicons-logos": "^10.38.0",
|
||||
"@styled-icons/boxicons-regular": "^10.38.0",
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import { Text } from "preact-i18n";
|
||||
|
||||
import { ModalForm } from "@revoltchat/ui";
|
||||
|
||||
import { noop } from "../../../lib/js";
|
||||
|
@ -26,6 +28,9 @@ export default function AddFriend({ ...props }: ModalProps<"add_friend">) {
|
|||
callback={({ username }) =>
|
||||
client.api.post(`/users/friend`, { username }).then(noop)
|
||||
}
|
||||
submit={{
|
||||
children: <Text id="app.special.modals.actions.ok" />,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -41,6 +41,10 @@ export default function BanMember({
|
|||
callback={async ({ reason }) =>
|
||||
void (await member.server!.banUser(member._id.user, { reason }))
|
||||
}
|
||||
submit={{
|
||||
palette: "error",
|
||||
children: <Text id="app.special.modals.actions.ban" />,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -96,6 +96,12 @@ export default function Confirmation(
|
|||
break;
|
||||
}
|
||||
}}
|
||||
submit={{
|
||||
palette: "error",
|
||||
children: (
|
||||
<Text id={`app.special.modals.actions.${event[1]}`} />
|
||||
),
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -39,6 +39,9 @@ export default function CreateCategory({
|
|||
],
|
||||
});
|
||||
}}
|
||||
submit={{
|
||||
children: <Text id="app.special.modals.actions.create" />,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -67,6 +67,9 @@ export default function CreateChannel({
|
|||
);
|
||||
}
|
||||
}}
|
||||
submit={{
|
||||
children: <Text id="app.special.modals.actions.create" />,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -40,6 +40,9 @@ export default function CreateGroup({ ...props }: ModalProps<"create_group">) {
|
|||
|
||||
history.push(`/channel/${group._id}`);
|
||||
}}
|
||||
submit={{
|
||||
children: <Text id="app.special.modals.actions.create" />,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -71,6 +71,18 @@ export default function CreateInvite({
|
|||
},
|
||||
}}
|
||||
callback={noopAsync}
|
||||
submit={{
|
||||
children: <Text id="app.special.modals.actions.ok" />,
|
||||
}}
|
||||
actions={[
|
||||
{
|
||||
children: <Text id="app.context_menu.copy_link" />,
|
||||
onClick: () =>
|
||||
modalController.writeText(
|
||||
`${window.location.protocol}//${window.location.host}/invite/${code}`,
|
||||
),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -30,6 +30,9 @@ export default function CreateRole({
|
|||
const role = await server.createRole(name);
|
||||
callback(role.id);
|
||||
}}
|
||||
submit={{
|
||||
children: <Text id="app.special.modals.actions.create" />,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -52,6 +52,9 @@ export default function CreateServer({
|
|||
|
||||
history.push(`/server/${server._id}`);
|
||||
}}
|
||||
submit={{
|
||||
children: <Text id="app.special.modals.actions.create" />,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -38,6 +38,9 @@ export default function CustomStatus({
|
|||
},
|
||||
})
|
||||
}
|
||||
submit={{
|
||||
children: <Text id="app.special.modals.actions.save" />,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -30,6 +30,10 @@ export default function DeleteMessage({
|
|||
},
|
||||
}}
|
||||
callback={() => target.delete()}
|
||||
submit={{
|
||||
palette: "error",
|
||||
children: <Text id="app.special.modals.actions.delete" />,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -27,6 +27,9 @@ export default function ImportTheme({ ...props }: ModalProps<"import_theme">) {
|
|||
callback={async ({ data }) =>
|
||||
state.settings.theme.hydrate(JSON.parse(data))
|
||||
}
|
||||
submit={{
|
||||
children: <Text id="app.special.modals.actions.ok" />,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -33,6 +33,10 @@ export default function KickMember({
|
|||
},
|
||||
}}
|
||||
callback={() => member.kick()}
|
||||
submit={{
|
||||
palette: "error",
|
||||
children: <Text id="app.special.modals.actions.kick" />,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -669,14 +669,17 @@ export default function ContextMenus() {
|
|||
userId !== uid &&
|
||||
uid !== server.owner
|
||||
) {
|
||||
const member = client.members.getKey({
|
||||
server: server._id,
|
||||
user: user!._id,
|
||||
})!;
|
||||
|
||||
if (member) {
|
||||
if (serverPermissions & Permission.KickMembers)
|
||||
generateAction(
|
||||
{
|
||||
action: "kick_member",
|
||||
target: client.members.getKey({
|
||||
server: server._id,
|
||||
user: user!._id,
|
||||
})!,
|
||||
target: member,
|
||||
},
|
||||
undefined, // this is needed because generateAction uses positional, not named parameters
|
||||
undefined,
|
||||
|
@ -688,10 +691,7 @@ export default function ContextMenus() {
|
|||
generateAction(
|
||||
{
|
||||
action: "ban_member",
|
||||
target: client.members.getKey({
|
||||
server: server._id,
|
||||
user: user!._id,
|
||||
})!,
|
||||
target: member,
|
||||
},
|
||||
undefined,
|
||||
undefined,
|
||||
|
@ -700,6 +700,7 @@ export default function ContextMenus() {
|
|||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (queued) {
|
||||
generateAction({
|
||||
|
|
10
yarn.lock
10
yarn.lock
|
@ -2231,9 +2231,9 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@revoltchat/ui@npm:1.0.65":
|
||||
version: 1.0.65
|
||||
resolution: "@revoltchat/ui@npm:1.0.65"
|
||||
"@revoltchat/ui@npm:1.0.69":
|
||||
version: 1.0.69
|
||||
resolution: "@revoltchat/ui@npm:1.0.69"
|
||||
dependencies:
|
||||
"@styled-icons/boxicons-logos": ^10.38.0
|
||||
"@styled-icons/boxicons-regular": ^10.38.0
|
||||
|
@ -2247,7 +2247,7 @@ __metadata:
|
|||
react-virtuoso: ^2.12.0
|
||||
peerDependencies:
|
||||
revolt.js: "*"
|
||||
checksum: 34a52672aa3aca1c62d884c62f2c85c0100b6adb21b7d01053e74e96cfa95cb76f125e1ca1f46afc586a8730b273746486525199f66969338e6c84ab1f21e7cd
|
||||
checksum: bb67870911689d7dccd82f96affdb0e3e89b2e688d4a7403ee9bbb6a0245dfc296f35636ababd5ed6b43a3ce26777cee03c453728088b4a29fed350dcc89ea37
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
|
@ -3554,7 +3554,7 @@ __metadata:
|
|||
"@hcaptcha/react-hcaptcha": ^0.3.6
|
||||
"@insertish/vite-plugin-babel-macros": ^1.0.5
|
||||
"@preact/preset-vite": ^2.0.0
|
||||
"@revoltchat/ui": 1.0.65
|
||||
"@revoltchat/ui": 1.0.69
|
||||
"@rollup/plugin-replace": ^2.4.2
|
||||
"@styled-icons/boxicons-logos": ^10.38.0
|
||||
"@styled-icons/boxicons-regular": ^10.38.0
|
||||
|
|
Loading…
Reference in a new issue