mirror of
https://github.com/stoatchat/for-legacy-web.git
synced 2026-03-07 09:25:27 +00:00
chore: delete intermediate
This commit is contained in:
@@ -3,8 +3,6 @@ import { API, Client } from "revolt.js";
|
||||
|
||||
import { state } from "../../mobx/State";
|
||||
|
||||
import { __thisIsAHack } from "../../context/intermediate/Intermediate";
|
||||
|
||||
import { modalController } from "../modals/ModalController";
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
import { observer } from "mobx-react-lite";
|
||||
import { Prompt, useHistory } from "react-router-dom";
|
||||
|
||||
import { useEffect } from "preact/hooks";
|
||||
|
||||
import { modalController } from "./ModalController";
|
||||
|
||||
export default observer(() => {
|
||||
const history = useHistory();
|
||||
|
||||
useEffect(() => {
|
||||
function keyUp(event: KeyboardEvent) {
|
||||
if (event.key === "Escape") {
|
||||
@@ -18,5 +21,22 @@ export default observer(() => {
|
||||
return () => document.removeEventListener("keyup", keyUp);
|
||||
}, []);
|
||||
|
||||
return modalController.rendered;
|
||||
return (
|
||||
<>
|
||||
{modalController.rendered}
|
||||
<Prompt
|
||||
when={modalController.isVisible}
|
||||
message={(_, action) => {
|
||||
if (action === "POP") {
|
||||
modalController.pop("close");
|
||||
setTimeout(() => history.push(history.location), 0);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
});
|
||||
|
||||
32
src/controllers/modals/components/ImportTheme.tsx
Normal file
32
src/controllers/modals/components/ImportTheme.tsx
Normal file
@@ -0,0 +1,32 @@
|
||||
import { Text } from "preact-i18n";
|
||||
|
||||
import { ModalForm } from "@revoltchat/ui";
|
||||
|
||||
import { state } from "../../../mobx/State";
|
||||
|
||||
import { ModalProps } from "../types";
|
||||
|
||||
/**
|
||||
* Import theme modal
|
||||
*/
|
||||
export default function ImportTheme({ ...props }: ModalProps<"import_theme">) {
|
||||
return (
|
||||
<ModalForm
|
||||
{...props}
|
||||
title={<Text id="app.settings.pages.appearance.import_theme" />}
|
||||
schema={{
|
||||
data: "text",
|
||||
}}
|
||||
data={{
|
||||
data: {
|
||||
field: (
|
||||
<Text id="app.settings.pages.appearance.theme_data" />
|
||||
) as React.ReactChild,
|
||||
},
|
||||
}}
|
||||
callback={async ({ data }) =>
|
||||
state.settings.theme.hydrate(JSON.parse(data))
|
||||
}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -176,6 +176,9 @@ export type Modal = {
|
||||
type: "create_category";
|
||||
target: Server;
|
||||
}
|
||||
| {
|
||||
type: "import_theme";
|
||||
}
|
||||
);
|
||||
|
||||
export type ModalProps<T extends Modal["type"]> = Modal & { type: T } & {
|
||||
|
||||
Reference in New Issue
Block a user