mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-26 00:50:56 -05:00
chore(refactor): rename context/modals
to controllers/modals
This commit is contained in:
parent
95ebd935ed
commit
1cfcb20d4d
38 changed files with 39 additions and 31 deletions
2
external/lang
vendored
2
external/lang
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 50838167d7d253de9d08715e6a6070c3ddc9fcc2
|
Subproject commit def08f210e9edc4f203cb38611fd270761102860
|
|
@ -24,7 +24,6 @@ import {
|
||||||
import { useApplicationState } from "../../../mobx/State";
|
import { useApplicationState } from "../../../mobx/State";
|
||||||
import { Reply } from "../../../mobx/stores/MessageQueue";
|
import { Reply } from "../../../mobx/stores/MessageQueue";
|
||||||
|
|
||||||
import { modalController } from "../../../context/modals";
|
|
||||||
import {
|
import {
|
||||||
FileUploader,
|
FileUploader,
|
||||||
grabFiles,
|
grabFiles,
|
||||||
|
@ -33,6 +32,7 @@ import {
|
||||||
import { AppContext } from "../../../context/revoltjs/RevoltClient";
|
import { AppContext } from "../../../context/revoltjs/RevoltClient";
|
||||||
import { takeError } from "../../../context/revoltjs/util";
|
import { takeError } from "../../../context/revoltjs/util";
|
||||||
|
|
||||||
|
import { modalController } from "../../../controllers/modals/ModalController";
|
||||||
import AutoComplete, { useAutoComplete } from "../AutoComplete";
|
import AutoComplete, { useAutoComplete } from "../AutoComplete";
|
||||||
import { PermissionTooltip } from "../Tooltip";
|
import { PermissionTooltip } from "../Tooltip";
|
||||||
import FilePreview from "./bars/FilePreview";
|
import FilePreview from "./bars/FilePreview";
|
||||||
|
|
|
@ -6,12 +6,13 @@ import { useContext } from "preact/hooks";
|
||||||
|
|
||||||
import { CategoryButton } from "@revoltchat/ui";
|
import { CategoryButton } from "@revoltchat/ui";
|
||||||
|
|
||||||
import { modalController } from "../../../context/modals";
|
|
||||||
import {
|
import {
|
||||||
LogOutContext,
|
LogOutContext,
|
||||||
useClient,
|
useClient,
|
||||||
} from "../../../context/revoltjs/RevoltClient";
|
} from "../../../context/revoltjs/RevoltClient";
|
||||||
|
|
||||||
|
import { modalController } from "../../../controllers/modals/ModalController";
|
||||||
|
|
||||||
export default function AccountManagement() {
|
export default function AccountManagement() {
|
||||||
const logOut = useContext(LogOutContext);
|
const logOut = useContext(LogOutContext);
|
||||||
const client = useClient();
|
const client = useClient();
|
||||||
|
|
|
@ -12,13 +12,14 @@ import {
|
||||||
HiddenValue,
|
HiddenValue,
|
||||||
} from "@revoltchat/ui";
|
} from "@revoltchat/ui";
|
||||||
|
|
||||||
import { modalController } from "../../../context/modals";
|
|
||||||
import {
|
import {
|
||||||
ClientStatus,
|
ClientStatus,
|
||||||
StatusContext,
|
StatusContext,
|
||||||
useClient,
|
useClient,
|
||||||
} from "../../../context/revoltjs/RevoltClient";
|
} from "../../../context/revoltjs/RevoltClient";
|
||||||
|
|
||||||
|
import { modalController } from "../../../controllers/modals/ModalController";
|
||||||
|
|
||||||
export default observer(() => {
|
export default observer(() => {
|
||||||
const client = useClient();
|
const client = useClient();
|
||||||
const status = useContext(StatusContext);
|
const status = useContext(StatusContext);
|
||||||
|
|
|
@ -7,7 +7,6 @@ import { useCallback, useContext, useEffect, useState } from "preact/hooks";
|
||||||
|
|
||||||
import { Category, CategoryButton, Error, Tip } from "@revoltchat/ui";
|
import { Category, CategoryButton, Error, Tip } from "@revoltchat/ui";
|
||||||
|
|
||||||
import { modalController } from "../../../context/modals";
|
|
||||||
import {
|
import {
|
||||||
ClientStatus,
|
ClientStatus,
|
||||||
StatusContext,
|
StatusContext,
|
||||||
|
@ -15,6 +14,8 @@ import {
|
||||||
} from "../../../context/revoltjs/RevoltClient";
|
} from "../../../context/revoltjs/RevoltClient";
|
||||||
import { takeError } from "../../../context/revoltjs/util";
|
import { takeError } from "../../../context/revoltjs/util";
|
||||||
|
|
||||||
|
import { modalController } from "../../../controllers/modals/ModalController";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Temporary helper function for Axios config
|
* Temporary helper function for Axios config
|
||||||
* @param token Token
|
* @param token Token
|
||||||
|
|
2
src/context/DO_NOT_TOUCH.md
Normal file
2
src/context/DO_NOT_TOUCH.md
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
hello do not touch `intermediate` or `revoltjs` folders
|
||||||
|
they are being rewritten
|
|
@ -8,11 +8,11 @@ import { Preloader, UIProvider } from "@revoltchat/ui";
|
||||||
|
|
||||||
import { hydrateState } from "../mobx/State";
|
import { hydrateState } from "../mobx/State";
|
||||||
|
|
||||||
|
import ModalRenderer from "../controllers/modals/ModalRenderer";
|
||||||
import Locale from "./Locale";
|
import Locale from "./Locale";
|
||||||
import Theme from "./Theme";
|
import Theme from "./Theme";
|
||||||
import { history } from "./history";
|
import { history } from "./history";
|
||||||
import Intermediate from "./intermediate/Intermediate";
|
import Intermediate from "./intermediate/Intermediate";
|
||||||
import ModalRenderer from "./modals/ModalRenderer";
|
|
||||||
import Client from "./revoltjs/RevoltClient";
|
import Client from "./revoltjs/RevoltClient";
|
||||||
import SyncManager from "./revoltjs/SyncManager";
|
import SyncManager from "./revoltjs/SyncManager";
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ import { determineLink } from "../../lib/links";
|
||||||
|
|
||||||
import { useApplicationState } from "../../mobx/State";
|
import { useApplicationState } from "../../mobx/State";
|
||||||
|
|
||||||
import { modalController } from "../modals";
|
import { modalController } from "../../controllers/modals/ModalController";
|
||||||
import Modals from "./Modals";
|
import Modals from "./Modals";
|
||||||
|
|
||||||
export type Screen =
|
export type Screen =
|
||||||
|
|
|
@ -13,8 +13,8 @@ import { determineFileSize } from "../../lib/fileSize";
|
||||||
|
|
||||||
import { useApplicationState } from "../../mobx/State";
|
import { useApplicationState } from "../../mobx/State";
|
||||||
|
|
||||||
|
import { modalController } from "../../controllers/modals/ModalController";
|
||||||
import { useIntermediate } from "../intermediate/Intermediate";
|
import { useIntermediate } from "../intermediate/Intermediate";
|
||||||
import { modalController } from "../modals";
|
|
||||||
import { AppContext } from "./RevoltClient";
|
import { AppContext } from "./RevoltClient";
|
||||||
import { takeError } from "./util";
|
import { takeError } from "./util";
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ import { Preloader } from "@revoltchat/ui";
|
||||||
|
|
||||||
import { useApplicationState } from "../../mobx/State";
|
import { useApplicationState } from "../../mobx/State";
|
||||||
|
|
||||||
import { modalController } from "../modals";
|
import { modalController } from "../../controllers/modals/ModalController";
|
||||||
import { registerEvents } from "./events";
|
import { registerEvents } from "./events";
|
||||||
import { takeError } from "./util";
|
import { takeError } from "./util";
|
||||||
|
|
||||||
|
|
|
@ -10,10 +10,11 @@ import { ulid } from "ulid";
|
||||||
|
|
||||||
import { determineLink } from "../../lib/links";
|
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 { determineLink } from "../../lib/links";
|
||||||
import Changelog from "./components/Changelog";
|
import Changelog from "./components/Changelog";
|
||||||
import Clipboard from "./components/Clipboard";
|
import Clipboard from "./components/Clipboard";
|
|
@ -2,7 +2,7 @@ import { observer } from "mobx-react-lite";
|
||||||
|
|
||||||
import { useEffect } from "preact/hooks";
|
import { useEffect } from "preact/hooks";
|
||||||
|
|
||||||
import { modalController } from ".";
|
import { modalController } from "./ModalController";
|
||||||
|
|
||||||
export default observer(() => {
|
export default observer(() => {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
|
@ -7,8 +7,8 @@ import { Modal } from "@revoltchat/ui";
|
||||||
|
|
||||||
import { noopTrue } from "../../../lib/js";
|
import { noopTrue } from "../../../lib/js";
|
||||||
|
|
||||||
import { modalController } from "..";
|
|
||||||
import { toConfig } from "../../../components/settings/account/MultiFactorAuthentication";
|
import { toConfig } from "../../../components/settings/account/MultiFactorAuthentication";
|
||||||
|
import { modalController } from "../ModalController";
|
||||||
import { ModalProps } from "../types";
|
import { ModalProps } from "../types";
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -9,9 +9,10 @@ import { noopTrue } from "../../../lib/js";
|
||||||
|
|
||||||
import { useApplicationState } from "../../../mobx/State";
|
import { useApplicationState } from "../../../mobx/State";
|
||||||
|
|
||||||
|
import { AppContext } from "../../../context/revoltjs/RevoltClient";
|
||||||
|
import { takeError } from "../../../context/revoltjs/util";
|
||||||
|
|
||||||
import FormField from "../../../pages/login/FormField";
|
import FormField from "../../../pages/login/FormField";
|
||||||
import { AppContext } from "../../revoltjs/RevoltClient";
|
|
||||||
import { takeError } from "../../revoltjs/util";
|
|
||||||
import { ModalProps } from "../types";
|
import { ModalProps } from "../types";
|
||||||
|
|
||||||
interface FormInputs {
|
interface FormInputs {
|
|
@ -19,7 +19,8 @@ import {
|
||||||
|
|
||||||
import { noop } from "../../../lib/js";
|
import { noop } from "../../../lib/js";
|
||||||
|
|
||||||
import { FileUploader } from "../../revoltjs/FileUploads";
|
import { FileUploader } from "../../../context/revoltjs/FileUploads";
|
||||||
|
|
||||||
import { ModalProps } from "../types";
|
import { ModalProps } from "../types";
|
||||||
|
|
||||||
const Preview = styled(Centred)`
|
const Preview = styled(Centred)`
|
|
@ -28,7 +28,6 @@ import { QueuedMessage } from "../mobx/stores/MessageQueue";
|
||||||
import { NotificationState } from "../mobx/stores/NotificationOptions";
|
import { NotificationState } from "../mobx/stores/NotificationOptions";
|
||||||
|
|
||||||
import { Screen, useIntermediate } from "../context/intermediate/Intermediate";
|
import { Screen, useIntermediate } from "../context/intermediate/Intermediate";
|
||||||
import { modalController } from "../context/modals";
|
|
||||||
import {
|
import {
|
||||||
AppContext,
|
AppContext,
|
||||||
ClientStatus,
|
ClientStatus,
|
||||||
|
@ -39,6 +38,7 @@ import CMNotifications from "./contextmenu/CMNotifications";
|
||||||
|
|
||||||
import Tooltip from "../components/common/Tooltip";
|
import Tooltip from "../components/common/Tooltip";
|
||||||
import UserStatus from "../components/common/user/UserStatus";
|
import UserStatus from "../components/common/user/UserStatus";
|
||||||
|
import { modalController } from "../controllers/modals/ModalController";
|
||||||
import { internalEmit } from "./eventEmitter";
|
import { internalEmit } from "./eventEmitter";
|
||||||
import { getRenderer } from "./renderer/Singleton";
|
import { getRenderer } from "./renderer/Singleton";
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
import { action, makeAutoObservable, runInAction } from "mobx";
|
import { action, makeAutoObservable, runInAction } from "mobx";
|
||||||
|
|
||||||
import { modalController } from "../../context/modals";
|
|
||||||
|
|
||||||
import { latestChangelog } from "../../assets/changelogs";
|
import { latestChangelog } from "../../assets/changelogs";
|
||||||
|
import { modalController } from "../../controllers/modals/ModalController";
|
||||||
import Persistent from "../interfaces/Persistent";
|
import Persistent from "../interfaces/Persistent";
|
||||||
import Store from "../interfaces/Store";
|
import Store from "../interfaces/Store";
|
||||||
import Syncable from "../interfaces/Syncable";
|
import Syncable from "../interfaces/Syncable";
|
||||||
|
|
|
@ -6,13 +6,14 @@ import { useContext, useEffect } from "preact/hooks";
|
||||||
|
|
||||||
import { Header } from "@revoltchat/ui";
|
import { Header } from "@revoltchat/ui";
|
||||||
|
|
||||||
import { modalController } from "../context/modals";
|
|
||||||
import {
|
import {
|
||||||
AppContext,
|
AppContext,
|
||||||
ClientStatus,
|
ClientStatus,
|
||||||
StatusContext,
|
StatusContext,
|
||||||
} from "../context/revoltjs/RevoltClient";
|
} from "../context/revoltjs/RevoltClient";
|
||||||
|
|
||||||
|
import { modalController } from "../controllers/modals/ModalController";
|
||||||
|
|
||||||
export default function Open() {
|
export default function Open() {
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
const client = useContext(AppContext);
|
const client = useContext(AppContext);
|
||||||
|
|
|
@ -13,13 +13,13 @@ import { TextReact } from "../../lib/i18n";
|
||||||
import { isTouchscreenDevice } from "../../lib/isTouchscreenDevice";
|
import { isTouchscreenDevice } from "../../lib/isTouchscreenDevice";
|
||||||
|
|
||||||
import { useIntermediate } from "../../context/intermediate/Intermediate";
|
import { useIntermediate } from "../../context/intermediate/Intermediate";
|
||||||
import { modalController } from "../../context/modals";
|
|
||||||
import { useClient } from "../../context/revoltjs/RevoltClient";
|
import { useClient } from "../../context/revoltjs/RevoltClient";
|
||||||
|
|
||||||
import CollapsibleSection from "../../components/common/CollapsibleSection";
|
import CollapsibleSection from "../../components/common/CollapsibleSection";
|
||||||
import Tooltip from "../../components/common/Tooltip";
|
import Tooltip from "../../components/common/Tooltip";
|
||||||
import UserIcon from "../../components/common/user/UserIcon";
|
import UserIcon from "../../components/common/user/UserIcon";
|
||||||
import { PageHeader } from "../../components/ui/Header";
|
import { PageHeader } from "../../components/ui/Header";
|
||||||
|
import { modalController } from "../../controllers/modals/ModalController";
|
||||||
import { Friend } from "./Friend";
|
import { Friend } from "./Friend";
|
||||||
|
|
||||||
export default observer(() => {
|
export default observer(() => {
|
||||||
|
|
|
@ -4,8 +4,8 @@ import { API } from "revolt.js";
|
||||||
import { useApplicationState } from "../../../mobx/State";
|
import { useApplicationState } from "../../../mobx/State";
|
||||||
|
|
||||||
import { useIntermediate } from "../../../context/intermediate/Intermediate";
|
import { useIntermediate } from "../../../context/intermediate/Intermediate";
|
||||||
import { modalController } from "../../../context/modals";
|
|
||||||
|
|
||||||
|
import { modalController } from "../../../controllers/modals/ModalController";
|
||||||
import { Form } from "./Form";
|
import { Form } from "./Form";
|
||||||
|
|
||||||
export function FormLogin() {
|
export function FormLogin() {
|
||||||
|
|
|
@ -13,9 +13,8 @@ import { isTouchscreenDevice } from "../../lib/isTouchscreenDevice";
|
||||||
|
|
||||||
import { useApplicationState } from "../../mobx/State";
|
import { useApplicationState } from "../../mobx/State";
|
||||||
|
|
||||||
import { modalController } from "../../context/modals";
|
|
||||||
|
|
||||||
import ButtonItem from "../../components/navigation/items/ButtonItem";
|
import ButtonItem from "../../components/navigation/items/ButtonItem";
|
||||||
|
import { modalController } from "../../controllers/modals/ModalController";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
pages: {
|
pages: {
|
||||||
|
|
|
@ -35,7 +35,6 @@ import { LineDivider } from "@revoltchat/ui";
|
||||||
import { useApplicationState } from "../../mobx/State";
|
import { useApplicationState } from "../../mobx/State";
|
||||||
|
|
||||||
import { useIntermediate } from "../../context/intermediate/Intermediate";
|
import { useIntermediate } from "../../context/intermediate/Intermediate";
|
||||||
import { modalController } from "../../context/modals";
|
|
||||||
import RequiresOnline from "../../context/revoltjs/RequiresOnline";
|
import RequiresOnline from "../../context/revoltjs/RequiresOnline";
|
||||||
import { AppContext, LogOutContext } from "../../context/revoltjs/RevoltClient";
|
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 { Username } from "../../components/common/user/UserShort";
|
||||||
import UserStatus from "../../components/common/user/UserStatus";
|
import UserStatus from "../../components/common/user/UserStatus";
|
||||||
import ButtonItem from "../../components/navigation/items/ButtonItem";
|
import ButtonItem from "../../components/navigation/items/ButtonItem";
|
||||||
|
import { modalController } from "../../controllers/modals/ModalController";
|
||||||
import { GIT_BRANCH, GIT_REVISION, REPO_URL } from "../../revision";
|
import { GIT_BRANCH, GIT_REVISION, REPO_URL } from "../../revision";
|
||||||
import { APP_VERSION } from "../../version";
|
import { APP_VERSION } from "../../version";
|
||||||
import { GenericSettings } from "./GenericSettings";
|
import { GenericSettings } from "./GenericSettings";
|
||||||
|
|
|
@ -25,7 +25,6 @@ import { useTranslation } from "../../../lib/i18n";
|
||||||
import { stopPropagation } from "../../../lib/stopPropagation";
|
import { stopPropagation } from "../../../lib/stopPropagation";
|
||||||
|
|
||||||
import { useIntermediate } from "../../../context/intermediate/Intermediate";
|
import { useIntermediate } from "../../../context/intermediate/Intermediate";
|
||||||
import { modalController } from "../../../context/modals";
|
|
||||||
import { FileUploader } from "../../../context/revoltjs/FileUploads";
|
import { FileUploader } from "../../../context/revoltjs/FileUploads";
|
||||||
import { useClient } from "../../../context/revoltjs/RevoltClient";
|
import { useClient } from "../../../context/revoltjs/RevoltClient";
|
||||||
|
|
||||||
|
@ -35,6 +34,7 @@ import AutoComplete, {
|
||||||
import CollapsibleSection from "../../../components/common/CollapsibleSection";
|
import CollapsibleSection from "../../../components/common/CollapsibleSection";
|
||||||
import Tooltip from "../../../components/common/Tooltip";
|
import Tooltip from "../../../components/common/Tooltip";
|
||||||
import UserIcon from "../../../components/common/user/UserIcon";
|
import UserIcon from "../../../components/common/user/UserIcon";
|
||||||
|
import { modalController } from "../../../controllers/modals/ModalController";
|
||||||
|
|
||||||
interface Data {
|
interface Data {
|
||||||
_id: string;
|
_id: string;
|
||||||
|
|
|
@ -10,9 +10,10 @@ import { urlBase64ToUint8Array } from "../../../lib/conversion";
|
||||||
|
|
||||||
import { useApplicationState } from "../../../mobx/State";
|
import { useApplicationState } from "../../../mobx/State";
|
||||||
|
|
||||||
import { modalController } from "../../../context/modals";
|
|
||||||
import { AppContext } from "../../../context/revoltjs/RevoltClient";
|
import { AppContext } from "../../../context/revoltjs/RevoltClient";
|
||||||
|
|
||||||
|
import { modalController } from "../../../controllers/modals/ModalController";
|
||||||
|
|
||||||
export const Notifications = observer(() => {
|
export const Notifications = observer(() => {
|
||||||
const client = useContext(AppContext);
|
const client = useContext(AppContext);
|
||||||
const settings = useApplicationState().settings;
|
const settings = useApplicationState().settings;
|
||||||
|
|
|
@ -27,9 +27,10 @@ import {
|
||||||
} from "@revoltchat/ui";
|
} from "@revoltchat/ui";
|
||||||
|
|
||||||
import { dayjs } from "../../../context/Locale";
|
import { dayjs } from "../../../context/Locale";
|
||||||
import { modalController } from "../../../context/modals";
|
|
||||||
import { AppContext } from "../../../context/revoltjs/RevoltClient";
|
import { AppContext } from "../../../context/revoltjs/RevoltClient";
|
||||||
|
|
||||||
|
import { modalController } from "../../../controllers/modals/ModalController";
|
||||||
|
|
||||||
dayjs.extend(relativeTime);
|
dayjs.extend(relativeTime);
|
||||||
|
|
||||||
export function Sessions() {
|
export function Sessions() {
|
||||||
|
|
|
@ -7,8 +7,7 @@ import { useEffect, useState } from "preact/hooks";
|
||||||
|
|
||||||
import { internalEmit, internalSubscribe } from "./lib/eventEmitter";
|
import { internalEmit, internalSubscribe } from "./lib/eventEmitter";
|
||||||
|
|
||||||
import { modalController } from "./context/modals";
|
import { modalController } from "./controllers/modals/ModalController";
|
||||||
|
|
||||||
import { APP_VERSION } from "./version";
|
import { APP_VERSION } from "./version";
|
||||||
|
|
||||||
const INTERVAL_HOUR = 36e5;
|
const INTERVAL_HOUR = 36e5;
|
||||||
|
|
Loading…
Reference in a new issue