这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions frontend/src/components/Modals/Password/MultiUserAuth.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import React, { useState } from "react";
import System from "../../../models/system";
import { AUTH_TOKEN, AUTH_USER } from "../../../utils/constants";
import useLogo from "../../../hooks/useLogo";

export default function MultiUserAuth() {
const [loading, setLoading] = useState(false);
const [error, setError] = useState(null);
const { logo: _initLogo } = useLogo();
const handleLogin = async (e) => {
setError(null);
setLoading(true);
Expand All @@ -29,9 +31,12 @@ export default function MultiUserAuth() {
<form onSubmit={handleLogin}>
<div className="relative bg-white rounded-lg shadow dark:bg-stone-700">
<div className="flex items-start justify-between p-4 border-b rounded-t dark:border-gray-600">
<h3 className="text-md md:text-xl font-semibold text-gray-900 dark:text-white">
This instance is password protected.
</h3>
<div className="flex items-center flex-col">
<img src={_initLogo} alt="Logo" className="w-1/2" />
<h3 className="text-md md:text-xl font-semibold text-gray-900 dark:text-white">
This instance is password protected.
</h3>
</div>
</div>
<div className="p-6 space-y-6 flex h-full w-full">
<div className="w-full flex flex-col gap-y-4">
Expand Down
11 changes: 8 additions & 3 deletions frontend/src/components/Modals/Password/SingleUserAuth.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import React, { useState } from "react";
import System from "../../../models/system";
import { AUTH_TOKEN } from "../../../utils/constants";
import useLogo from "../../../hooks/useLogo";

export default function SingleUserAuth() {
const [loading, setLoading] = useState(false);
const [error, setError] = useState(null);
const { logo: _initLogo } = useLogo();
const handleLogin = async (e) => {
setError(null);
setLoading(true);
Expand All @@ -28,9 +30,12 @@ export default function SingleUserAuth() {
<form onSubmit={handleLogin}>
<div className="relative bg-white rounded-lg shadow dark:bg-stone-700">
<div className="flex items-start justify-between p-4 border-b rounded-t dark:border-gray-600">
<h3 className="text-md md:text-xl font-semibold text-gray-900 dark:text-white">
This workspace is password protected.
</h3>
<div className="flex items-center flex-col">
<img src={_initLogo} alt="Logo" className="w-1/2" />
<h3 className="text-md md:text-xl font-semibold text-gray-900 dark:text-white">
This instance is password protected.
</h3>
</div>
</div>
<div className="p-6 space-y-6 flex h-full w-full">
<div className="w-full flex flex-col gap-y-4">
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/Modals/Password/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { AUTH_TOKEN, AUTH_USER } from "../../../utils/constants";

export default function PasswordModal({ mode = "single" }) {
return (
<div className="fixed top-0 left-0 right-0 z-50 w-full p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] h-full bg-black bg-opacity-50 flex items-center justify-center">
<div className="fixed top-0 left-0 right-0 z-50 w-full p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] h-full bg-gray-600 dark:bg-stone-800 flex items-center justify-center">
<div className="flex fixed top-0 left-0 right-0 w-full h-full" />
<div className="relative w-full max-w-2xl max-h-full">
{mode === "single" ? <SingleUserAuth /> : <MultiUserAuth />}
Expand Down
15 changes: 3 additions & 12 deletions frontend/src/pages/Main/index.jsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,16 @@
import React from "react";
import DefaultChatContainer from "../../components/DefaultChat";
import Sidebar from "../../components/Sidebar";
import SidebarPlaceholder from "../../components/Sidebar/Placeholder";
import ChatPlaceholder from "../../components/WorkspaceChat/LoadingChat";
import PasswordModal, {
usePasswordModal,
} from "../../components/Modals/Password";
import { isMobile } from "react-device-detect";

export default function Main() {
const { requiresAuth, mode } = usePasswordModal();
if (requiresAuth === null || requiresAuth) {
return (
<>
{requiresAuth && <PasswordModal mode={mode} />}
<div className="w-screen h-screen overflow-hidden bg-orange-100 dark:bg-stone-700 flex">
{!isMobile && <SidebarPlaceholder />}
<ChatPlaceholder />
</div>
</>
);

if (requiresAuth !== false) {
return <>{requiresAuth !== null && <PasswordModal mode={mode} />}</>;
}

return (
Expand Down
15 changes: 3 additions & 12 deletions frontend/src/pages/WorkspaceChat/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,16 @@ import { default as WorkspaceChatContainer } from "../../components/WorkspaceCha
import Sidebar from "../../components/Sidebar";
import { useParams } from "react-router-dom";
import Workspace from "../../models/workspace";
import SidebarPlaceholder from "../../components/Sidebar/Placeholder";
import ChatPlaceholder from "../../components/WorkspaceChat/LoadingChat";
import PasswordModal, {
usePasswordModal,
} from "../../components/Modals/Password";
import { isMobile } from "react-device-detect";

export default function WorkspaceChat() {
const { requiresAuth, mode } = usePasswordModal();
if (requiresAuth === null || requiresAuth) {
return (
<>
{requiresAuth && <PasswordModal mode={mode} />}
<div className="w-screen h-screen overflow-hidden bg-orange-100 dark:bg-stone-700 flex">
{!isMobile && <SidebarPlaceholder />}
<ChatPlaceholder />
</div>
</>
);

if (requiresAuth !== false) {
return <>{requiresAuth !== null && <PasswordModal mode={mode} />}</>;
}

return <ShowWorkspaceChat />;
Expand Down