mirror of
https://github.com/stoatchat/for-legacy-web.git
synced 2026-03-07 01:15:28 +00:00
feat(sessions): Add confirmation prompt (#575)
Reopening of issue #572 Fixes issue #42 Translations added on PR 31 of revolt/translations Co-authored-by: Paul Makles <paulmakles@gmail.com>
This commit is contained in:
@@ -24,6 +24,7 @@ export type Screen =
|
||||
| { id: "clipboard"; text: string }
|
||||
| { id: "token_reveal"; token: string; username: string }
|
||||
| { id: "external_link_prompt"; link: string }
|
||||
| { id: "sessions", confirm: () => void }
|
||||
| {
|
||||
id: "_prompt";
|
||||
question: Children;
|
||||
|
||||
@@ -9,7 +9,8 @@ import { InputModal } from "./modals/Input";
|
||||
import { OnboardingModal } from "./modals/Onboarding";
|
||||
import { PromptModal } from "./modals/Prompt";
|
||||
import { SignedOutModal } from "./modals/SignedOut";
|
||||
import {ExternalLinkModal} from "./modals/ExternalLinkPrompt";
|
||||
import { ExternalLinkModal} from "./modals/ExternalLinkPrompt";
|
||||
import { SessionsModal } from "./modals/SessionsPrompt";
|
||||
import { TokenRevealModal } from "./modals/TokenReveal";
|
||||
|
||||
export interface Props {
|
||||
@@ -40,6 +41,8 @@ export default function Modals({ screen, openScreen }: Props) {
|
||||
return <OnboardingModal onClose={onClose} {...screen} />;
|
||||
case "external_link_prompt":
|
||||
return <ExternalLinkModal onClose={onClose} {...screen} />;
|
||||
case "sessions":
|
||||
return <SessionsModal onClose={onClose} {...screen} />;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
38
src/context/intermediate/modals/SessionsPrompt.tsx
Normal file
38
src/context/intermediate/modals/SessionsPrompt.tsx
Normal file
@@ -0,0 +1,38 @@
|
||||
import { Text } from "preact-i18n";
|
||||
|
||||
import Modal from "../../../components/ui/Modal";
|
||||
|
||||
interface Props {
|
||||
onClose: () => void;
|
||||
confirm: () => void;
|
||||
}
|
||||
|
||||
export function SessionsModal({ onClose, confirm}: Props) {
|
||||
return (
|
||||
<Modal
|
||||
visible={true}
|
||||
onClose={onClose}
|
||||
title={<Text id={"app.special.modals.sessions.title"} />}
|
||||
actions={[
|
||||
{
|
||||
onClick: () => {
|
||||
onClose()
|
||||
},
|
||||
confirmation: true,
|
||||
contrast: true,
|
||||
accent: true,
|
||||
children: <Text id="app.special.modals.actions.back"/>
|
||||
},
|
||||
{
|
||||
onClick: () => {
|
||||
confirm()
|
||||
onClose()
|
||||
},
|
||||
confirmation: true,
|
||||
children: <Text id="app.special.modals.sessions.accept"/>
|
||||
}
|
||||
]}>
|
||||
<Text id="app.special.modals.sessions.short" /> <br />
|
||||
</Modal>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user