chore(refactor): delete context/revoltjs folder

This commit is contained in:
Paul Makles
2022-07-06 13:08:03 +01:00
parent fa9b02c71b
commit de4d644743
30 changed files with 77 additions and 161 deletions

View File

@@ -7,8 +7,8 @@ import { Masks, Preloader } from "@revoltchat/ui";
import ErrorBoundary from "../lib/ErrorBoundary";
import Context from "../context";
import { CheckAuth } from "../context/revoltjs/CheckAuth";
import { CheckAuth } from "../controllers/client/jsx/CheckAuth";
import Invite from "./invite/Invite";
const Login = lazy(() => import("./login/Login"));

View File

@@ -6,12 +6,11 @@ import styled from "styled-components/macro";
import { isTouchscreenDevice } from "../../lib/isTouchscreenDevice";
import { getChannelName } from "../../context/revoltjs/util";
import { useStatusColour } from "../../components/common/user/UserIcon";
import UserStatus from "../../components/common/user/UserStatus";
import Markdown from "../../components/markdown/Markdown";
import { PageHeader } from "../../components/ui/Header";
import { ChannelName } from "../../controllers/client/jsx/ChannelName";
import { modalController } from "../../controllers/modals/ModalController";
import HeaderActions from "./actions/HeaderActions";
@@ -64,7 +63,6 @@ const Info = styled.div`
`;
export default observer(({ channel }: ChannelHeaderProps) => {
const name = getChannelName(channel);
let icon, recipient: User | undefined;
switch (channel.channel_type) {
case "SavedMessages":
@@ -85,7 +83,9 @@ export default observer(({ channel }: ChannelHeaderProps) => {
return (
<PageHeader icon={icon} withTransparency>
<Info>
<span className="name">{name}</span>
<span className="name">
<ChannelName channel={channel} />
</span>
{isTouchscreenDevice &&
channel.channel_type === "DirectMessage" && (
<>

View File

@@ -4,7 +4,7 @@ import styled from "styled-components/macro";
import { Text } from "preact-i18n";
import { getChannelName } from "../../../context/revoltjs/util";
import { ChannelName } from "../../../controllers/client/jsx/ChannelName";
const StartBase = styled.div`
margin: 18px 16px 10px 16px;
@@ -28,7 +28,9 @@ interface Props {
export default observer(({ channel }: Props) => {
return (
<StartBase>
<h1>{getChannelName(channel, true)}</h1>
<h1>
<ChannelName channel={channel} prefix />
</h1>
<h4>
<Text id="app.main.channel.start.group" />
</h4>

View File

@@ -12,8 +12,6 @@ import { TextReact } from "../../lib/i18n";
import { useApplicationState } from "../../mobx/State";
import { takeError } from "../../context/revoltjs/util";
import ServerIcon from "../../components/common/ServerIcon";
import UserIcon from "../../components/common/user/UserIcon";
import {
@@ -21,6 +19,7 @@ import {
useSession,
} from "../../controllers/client/ClientController";
import RequiresOnline from "../../controllers/client/jsx/RequiresOnline";
import { takeError } from "../../controllers/client/jsx/error";
export default function Invite() {
const history = useHistory();

View File

@@ -9,11 +9,11 @@ import { useState } from "preact/hooks";
import { Button, Category, Preloader, Tip } from "@revoltchat/ui";
import { I18nError } from "../../../context/Locale";
import { takeError } from "../../../context/revoltjs/util";
import WaveSVG from "../../settings/assets/wave.svg";
import { clientController } from "../../../controllers/client/ClientController";
import { takeError } from "../../../controllers/client/jsx/error";
import FormField from "../FormField";
import { CaptchaBlock, CaptchaProps } from "./CaptchaBlock";
import { MailProvider } from "./MailProvider";

View File

@@ -5,9 +5,9 @@ import { useEffect, useState } from "preact/hooks";
import { Category, Preloader } from "@revoltchat/ui";
import { I18nError } from "../../../context/Locale";
import { takeError } from "../../../context/revoltjs/util";
import { useApi } from "../../../controllers/client/ClientController";
import { takeError } from "../../../controllers/client/jsx/error";
import { Form } from "./Form";
export function FormResend() {

View File

@@ -4,9 +4,8 @@ import { Route, Switch, useHistory, useParams } from "react-router-dom";
import { Text } from "preact-i18n";
import { getChannelName } from "../../context/revoltjs/util";
import { useClient } from "../../controllers/client/ClientController";
import { ChannelName } from "../../controllers/client/jsx/ChannelName";
import { GenericSettings } from "./GenericSettings";
import Overview from "./channel/Overview";
import Permissions from "./channel/Permissions";
@@ -47,7 +46,7 @@ export default function ChannelSettings() {
<GenericSettings
pages={[
{
category: <div>{getChannelName(channel, true)}</div>,
category: <ChannelName channel={channel} prefix />,
id: "overview",
icon: <InfoCircle size={20} />,
title: (

View File

@@ -9,7 +9,7 @@ import { Button, Checkbox, InputBox } from "@revoltchat/ui";
import TextAreaAutoSize from "../../../lib/TextAreaAutoSize";
import { FileUploader } from "../../../context/revoltjs/FileUploads";
import { FileUploader } from "../../../controllers/client/jsx/legacy/FileUploads";
interface Props {
channel: Channel;

View File

@@ -23,8 +23,6 @@ import { internalEmit } from "../../../lib/eventEmitter";
import { useTranslation } from "../../../lib/i18n";
import { stopPropagation } from "../../../lib/stopPropagation";
import { FileUploader } from "../../../context/revoltjs/FileUploads";
import AutoComplete, {
useAutoComplete,
} from "../../../components/common/AutoComplete";
@@ -32,6 +30,7 @@ import CollapsibleSection from "../../../components/common/CollapsibleSection";
import Tooltip from "../../../components/common/Tooltip";
import UserIcon from "../../../components/common/user/UserIcon";
import { useClient } from "../../../controllers/client/ClientController";
import { FileUploader } from "../../../controllers/client/jsx/legacy/FileUploads";
import { modalController } from "../../../controllers/modals/ModalController";
interface Data {

View File

@@ -12,12 +12,11 @@ import { Button, LineDivider, Tip } from "@revoltchat/ui";
import TextAreaAutoSize from "../../../lib/TextAreaAutoSize";
import { useTranslation } from "../../../lib/i18n";
import { FileUploader } from "../../../context/revoltjs/FileUploads";
import AutoComplete, {
useAutoComplete,
} from "../../../components/common/AutoComplete";
import { useSession } from "../../../controllers/client/ClientController";
import { FileUploader } from "../../../controllers/client/jsx/legacy/FileUploads";
import { UserProfile } from "../../../controllers/modals/components/legacy/UserProfile";
export const Profile = observer(() => {

View File

@@ -9,10 +9,9 @@ import { useEffect, useState } from "preact/hooks";
import { IconButton, Preloader } from "@revoltchat/ui";
import { getChannelName } from "../../../context/revoltjs/util";
import UserIcon from "../../../components/common/user/UserIcon";
import { Username } from "../../../components/common/user/UserShort";
import { ChannelName } from "../../../controllers/client/jsx/ChannelName";
interface InnerProps {
invite: API.Invite;
@@ -33,7 +32,9 @@ const Inner = observer(({ invite, server, removeSelf }: InnerProps) => {
<UserIcon target={user} size={24} />{" "}
<Username user={user} showServerIdentity="both" />
</span>
<span>{channel ? getChannelName(channel, true) : "#??"}</span>
<span>
<ChannelName channel={channel} prefix />
</span>
<IconButton
onClick={() => {
setDelete(true);

View File

@@ -12,8 +12,8 @@ import { Button, ComboBox, InputBox } from "@revoltchat/ui";
import TextAreaAutoSize from "../../../lib/TextAreaAutoSize";
import { noop } from "../../../lib/js";
import { FileUploader } from "../../../context/revoltjs/FileUploads";
import { getChannelName } from "../../../context/revoltjs/util";
import { ChannelName } from "../../../controllers/client/jsx/ChannelName";
import { FileUploader } from "../../../controllers/client/jsx/legacy/FileUploads";
interface Props {
server: Server;
@@ -172,7 +172,7 @@ export const Overview = observer(({ server }: Props) => {
)
.map((channel) => (
<option key={channel!._id} value={channel!._id}>
{getChannelName(channel!, true)}
<ChannelName channel={channel} prefix />
</option>
))}
</ComboBox>