chore(refactor): rename context/modals to controllers/modals

This commit is contained in:
Paul Makles 2022-06-27 17:56:06 +01:00
parent 95ebd935ed
commit 1cfcb20d4d
38 changed files with 39 additions and 31 deletions

2
external/lang vendored

@ -1 +1 @@
Subproject commit 50838167d7d253de9d08715e6a6070c3ddc9fcc2
Subproject commit def08f210e9edc4f203cb38611fd270761102860

View file

@ -24,7 +24,6 @@ import {
import { useApplicationState } from "../../../mobx/State";
import { Reply } from "../../../mobx/stores/MessageQueue";
import { modalController } from "../../../context/modals";
import {
FileUploader,
grabFiles,
@ -33,6 +32,7 @@ import {
import { AppContext } from "../../../context/revoltjs/RevoltClient";
import { takeError } from "../../../context/revoltjs/util";
import { modalController } from "../../../controllers/modals/ModalController";
import AutoComplete, { useAutoComplete } from "../AutoComplete";
import { PermissionTooltip } from "../Tooltip";
import FilePreview from "./bars/FilePreview";

View file

@ -6,12 +6,13 @@ import { useContext } from "preact/hooks";
import { CategoryButton } from "@revoltchat/ui";
import { modalController } from "../../../context/modals";
import {
LogOutContext,
useClient,
} from "../../../context/revoltjs/RevoltClient";
import { modalController } from "../../../controllers/modals/ModalController";
export default function AccountManagement() {
const logOut = useContext(LogOutContext);
const client = useClient();

View file

@ -12,13 +12,14 @@ import {
HiddenValue,
} from "@revoltchat/ui";
import { modalController } from "../../../context/modals";
import {
ClientStatus,
StatusContext,
useClient,
} from "../../../context/revoltjs/RevoltClient";
import { modalController } from "../../../controllers/modals/ModalController";
export default observer(() => {
const client = useClient();
const status = useContext(StatusContext);

View file

@ -7,7 +7,6 @@ import { useCallback, useContext, useEffect, useState } from "preact/hooks";
import { Category, CategoryButton, Error, Tip } from "@revoltchat/ui";
import { modalController } from "../../../context/modals";
import {
ClientStatus,
StatusContext,
@ -15,6 +14,8 @@ import {
} from "../../../context/revoltjs/RevoltClient";
import { takeError } from "../../../context/revoltjs/util";
import { modalController } from "../../../controllers/modals/ModalController";
/**
* Temporary helper function for Axios config
* @param token Token

View file

@ -0,0 +1,2 @@
hello do not touch `intermediate` or `revoltjs` folders
they are being rewritten

View file

@ -8,11 +8,11 @@ import { Preloader, UIProvider } from "@revoltchat/ui";
import { hydrateState } from "../mobx/State";
import ModalRenderer from "../controllers/modals/ModalRenderer";
import Locale from "./Locale";
import Theme from "./Theme";
import { history } from "./history";
import Intermediate from "./intermediate/Intermediate";
import ModalRenderer from "./modals/ModalRenderer";
import Client from "./revoltjs/RevoltClient";
import SyncManager from "./revoltjs/SyncManager";

View file

@ -18,7 +18,7 @@ import { determineLink } from "../../lib/links";
import { useApplicationState } from "../../mobx/State";
import { modalController } from "../modals";
import { modalController } from "../../controllers/modals/ModalController";
import Modals from "./Modals";
export type Screen =

View file

@ -13,8 +13,8 @@ import { determineFileSize } from "../../lib/fileSize";
import { useApplicationState } from "../../mobx/State";
import { modalController } from "../../controllers/modals/ModalController";
import { useIntermediate } from "../intermediate/Intermediate";
import { modalController } from "../modals";
import { AppContext } from "./RevoltClient";
import { takeError } from "./util";

View file

@ -9,7 +9,7 @@ import { Preloader } from "@revoltchat/ui";
import { useApplicationState } from "../../mobx/State";
import { modalController } from "../modals";
import { modalController } from "../../controllers/modals/ModalController";
import { registerEvents } from "./events";
import { takeError } from "./util";

View file

@ -10,10 +10,11 @@ import { ulid } from "ulid";
import { determineLink } from "../../lib/links";
import { getApplicationState, useApplicationState } from "../../mobx/State";
import { getApplicationState } from "../../mobx/State";
import { history } from "../../context/history";
import { __thisIsAHack } from "../../context/intermediate/Intermediate";
import { history } from "../history";
import { __thisIsAHack } from "../intermediate/Intermediate";
// import { determineLink } from "../../lib/links";
import Changelog from "./components/Changelog";
import Clipboard from "./components/Clipboard";

View file

@ -2,7 +2,7 @@ import { observer } from "mobx-react-lite";
import { useEffect } from "preact/hooks";
import { modalController } from ".";
import { modalController } from "./ModalController";
export default observer(() => {
useEffect(() => {

View file

@ -7,8 +7,8 @@ import { Modal } from "@revoltchat/ui";
import { noopTrue } from "../../../lib/js";
import { modalController } from "..";
import { toConfig } from "../../../components/settings/account/MultiFactorAuthentication";
import { modalController } from "../ModalController";
import { ModalProps } from "../types";
/**

View file

@ -9,9 +9,10 @@ import { noopTrue } from "../../../lib/js";
import { useApplicationState } from "../../../mobx/State";
import { AppContext } from "../../../context/revoltjs/RevoltClient";
import { takeError } from "../../../context/revoltjs/util";
import FormField from "../../../pages/login/FormField";
import { AppContext } from "../../revoltjs/RevoltClient";
import { takeError } from "../../revoltjs/util";
import { ModalProps } from "../types";
interface FormInputs {

View file

@ -19,7 +19,8 @@ import {
import { noop } from "../../../lib/js";
import { FileUploader } from "../../revoltjs/FileUploads";
import { FileUploader } from "../../../context/revoltjs/FileUploads";
import { ModalProps } from "../types";
const Preview = styled(Centred)`

View file

@ -28,7 +28,6 @@ import { QueuedMessage } from "../mobx/stores/MessageQueue";
import { NotificationState } from "../mobx/stores/NotificationOptions";
import { Screen, useIntermediate } from "../context/intermediate/Intermediate";
import { modalController } from "../context/modals";
import {
AppContext,
ClientStatus,
@ -39,6 +38,7 @@ import CMNotifications from "./contextmenu/CMNotifications";
import Tooltip from "../components/common/Tooltip";
import UserStatus from "../components/common/user/UserStatus";
import { modalController } from "../controllers/modals/ModalController";
import { internalEmit } from "./eventEmitter";
import { getRenderer } from "./renderer/Singleton";

View file

@ -1,8 +1,7 @@
import { action, makeAutoObservable, runInAction } from "mobx";
import { modalController } from "../../context/modals";
import { latestChangelog } from "../../assets/changelogs";
import { modalController } from "../../controllers/modals/ModalController";
import Persistent from "../interfaces/Persistent";
import Store from "../interfaces/Store";
import Syncable from "../interfaces/Syncable";

View file

@ -6,13 +6,14 @@ import { useContext, useEffect } from "preact/hooks";
import { Header } from "@revoltchat/ui";
import { modalController } from "../context/modals";
import {
AppContext,
ClientStatus,
StatusContext,
} from "../context/revoltjs/RevoltClient";
import { modalController } from "../controllers/modals/ModalController";
export default function Open() {
const history = useHistory();
const client = useContext(AppContext);

View file

@ -13,13 +13,13 @@ import { TextReact } from "../../lib/i18n";
import { isTouchscreenDevice } from "../../lib/isTouchscreenDevice";
import { useIntermediate } from "../../context/intermediate/Intermediate";
import { modalController } from "../../context/modals";
import { useClient } from "../../context/revoltjs/RevoltClient";
import CollapsibleSection from "../../components/common/CollapsibleSection";
import Tooltip from "../../components/common/Tooltip";
import UserIcon from "../../components/common/user/UserIcon";
import { PageHeader } from "../../components/ui/Header";
import { modalController } from "../../controllers/modals/ModalController";
import { Friend } from "./Friend";
export default observer(() => {

View file

@ -4,8 +4,8 @@ import { API } from "revolt.js";
import { useApplicationState } from "../../../mobx/State";
import { useIntermediate } from "../../../context/intermediate/Intermediate";
import { modalController } from "../../../context/modals";
import { modalController } from "../../../controllers/modals/ModalController";
import { Form } from "./Form";
export function FormLogin() {

View file

@ -13,9 +13,8 @@ import { isTouchscreenDevice } from "../../lib/isTouchscreenDevice";
import { useApplicationState } from "../../mobx/State";
import { modalController } from "../../context/modals";
import ButtonItem from "../../components/navigation/items/ButtonItem";
import { modalController } from "../../controllers/modals/ModalController";
interface Props {
pages: {

View file

@ -35,7 +35,6 @@ import { LineDivider } from "@revoltchat/ui";
import { useApplicationState } from "../../mobx/State";
import { useIntermediate } from "../../context/intermediate/Intermediate";
import { modalController } from "../../context/modals";
import RequiresOnline from "../../context/revoltjs/RequiresOnline";
import { AppContext, LogOutContext } from "../../context/revoltjs/RevoltClient";
@ -43,6 +42,7 @@ import UserIcon from "../../components/common/user/UserIcon";
import { Username } from "../../components/common/user/UserShort";
import UserStatus from "../../components/common/user/UserStatus";
import ButtonItem from "../../components/navigation/items/ButtonItem";
import { modalController } from "../../controllers/modals/ModalController";
import { GIT_BRANCH, GIT_REVISION, REPO_URL } from "../../revision";
import { APP_VERSION } from "../../version";
import { GenericSettings } from "./GenericSettings";

View file

@ -25,7 +25,6 @@ import { useTranslation } from "../../../lib/i18n";
import { stopPropagation } from "../../../lib/stopPropagation";
import { useIntermediate } from "../../../context/intermediate/Intermediate";
import { modalController } from "../../../context/modals";
import { FileUploader } from "../../../context/revoltjs/FileUploads";
import { useClient } from "../../../context/revoltjs/RevoltClient";
@ -35,6 +34,7 @@ import AutoComplete, {
import CollapsibleSection from "../../../components/common/CollapsibleSection";
import Tooltip from "../../../components/common/Tooltip";
import UserIcon from "../../../components/common/user/UserIcon";
import { modalController } from "../../../controllers/modals/ModalController";
interface Data {
_id: string;

View file

@ -10,9 +10,10 @@ import { urlBase64ToUint8Array } from "../../../lib/conversion";
import { useApplicationState } from "../../../mobx/State";
import { modalController } from "../../../context/modals";
import { AppContext } from "../../../context/revoltjs/RevoltClient";
import { modalController } from "../../../controllers/modals/ModalController";
export const Notifications = observer(() => {
const client = useContext(AppContext);
const settings = useApplicationState().settings;

View file

@ -27,9 +27,10 @@ import {
} from "@revoltchat/ui";
import { dayjs } from "../../../context/Locale";
import { modalController } from "../../../context/modals";
import { AppContext } from "../../../context/revoltjs/RevoltClient";
import { modalController } from "../../../controllers/modals/ModalController";
dayjs.extend(relativeTime);
export function Sessions() {

View file

@ -7,8 +7,7 @@ import { useEffect, useState } from "preact/hooks";
import { internalEmit, internalSubscribe } from "./lib/eventEmitter";
import { modalController } from "./context/modals";
import { modalController } from "./controllers/modals/ModalController";
import { APP_VERSION } from "./version";
const INTERVAL_HOUR = 36e5;