mirror of
https://github.com/fromchat-messenger/web.git
synced 2026-09-22 19:15:08 +03:00
Move auth components to the right place
This commit is contained in:
@@ -37,3 +37,20 @@ export function AuthHeader({ title, icon, subtitle }: AuthHeaderProps) {
|
|||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type AlertType = "success" | "danger"
|
||||||
|
|
||||||
|
export interface Alert {
|
||||||
|
type: AlertType;
|
||||||
|
message: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function AlertsContainer({ alerts }: { alerts: Alert[]}) {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{alerts.slice(-3).map((alert, i) => {
|
||||||
|
return <div className={`alert alert-${alert.type}`} key={i}>{alert.message}</div>
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import { useImmer } from "use-immer";
|
import { useImmer } from "use-immer";
|
||||||
import { AlertsContainer, type Alert, type AlertType } from "../chat/ui/components/Alerts";
|
import { AlertsContainer, type Alert, type AlertType } from "./Auth";
|
||||||
import { AuthContainer, AuthHeader } from "../chat/ui/components/Auth";
|
import { AuthContainer, AuthHeader } from "./Auth";
|
||||||
import type { ErrorResponse, LoginRequest, LoginResponse } from "../../core/types";
|
import type { ErrorResponse, LoginRequest, LoginResponse } from "../../core/types";
|
||||||
import { ensureKeysOnLogin } from "../../core/api/authApi";
|
import { ensureKeysOnLogin } from "../../core/api/authApi";
|
||||||
import { API_BASE_URL } from "../../core/config";
|
import { API_BASE_URL } from "../../core/config";
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { useImmer } from "use-immer";
|
import { useImmer } from "use-immer";
|
||||||
import { AuthContainer, AuthHeader } from "../chat/ui/components/Auth";
|
import { AuthContainer, AuthHeader } from "./Auth";
|
||||||
import { AlertsContainer, type Alert, type AlertType } from "../chat/ui/components/Alerts";
|
import { AlertsContainer, type Alert, type AlertType } from "./Auth";
|
||||||
import { useRef } from "react";
|
import { useRef } from "react";
|
||||||
import { TextField } from "mdui/components/text-field";
|
import { TextField } from "mdui/components/text-field";
|
||||||
import type { ErrorResponse, RegisterRequest, LoginResponse } from "../../core/types";
|
import type { ErrorResponse, RegisterRequest, LoginResponse } from "../../core/types";
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
export type AlertType = "success" | "danger"
|
|
||||||
|
|
||||||
export interface Alert {
|
|
||||||
type: AlertType;
|
|
||||||
message: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function AlertsContainer({ alerts }: { alerts: Alert[]}) {
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
{alerts.slice(-3).map((alert, i) => {
|
|
||||||
return <div className={`alert alert-${alert.type}`} key={i}>{alert.message}</div>
|
|
||||||
})}
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user