mirror of
https://github.com/stoatchat/for-legacy-web.git
synced 2026-03-07 01:15:28 +00:00
feat: add correct submit buttons to form modals
This commit is contained in:
@@ -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" />,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user