Compare commits
10 Commits
903b7e6e5a
...
b0b765b8fa
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b0b765b8fa | ||
|
|
d861e0cd7d | ||
|
|
b2b1fbaf65 | ||
|
|
d1491b8d19 | ||
|
|
85e8668e34 | ||
|
|
a0a9584a4d | ||
|
|
737797f6dd | ||
|
|
1d1a469fe0 | ||
|
|
227256e0e0 | ||
|
|
5060c84f28 |
28
.github/workflows/test.yml
vendored
28
.github/workflows/test.yml
vendored
@@ -67,6 +67,34 @@ jobs:
|
|||||||
- name: Check code formatting
|
- name: Check code formatting
|
||||||
run: cargo fmt --all -- --check
|
run: cargo fmt --all -- --check
|
||||||
|
|
||||||
|
lint-frontend:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- uses: pnpm/action-setup@v4
|
||||||
|
with:
|
||||||
|
version: 10
|
||||||
|
run_install: false
|
||||||
|
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 22
|
||||||
|
cache: 'pnpm'
|
||||||
|
cache-dependency-path: apps/frontend/pnpm-lock.yaml
|
||||||
|
|
||||||
|
- name: Install frontend dependencies
|
||||||
|
run: |
|
||||||
|
cd apps/frontend
|
||||||
|
pnpm install
|
||||||
|
|
||||||
|
- name: Run frontend linter
|
||||||
|
run: |
|
||||||
|
cd apps/frontend
|
||||||
|
pnpm lint
|
||||||
|
|
||||||
test-frontend:
|
test-frontend:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
|||||||
15
Cargo.lock
generated
15
Cargo.lock
generated
@@ -3975,6 +3975,20 @@ dependencies = [
|
|||||||
"tracing",
|
"tracing",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tower-http"
|
||||||
|
version = "0.6.8"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d4e6559d53cc268e5031cd8429d05415bc4cb4aefc4aa5d6cc35fbf5b924a1f8"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 2.10.0",
|
||||||
|
"bytes",
|
||||||
|
"http",
|
||||||
|
"pin-project-lite",
|
||||||
|
"tower-layer",
|
||||||
|
"tower-service",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tower-layer"
|
name = "tower-layer"
|
||||||
version = "0.3.3"
|
version = "0.3.3"
|
||||||
@@ -4713,6 +4727,7 @@ dependencies = [
|
|||||||
"serde_json",
|
"serde_json",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tower",
|
"tower",
|
||||||
|
"tower-http",
|
||||||
"tracing",
|
"tracing",
|
||||||
"tracing-subscriber",
|
"tracing-subscriber",
|
||||||
"utoipa",
|
"utoipa",
|
||||||
|
|||||||
@@ -27,4 +27,5 @@ once_cell = { version = "1.21.3" }
|
|||||||
argon2 = { version = "0.5.3", features = ["std"] }
|
argon2 = { version = "0.5.3", features = ["std"] }
|
||||||
jsonwebtoken = { version = "10.2.0", features = ["rust_crypto"] }
|
jsonwebtoken = { version = "10.2.0", features = ["rust_crypto"] }
|
||||||
uuid = { version = "1.19.0", features = ["v4", "serde", "fast-rng"] }
|
uuid = { version = "1.19.0", features = ["v4", "serde", "fast-rng"] }
|
||||||
|
tower-http = { version = "0.6.8", features = ["cors"] }
|
||||||
|
|
||||||
|
|||||||
@@ -88,8 +88,10 @@ pub async fn start_server() {
|
|||||||
|
|
||||||
// build the axum app and run the server...
|
// build the axum app and run the server...
|
||||||
info!("Starting application...");
|
info!("Starting application...");
|
||||||
let mut app: Router =
|
let mut app: Router = routes::get_root_router(
|
||||||
routes::get_root_router(Arc::new(get_app_state(&db_connection, &settings)));
|
Arc::new(get_app_state(&db_connection, &settings)),
|
||||||
|
Arc::new(settings.server.cors.clone()),
|
||||||
|
);
|
||||||
|
|
||||||
if settings.server.serve_openapi {
|
if settings.server.serve_openapi {
|
||||||
info!("Enabling OpenAPI documentation endpoint at /openapi.json");
|
info!("Enabling OpenAPI documentation endpoint at /openapi.json");
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ pub(crate) const LOGGING_UTC_KEY: &str = "LOGGING.UTC";
|
|||||||
pub(crate) const SERVER_ADDRESS_KEY: &str = "SERVER.ADDRESS";
|
pub(crate) const SERVER_ADDRESS_KEY: &str = "SERVER.ADDRESS";
|
||||||
pub(crate) const SERVER_PORT_KEY: &str = "SERVER.PORT";
|
pub(crate) const SERVER_PORT_KEY: &str = "SERVER.PORT";
|
||||||
pub(crate) const SERVER_SERVE_OPENAPI_KEY: &str = "SERVER.SERVE_OPENAPI";
|
pub(crate) const SERVER_SERVE_OPENAPI_KEY: &str = "SERVER.SERVE_OPENAPI";
|
||||||
|
pub(crate) const SERVER_CORS_ALLOWED_ORIGINS_KEY: &str = "SERVER.CORS.ALLOWED_ORIGINS";
|
||||||
//
|
//
|
||||||
pub(crate) const DATABASE_URL_KEY: &str = "DATABASE.URL";
|
pub(crate) const DATABASE_URL_KEY: &str = "DATABASE.URL";
|
||||||
pub(crate) const DATABASE_MAX_CONNECTIONS_KEY: &str = "DATABASE.MAX_CONNECTIONS";
|
pub(crate) const DATABASE_MAX_CONNECTIONS_KEY: &str = "DATABASE.MAX_CONNECTIONS";
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ use std::net::IpAddr;
|
|||||||
use config::{Config, ConfigError};
|
use config::{Config, ConfigError};
|
||||||
use tracing::warn;
|
use tracing::warn;
|
||||||
|
|
||||||
use crate::configs::key::SERVER_SERVE_OPENAPI_KEY;
|
use crate::configs::key::{SERVER_CORS_ALLOWED_ORIGINS_KEY, SERVER_SERVE_OPENAPI_KEY};
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
FromConfig,
|
FromConfig,
|
||||||
@@ -15,6 +15,12 @@ pub struct ServerSettings {
|
|||||||
pub address: IpAddr,
|
pub address: IpAddr,
|
||||||
pub port: u16,
|
pub port: u16,
|
||||||
pub serve_openapi: bool,
|
pub serve_openapi: bool,
|
||||||
|
pub cors: CORSSettings,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
pub struct CORSSettings {
|
||||||
|
pub allowed_origins: Vec<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FromConfig for ServerSettings {
|
impl FromConfig for ServerSettings {
|
||||||
@@ -57,6 +63,24 @@ impl FromConfig for ServerSettings {
|
|||||||
);
|
);
|
||||||
DEFAULT_SERVE_OPENAPI
|
DEFAULT_SERVE_OPENAPI
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
cors: CORSSettings {
|
||||||
|
allowed_origins: _config
|
||||||
|
.get_array(SERVER_CORS_ALLOWED_ORIGINS_KEY)
|
||||||
|
.unwrap_or_else(|_| vec![])
|
||||||
|
.into_iter()
|
||||||
|
.filter_map(|val| match val.into_string() {
|
||||||
|
Ok(s) => Some(s),
|
||||||
|
Err(e) => {
|
||||||
|
warn!(
|
||||||
|
"Invalid origin in {} configuration: {}",
|
||||||
|
SERVER_CORS_ALLOWED_ORIGINS_KEY, e
|
||||||
|
);
|
||||||
|
None
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.collect(),
|
||||||
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,25 +6,55 @@ use std::{sync::Arc, time::Duration};
|
|||||||
use axum::{
|
use axum::{
|
||||||
BoxError, Router,
|
BoxError, Router,
|
||||||
error_handling::HandleErrorLayer,
|
error_handling::HandleErrorLayer,
|
||||||
http::{Method, StatusCode, Uri},
|
http::{HeaderValue, Method, StatusCode, Uri},
|
||||||
};
|
};
|
||||||
use tower::{ServiceBuilder, timeout::TimeoutLayer};
|
use tower::{ServiceBuilder, timeout::TimeoutLayer};
|
||||||
|
use tower_http::cors::{AllowHeaders, AllowOrigin, CorsLayer};
|
||||||
use tracing::warn;
|
use tracing::warn;
|
||||||
|
|
||||||
use crate::routes::AppState;
|
use crate::{configs::server::CORSSettings, routes::AppState};
|
||||||
|
|
||||||
pub const TIMEOUT_DURATION_SECS: u64 = 30;
|
pub const TIMEOUT_DURATION_SECS: u64 = 30;
|
||||||
|
|
||||||
pub fn apply_root_middleware(router: Router, _state: Arc<AppState>) -> Router {
|
pub fn apply_root_middleware(
|
||||||
|
router: Router,
|
||||||
|
_state: Arc<AppState>,
|
||||||
|
cors_settings: Arc<CORSSettings>,
|
||||||
|
) -> Router {
|
||||||
let timeout_layer = TimeoutLayer::new(Duration::from_secs(TIMEOUT_DURATION_SECS));
|
let timeout_layer = TimeoutLayer::new(Duration::from_secs(TIMEOUT_DURATION_SECS));
|
||||||
|
|
||||||
let service_builder = ServiceBuilder::new()
|
let service_builder = ServiceBuilder::new()
|
||||||
.layer(HandleErrorLayer::new(handle_timeout_error))
|
.layer(HandleErrorLayer::new(handle_timeout_error))
|
||||||
.layer(timeout_layer);
|
.layer(timeout_layer)
|
||||||
|
.layer(get_cors_layer(cors_settings));
|
||||||
|
|
||||||
router.layer(service_builder)
|
router.layer(service_builder)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn get_cors_layer(cors_settings: Arc<CORSSettings>) -> CorsLayer {
|
||||||
|
let mut cors_layer = CorsLayer::new()
|
||||||
|
.allow_credentials(true)
|
||||||
|
.allow_headers(AllowHeaders::mirror_request());
|
||||||
|
|
||||||
|
let allowed_origins = &cors_settings.allowed_origins;
|
||||||
|
if allowed_origins.contains(&"*".to_string()) {
|
||||||
|
cors_layer = cors_layer.allow_origin(AllowOrigin::mirror_request());
|
||||||
|
warn!(
|
||||||
|
"Wildcard origin is found in allowed origins. CORS is configured to allow requests from any origin. Only use this setting in development or if you understand the security implications."
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
for origin in allowed_origins {
|
||||||
|
if let Ok(header_value) = HeaderValue::from_str(origin) {
|
||||||
|
cors_layer = cors_layer.allow_origin(AllowOrigin::exact(header_value));
|
||||||
|
} else {
|
||||||
|
warn!("Invalid CORS origin: {}", origin);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cors_layer
|
||||||
|
}
|
||||||
|
|
||||||
pub async fn handle_timeout_error(
|
pub async fn handle_timeout_error(
|
||||||
method: Method,
|
method: Method,
|
||||||
uri: Uri,
|
uri: Uri,
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ use axum::{Extension, Router};
|
|||||||
use migration::sea_orm::DatabaseConnection;
|
use migration::sea_orm::DatabaseConnection;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
configs::server::CORSSettings,
|
||||||
middlewares,
|
middlewares,
|
||||||
services::{
|
services::{
|
||||||
auth::{
|
auth::{
|
||||||
@@ -46,7 +47,10 @@ pub struct AppService {
|
|||||||
pub server_state: ServiceState<dyn ServerStateStore>,
|
pub server_state: ServiceState<dyn ServerStateStore>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_root_router(state: impl Into<Arc<AppState>>) -> Router {
|
pub fn get_root_router(
|
||||||
|
state: impl Into<Arc<AppState>>,
|
||||||
|
cors_settings: Arc<CORSSettings>,
|
||||||
|
) -> Router {
|
||||||
let mut router = Router::new();
|
let mut router = Router::new();
|
||||||
let state = state.into();
|
let state = state.into();
|
||||||
|
|
||||||
@@ -54,7 +58,7 @@ pub fn get_root_router(state: impl Into<Arc<AppState>>) -> Router {
|
|||||||
.nest("/api", api::get_api_router(state.clone()))
|
.nest("/api", api::get_api_router(state.clone()))
|
||||||
.merge(view::get_view_router());
|
.merge(view::get_view_router());
|
||||||
|
|
||||||
router = middlewares::apply_root_middleware(router, state.clone());
|
router = middlewares::apply_root_middleware(router, state.clone(), cors_settings);
|
||||||
|
|
||||||
router = router.layer(Extension(state.clone()));
|
router = router.layer(Extension(state.clone()));
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,9 @@
|
|||||||
@import "tailwindcss";
|
@import 'tailwindcss';
|
||||||
|
|
||||||
@theme {
|
@theme {
|
||||||
--font-sans: "Inter", ui-sans-serif, system-ui, sans-serif,
|
--font-sans: 'Inter', ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
|
||||||
"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
html,
|
html,
|
||||||
body {
|
body {
|
||||||
@apply bg-white dark:bg-gray-950;
|
|
||||||
|
|
||||||
@media (prefers-color-scheme: dark) {
|
|
||||||
color-scheme: dark;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
46
apps/frontend/app/components/Form/Button.tsx
Normal file
46
apps/frontend/app/components/Form/Button.tsx
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
import { Button, type ButtonProps } from '@radix-ui/themes';
|
||||||
|
import { LoaderCircle } from 'lucide-react';
|
||||||
|
|
||||||
|
export type SubmitButtonProps = {
|
||||||
|
loading?: boolean;
|
||||||
|
label?:
|
||||||
|
| {
|
||||||
|
default?: string;
|
||||||
|
loading?: string;
|
||||||
|
}
|
||||||
|
| string;
|
||||||
|
} & React.ButtonHTMLAttributes<HTMLButtonElement> &
|
||||||
|
ButtonProps;
|
||||||
|
|
||||||
|
export function SubmitButton({ loading, label, ...props }: SubmitButtonProps) {
|
||||||
|
return (
|
||||||
|
<Button
|
||||||
|
type="submit"
|
||||||
|
disabled={loading}
|
||||||
|
style={{
|
||||||
|
padding: '10px 14px',
|
||||||
|
borderRadius: 6,
|
||||||
|
border: 'none',
|
||||||
|
backgroundColor: 'var(--iris-9)',
|
||||||
|
}}
|
||||||
|
size="3"
|
||||||
|
{...props}
|
||||||
|
>
|
||||||
|
{loading
|
||||||
|
? typeof label === 'string'
|
||||||
|
? label
|
||||||
|
: label?.loading ?? <LoaderCircle className="animate-spin" style={{ width: 24, height: 24, marginRight: 4, verticalAlign: 'middle', color: 'white' }} />
|
||||||
|
: typeof label === 'string'
|
||||||
|
? label
|
||||||
|
: label?.default ?? 'Submit'}
|
||||||
|
</Button>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function ResetButton(props: React.ButtonHTMLAttributes<HTMLButtonElement>) {
|
||||||
|
return (
|
||||||
|
<button type="reset" {...props} style={{ padding: '10px 14px', borderRadius: 6, border: '1px solid var(--gray-5)', background: 'white', ...props.style }}>
|
||||||
|
{props.children ?? 'Reset'}
|
||||||
|
</button>
|
||||||
|
);
|
||||||
|
}
|
||||||
97
apps/frontend/app/components/Form/TextField.tsx
Normal file
97
apps/frontend/app/components/Form/TextField.tsx
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
import type { AnyFieldMeta } from '@tanstack/react-form';
|
||||||
|
import { LucideEye, LucideEyeClosed } from 'lucide-react';
|
||||||
|
import { useCallback, useId, useState } from 'react';
|
||||||
|
import { InfoIcon, type InfoIconProps } from '../info';
|
||||||
|
|
||||||
|
export type TextFieldProps = {
|
||||||
|
label?: string;
|
||||||
|
value?: string;
|
||||||
|
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
||||||
|
labelProps?: React.LabelHTMLAttributes<HTMLLabelElement>;
|
||||||
|
labelDivProps?: React.HTMLAttributes<HTMLDivElement>;
|
||||||
|
infoIconProps?: InfoIconProps;
|
||||||
|
} & React.InputHTMLAttributes<HTMLInputElement> & {
|
||||||
|
type?: 'password';
|
||||||
|
showPasswordToggle?: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
export function TextField({ label, value, onChange, labelProps, labelDivProps, showPasswordToggle, infoIconProps, ...rest }: TextFieldProps) {
|
||||||
|
const id = useId();
|
||||||
|
const [isPasswordVisible, setIsPasswordVisible] = useState(false);
|
||||||
|
const handlePasswordVisibilitySet = useCallback(
|
||||||
|
(e: React.MouseEvent | React.TouchEvent, visible: boolean) => {
|
||||||
|
if (rest.type !== 'password') return;
|
||||||
|
e.preventDefault();
|
||||||
|
setIsPasswordVisible(() => visible);
|
||||||
|
},
|
||||||
|
[rest.type]
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<label htmlFor={id} style={{ display: 'block', marginBottom: 8 }} {...labelProps}>
|
||||||
|
{label && (
|
||||||
|
<div style={{ fontSize: 12, color: 'var(--gray-9)', marginBottom: 6, display: 'flex', alignItems: 'center' }} {...labelDivProps}>
|
||||||
|
{label}
|
||||||
|
{infoIconProps && <InfoIcon {...infoIconProps} style={{ marginLeft: 4, verticalAlign: 'middle' }} />}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
<div style={{ position: 'relative', display: 'flex', alignItems: 'center', gap: 8 }}>
|
||||||
|
<input
|
||||||
|
{...rest}
|
||||||
|
type={rest.type === 'password' ? (isPasswordVisible && showPasswordToggle ? 'text' : 'password') : rest.type}
|
||||||
|
id={id}
|
||||||
|
value={value}
|
||||||
|
onChange={onChange}
|
||||||
|
style={{
|
||||||
|
width: '100%',
|
||||||
|
padding: '10px 12px',
|
||||||
|
borderRadius: 6,
|
||||||
|
border: '1px solid var(--gray-5)',
|
||||||
|
...rest?.style,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div
|
||||||
|
style={{ position: 'absolute', right: 12 }}
|
||||||
|
onMouseDown={(e) => {
|
||||||
|
handlePasswordVisibilitySet(e, true);
|
||||||
|
}}
|
||||||
|
onMouseUp={(e) => {
|
||||||
|
handlePasswordVisibilitySet(e, false);
|
||||||
|
}}
|
||||||
|
onMouseLeave={(e) => {
|
||||||
|
handlePasswordVisibilitySet(e, false);
|
||||||
|
}}
|
||||||
|
onTouchStart={(e) => {
|
||||||
|
handlePasswordVisibilitySet(e, true);
|
||||||
|
}}
|
||||||
|
onTouchEnd={(e) => {
|
||||||
|
handlePasswordVisibilitySet(e, false);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{showPasswordToggle ? isPasswordVisible ? <LucideEye size={16} /> : <LucideEyeClosed size={16} /> : null}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</label>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export type TextFieldErrorMessageProps = AnyFieldMeta & {
|
||||||
|
errorMessage?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export function TextFieldErrorMessage({ isValid, errors, errorMessage }: TextFieldErrorMessageProps) {
|
||||||
|
return (
|
||||||
|
!isValid && (
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
marginTop: 4,
|
||||||
|
fontSize: 12,
|
||||||
|
color: 'var(--red-9)',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{errorMessage ?? errors?.reduce((msg, err) => msg + err.message + ' ', '')}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
27
apps/frontend/app/components/home/TablePlaceholder.tsx
Normal file
27
apps/frontend/app/components/home/TablePlaceholder.tsx
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { Flex, Text, Button, Separator, Box, Badge } from '@radix-ui/themes';
|
||||||
|
|
||||||
|
export default function TablePlaceholder() {
|
||||||
|
return (
|
||||||
|
<Flex direction="column" gap="3" p="4">
|
||||||
|
<Flex justify="between" align="center">
|
||||||
|
<Text weight="bold">Proxy Hosts</Text>
|
||||||
|
<Button size="1">Add Host</Button>
|
||||||
|
</Flex>
|
||||||
|
<Separator size="4" />
|
||||||
|
{[1, 2, 3].map((i) => (
|
||||||
|
<Flex key={i} justify="between" align="center">
|
||||||
|
<Box>
|
||||||
|
<Text size="2" weight="bold" as="div">
|
||||||
|
{`host-${i}.example.com`}
|
||||||
|
</Text>
|
||||||
|
<Text size="1" color="gray">
|
||||||
|
{`http://10.0.0.${i}:8080`}
|
||||||
|
</Text>
|
||||||
|
</Box>
|
||||||
|
<Badge color="green">Online</Badge>
|
||||||
|
</Flex>
|
||||||
|
))}
|
||||||
|
</Flex>
|
||||||
|
);
|
||||||
|
}
|
||||||
59
apps/frontend/app/components/info.tsx
Normal file
59
apps/frontend/app/components/info.tsx
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
import { Box } from '@radix-ui/themes';
|
||||||
|
import { Info, type LucideProps } from 'lucide-react';
|
||||||
|
import { Tooltip } from 'radix-ui';
|
||||||
|
import type { PropsWithChildren } from 'react';
|
||||||
|
|
||||||
|
export type InfoIconProps = PropsWithChildren<
|
||||||
|
{
|
||||||
|
tooltipContainerProps?: Omit<Tooltip.TooltipContentProps & React.RefAttributes<HTMLDivElement>, 'children'>;
|
||||||
|
} & Omit<LucideProps, 'ref'> &
|
||||||
|
React.RefAttributes<SVGSVGElement>
|
||||||
|
>;
|
||||||
|
|
||||||
|
export function InfoIcon({ tooltipContainerProps, children, ...iconProps }: InfoIconProps) {
|
||||||
|
return (
|
||||||
|
<Tooltip.Root>
|
||||||
|
<Tooltip.Trigger asChild>
|
||||||
|
<Info size={16} {...iconProps} />
|
||||||
|
</Tooltip.Trigger>
|
||||||
|
<Tooltip.Portal>
|
||||||
|
<Tooltip.Content
|
||||||
|
//
|
||||||
|
side="top"
|
||||||
|
align="center"
|
||||||
|
sideOffset={5}
|
||||||
|
alignOffset={0}
|
||||||
|
avoidCollisions={true}
|
||||||
|
style={{
|
||||||
|
color: 'black',
|
||||||
|
backgroundColor: 'white',
|
||||||
|
fontSize: 12,
|
||||||
|
boxShadow: '0 2px 10px rgba(0, 0, 0, 0.3)',
|
||||||
|
border: '1px solid var(--gray-5)',
|
||||||
|
}}
|
||||||
|
{...tooltipContainerProps}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
<Tooltip.Arrow className="TooltipArrow" fill="white" />
|
||||||
|
</Tooltip.Content>
|
||||||
|
</Tooltip.Portal>
|
||||||
|
</Tooltip.Root>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function TooltipContentContainer({ children, ...props }: React.HTMLAttributes<HTMLDivElement>) {
|
||||||
|
return (
|
||||||
|
<Box
|
||||||
|
style={{
|
||||||
|
padding: '8px 12px',
|
||||||
|
color: 'black',
|
||||||
|
backgroundColor: 'white',
|
||||||
|
borderRadius: 4,
|
||||||
|
fontSize: 12,
|
||||||
|
}}
|
||||||
|
{...props}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</Box>
|
||||||
|
);
|
||||||
|
}
|
||||||
89
apps/frontend/app/components/layout/SidebarContent.tsx
Normal file
89
apps/frontend/app/components/layout/SidebarContent.tsx
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
import type React from 'react';
|
||||||
|
import { Box, Button, Flex, Heading, Separator, Text } from '@radix-ui/themes';
|
||||||
|
import type { NavItem } from './types';
|
||||||
|
import { Home, Globe, ArrowRight, Lock, Settings, User } from 'lucide-react';
|
||||||
|
import { useLayout } from '../../providers/LayoutProvider';
|
||||||
|
|
||||||
|
const navItems: { label: NavItem; icon: React.ReactNode }[] = [
|
||||||
|
{ label: 'Dashboard', icon: <Home size={16} /> },
|
||||||
|
{ label: 'Proxy Hosts', icon: <Globe size={16} /> },
|
||||||
|
{ label: 'Redirection', icon: <ArrowRight size={16} /> },
|
||||||
|
{ label: 'SSL', icon: <Lock size={16} /> },
|
||||||
|
{ label: 'Settings', icon: <Settings size={16} /> },
|
||||||
|
{ label: 'Profile', icon: <User size={16} /> },
|
||||||
|
] as const;
|
||||||
|
|
||||||
|
export function SidebarContent() {
|
||||||
|
const { activeTab, setActiveTab, setIsMobileMenuOpen } = useLayout();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Flex direction="column" gap="2" p="4" style={{ height: '100%' }}>
|
||||||
|
<Flex align="center" gap="2" mb="6" px="2">
|
||||||
|
<Box
|
||||||
|
style={{
|
||||||
|
width: 32,
|
||||||
|
height: 32,
|
||||||
|
backgroundColor: 'var(--iris-9)',
|
||||||
|
borderRadius: 'var(--radius-2)',
|
||||||
|
display: 'flex',
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'center',
|
||||||
|
color: 'white',
|
||||||
|
fontWeight: 'bold',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Y
|
||||||
|
</Box>
|
||||||
|
<Heading size="4" weight="bold">
|
||||||
|
YANPM
|
||||||
|
</Heading>
|
||||||
|
</Flex>
|
||||||
|
|
||||||
|
<Flex direction="column" gap="1">
|
||||||
|
{navItems.map((item) => (
|
||||||
|
<Button
|
||||||
|
key={item.label}
|
||||||
|
variant={activeTab === item.label ? 'soft' : 'ghost'}
|
||||||
|
color={activeTab === item.label ? 'iris' : 'gray'}
|
||||||
|
onClick={() => {
|
||||||
|
setActiveTab(item.label);
|
||||||
|
setIsMobileMenuOpen(false);
|
||||||
|
}}
|
||||||
|
style={{ cursor: 'pointer', width: '100%', justifyContent: 'flex-start' }}
|
||||||
|
>
|
||||||
|
<Flex align="center" gap="3">
|
||||||
|
{item.icon}
|
||||||
|
<Text size="2" weight={activeTab === item.label ? 'bold' : 'medium'}>
|
||||||
|
{item.label}
|
||||||
|
</Text>
|
||||||
|
</Flex>
|
||||||
|
</Button>
|
||||||
|
))}
|
||||||
|
</Flex>
|
||||||
|
|
||||||
|
<Box style={{ marginTop: 'auto' }} pt="4">
|
||||||
|
<Separator size="4" mb="4" />
|
||||||
|
<Flex align="center" gap="3" px="2">
|
||||||
|
<Box
|
||||||
|
style={{
|
||||||
|
width: 32,
|
||||||
|
height: 32,
|
||||||
|
backgroundColor: 'var(--gray-5)',
|
||||||
|
borderRadius: '50%',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<Box>
|
||||||
|
<Text size="1" weight="bold" as="div">
|
||||||
|
Admin User
|
||||||
|
</Text>
|
||||||
|
<Text size="1" color="gray">
|
||||||
|
admin@example.com
|
||||||
|
</Text>
|
||||||
|
</Box>
|
||||||
|
</Flex>
|
||||||
|
</Box>
|
||||||
|
</Flex>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default SidebarContent;
|
||||||
1
apps/frontend/app/components/layout/types.ts
Normal file
1
apps/frontend/app/components/layout/types.ts
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export type NavItem = 'Dashboard' | 'Proxy Hosts' | 'Redirection' | 'SSL' | 'Settings' | 'Profile';
|
||||||
16
apps/frontend/app/components/theme.tsx
Normal file
16
apps/frontend/app/components/theme.tsx
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
import type React from 'react';
|
||||||
|
import { Theme } from '@radix-ui/themes';
|
||||||
|
|
||||||
|
export type AppThemeProps = {
|
||||||
|
children: React.ReactNode;
|
||||||
|
};
|
||||||
|
|
||||||
|
export function AppTheme({ children }: AppThemeProps) {
|
||||||
|
return (
|
||||||
|
<Theme accentColor="iris" grayColor="slate" panelBackground="translucent" radius="large">
|
||||||
|
{children}
|
||||||
|
</Theme>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default AppTheme;
|
||||||
111
apps/frontend/app/hooks/ResponseHelper.tsx
Normal file
111
apps/frontend/app/hooks/ResponseHelper.tsx
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
import { Text } from '@radix-ui/themes';
|
||||||
|
import { AxiosError } from 'axios';
|
||||||
|
import { useLocation, useNavigate } from 'react-router';
|
||||||
|
import { toast } from 'react-toastify';
|
||||||
|
import { SearchParamKeys } from '../lib/constants';
|
||||||
|
|
||||||
|
export enum ResponseErrorToastId {
|
||||||
|
NetworkError = 'network-error',
|
||||||
|
}
|
||||||
|
|
||||||
|
export type DefaultResponseErrorHandlerOptions = {
|
||||||
|
disableUnauthorizedHandling?: boolean;
|
||||||
|
disableHandleUnexpectedErrors?: boolean;
|
||||||
|
disableIgnoreCanceledRequests?: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param err error value
|
||||||
|
* @returns {boolean} true if the error was handled, false otherwise
|
||||||
|
*/
|
||||||
|
const defaultResponseErrorHandler =
|
||||||
|
(navigate: ReturnType<typeof useNavigate>, location: ReturnType<typeof useLocation>) =>
|
||||||
|
(err: unknown, options?: DefaultResponseErrorHandlerOptions): boolean => {
|
||||||
|
if (!(err instanceof AxiosError) && !options?.disableHandleUnexpectedErrors) {
|
||||||
|
toast.error(
|
||||||
|
<div>
|
||||||
|
<Text weight="bold">Unexpected Error:</Text>
|
||||||
|
<br /> An unexpected error occurred. Please try again later.
|
||||||
|
</div>,
|
||||||
|
{
|
||||||
|
position: 'top-center',
|
||||||
|
autoClose: false,
|
||||||
|
hideProgressBar: false,
|
||||||
|
closeOnClick: true,
|
||||||
|
pauseOnHover: true,
|
||||||
|
draggable: false,
|
||||||
|
progress: undefined,
|
||||||
|
theme: 'colored',
|
||||||
|
}
|
||||||
|
);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(err instanceof AxiosError)) return false;
|
||||||
|
|
||||||
|
if (err.message === 'canceled') {
|
||||||
|
// request was aborted, ignore but return true to indicate it was handled
|
||||||
|
return !options?.disableIgnoreCanceledRequests;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (err.message === 'Network Error') {
|
||||||
|
toast.error(
|
||||||
|
<div>
|
||||||
|
<Text weight="bold">Network Error:</Text>
|
||||||
|
<br /> Unable to reach the server. Please check your internet connection and try again.
|
||||||
|
</div>,
|
||||||
|
{
|
||||||
|
toastId: ResponseErrorToastId.NetworkError,
|
||||||
|
position: 'top-center',
|
||||||
|
autoClose: false,
|
||||||
|
hideProgressBar: false,
|
||||||
|
closeOnClick: true,
|
||||||
|
pauseOnHover: true,
|
||||||
|
draggable: false,
|
||||||
|
progress: undefined,
|
||||||
|
theme: 'colored',
|
||||||
|
}
|
||||||
|
);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// handle 401 Unauthorized globally
|
||||||
|
if (err.status === 401 && !options?.disableUnauthorizedHandling) {
|
||||||
|
// store current path for redirect after login
|
||||||
|
const currentPath = location.pathname + location.search;
|
||||||
|
const searchParam = new URLSearchParams();
|
||||||
|
searchParam.set(SearchParamKeys.Redirect, currentPath);
|
||||||
|
searchParam.set(SearchParamKeys.Message, 'Session expired, please log in again');
|
||||||
|
navigate(`/login?${searchParam.toString()}`);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (err.status === 403) {
|
||||||
|
toast.error(
|
||||||
|
<div>
|
||||||
|
<Text weight="bold">Forbidden:</Text>
|
||||||
|
<br /> You do not have permission to perform this action.
|
||||||
|
</div>,
|
||||||
|
{
|
||||||
|
position: 'top-center',
|
||||||
|
autoClose: 5000,
|
||||||
|
hideProgressBar: false,
|
||||||
|
closeOnClick: true,
|
||||||
|
pauseOnHover: true,
|
||||||
|
draggable: false,
|
||||||
|
progress: undefined,
|
||||||
|
theme: 'colored',
|
||||||
|
}
|
||||||
|
);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
export function useResponseErrorHandler() {
|
||||||
|
const navigate = useNavigate();
|
||||||
|
const location = useLocation();
|
||||||
|
return { defaultResponseErrorHandler: defaultResponseErrorHandler(navigate, location) };
|
||||||
|
}
|
||||||
@@ -65,7 +65,34 @@ function axiosResponseToFetchResponse(response: AxiosResponse): Response {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return new Response(response.data, {
|
// Normalize Axios response.data to a Fetch-compatible BodyInit
|
||||||
|
let body: BodyInit | null = null;
|
||||||
|
const data = response.data;
|
||||||
|
|
||||||
|
if (data == null) {
|
||||||
|
body = null;
|
||||||
|
} else if (
|
||||||
|
typeof data === 'string' ||
|
||||||
|
data instanceof Blob ||
|
||||||
|
data instanceof ArrayBuffer ||
|
||||||
|
ArrayBuffer.isView(data) ||
|
||||||
|
data instanceof FormData ||
|
||||||
|
data instanceof URLSearchParams
|
||||||
|
) {
|
||||||
|
body = data as BodyInit;
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
body = JSON.stringify(data);
|
||||||
|
if (!headers.has('content-type')) {
|
||||||
|
headers.set('content-type', 'application/json;charset=utf-8');
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
console.warn('Failed to stringify response data as JSON, falling back to string conversion.');
|
||||||
|
body = String(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Response(body, {
|
||||||
status: response.status,
|
status: response.status,
|
||||||
statusText: response.statusText,
|
statusText: response.statusText,
|
||||||
headers: headers,
|
headers: headers,
|
||||||
|
|||||||
4
apps/frontend/app/lib/constants.ts
Normal file
4
apps/frontend/app/lib/constants.ts
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
export enum SearchParamKeys {
|
||||||
|
Redirect = 'redirect',
|
||||||
|
Message = 'message',
|
||||||
|
}
|
||||||
@@ -1,9 +1,10 @@
|
|||||||
import { createContext, use, useContext, type PropsWithChildren } from 'react';
|
import { createContext, use, type PropsWithChildren } from 'react';
|
||||||
import { createTanstackApi, createApi } from '../lib/api';
|
import { createTanstackApi, createApi } from '../lib/api';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
||||||
|
import { useNavigate } from 'react-router';
|
||||||
|
|
||||||
type ApiProviderProps = PropsWithChildren<{}>;
|
type ApiProviderProps = PropsWithChildren<object>;
|
||||||
type ApiContextType = {
|
type ApiContextType = {
|
||||||
apiClient: ReturnType<typeof createApi>;
|
apiClient: ReturnType<typeof createApi>;
|
||||||
tanstackApiClient: ReturnType<typeof createTanstackApi>;
|
tanstackApiClient: ReturnType<typeof createTanstackApi>;
|
||||||
@@ -34,8 +35,14 @@ export const ApiProvider: React.FC<ApiProviderProps> = ({ children }) => {
|
|||||||
const axiosInstance = axios.create({
|
const axiosInstance = axios.create({
|
||||||
withCredentials: true,
|
withCredentials: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const internalAxiosInstance = axios.create({
|
||||||
|
withCredentials: true,
|
||||||
|
});
|
||||||
|
|
||||||
const apiClient = createApi(axiosInstance);
|
const apiClient = createApi(axiosInstance);
|
||||||
const tanstackApiClient = createTanstackApi(axiosInstance);
|
const tanstackApiClient = createTanstackApi(internalAxiosInstance);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<QueryClientProvider client={queryClient}>
|
<QueryClientProvider client={queryClient}>
|
||||||
<ApiContext
|
<ApiContext
|
||||||
|
|||||||
18
apps/frontend/app/providers/FormProvider.tsx
Normal file
18
apps/frontend/app/providers/FormProvider.tsx
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
import { createFormHook, createFormHookContexts } from '@tanstack/react-form';
|
||||||
|
import { TextField, TextFieldErrorMessage } from '../components/Form/TextField';
|
||||||
|
import { ResetButton, SubmitButton } from '../components/Form/Button';
|
||||||
|
|
||||||
|
const { fieldContext, formContext } = createFormHookContexts();
|
||||||
|
|
||||||
|
export const formHook = createFormHook({
|
||||||
|
fieldComponents: {
|
||||||
|
TextField,
|
||||||
|
TextFieldErrorMessage,
|
||||||
|
},
|
||||||
|
formComponents: {
|
||||||
|
SubmitButton,
|
||||||
|
ResetButton,
|
||||||
|
},
|
||||||
|
fieldContext,
|
||||||
|
formContext,
|
||||||
|
});
|
||||||
38
apps/frontend/app/providers/LayoutProvider.tsx
Normal file
38
apps/frontend/app/providers/LayoutProvider.tsx
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
import { createContext, use, useState, type PropsWithChildren } from 'react';
|
||||||
|
import type { NavItem } from '../components/layout/types';
|
||||||
|
|
||||||
|
type LayoutProviderProps = PropsWithChildren<object>;
|
||||||
|
type LayoutContextType = {
|
||||||
|
activeTab: NavItem;
|
||||||
|
setActiveTab: (tab: NavItem) => void;
|
||||||
|
isMobileMenuOpen: boolean;
|
||||||
|
setIsMobileMenuOpen: (open: boolean) => void;
|
||||||
|
};
|
||||||
|
|
||||||
|
const LayoutContext = createContext<LayoutContextType | null>(null);
|
||||||
|
|
||||||
|
export const LayoutProvider: React.FC<LayoutProviderProps> = ({ children }) => {
|
||||||
|
const [activeTab, setActiveTab] = useState<NavItem>('Dashboard');
|
||||||
|
const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<LayoutContext
|
||||||
|
value={{
|
||||||
|
activeTab,
|
||||||
|
setActiveTab,
|
||||||
|
isMobileMenuOpen,
|
||||||
|
setIsMobileMenuOpen,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</LayoutContext>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export function useLayout() {
|
||||||
|
const context = use(LayoutContext);
|
||||||
|
if (!context) {
|
||||||
|
throw new Error('useLayout must be used within a LayoutProvider');
|
||||||
|
}
|
||||||
|
return context;
|
||||||
|
}
|
||||||
@@ -1,8 +1,11 @@
|
|||||||
import { isRouteErrorResponse, Links, Meta, Outlet, Scripts, ScrollRestoration } from 'react-router';
|
import { isRouteErrorResponse, Links, Meta, Outlet, Scripts, ScrollRestoration } from 'react-router';
|
||||||
import type { Route } from './+types/root';
|
import type { Route } from './+types/root';
|
||||||
|
import '@radix-ui/themes/styles.css';
|
||||||
import './app.css';
|
import './app.css';
|
||||||
import { Theme } from '@radix-ui/themes';
|
import AppTheme from './components/theme';
|
||||||
import { ApiProvider } from './providers/ApiProvider';
|
import { ApiProvider } from './providers/ApiProvider';
|
||||||
|
import { LayoutProvider } from './providers/LayoutProvider';
|
||||||
|
import { Tooltip } from 'radix-ui';
|
||||||
|
|
||||||
export const links: Route.LinksFunction = () => [];
|
export const links: Route.LinksFunction = () => [];
|
||||||
|
|
||||||
@@ -26,11 +29,15 @@ export function Layout({ children }: { children: React.ReactNode }) {
|
|||||||
|
|
||||||
export default function App() {
|
export default function App() {
|
||||||
return (
|
return (
|
||||||
<Theme>
|
<AppTheme>
|
||||||
<ApiProvider>
|
<ApiProvider>
|
||||||
<Outlet />
|
<Tooltip.Provider delayDuration={250}>
|
||||||
|
<LayoutProvider>
|
||||||
|
<Outlet />
|
||||||
|
</LayoutProvider>
|
||||||
|
</Tooltip.Provider>
|
||||||
</ApiProvider>
|
</ApiProvider>
|
||||||
</Theme>
|
</AppTheme>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
import { type RouteConfig, index, route } from '@react-router/dev/routes';
|
import { type RouteConfig, index, layout, route } from '@react-router/dev/routes';
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
index('routes/home.tsx'),
|
route('login', 'routes/auth/login.tsx'),
|
||||||
|
route('init', 'routes/init.tsx'),
|
||||||
|
layout('routes/layout.tsx', [index('routes/home.tsx')]),
|
||||||
// catch-all 404 route
|
// catch-all 404 route
|
||||||
route('*', 'routes/404.tsx'),
|
route('*', 'routes/404.tsx'),
|
||||||
] satisfies RouteConfig;
|
] satisfies RouteConfig;
|
||||||
|
|||||||
183
apps/frontend/app/routes/auth/login.tsx
Normal file
183
apps/frontend/app/routes/auth/login.tsx
Normal file
@@ -0,0 +1,183 @@
|
|||||||
|
import { Box, Container, Flex, Heading } from '@radix-ui/themes';
|
||||||
|
import { useMutation } from '@tanstack/react-query';
|
||||||
|
import { useLocation, useNavigate } from 'react-router';
|
||||||
|
import { Slide, toast, ToastContainer } from 'react-toastify';
|
||||||
|
import * as v from 'valibot';
|
||||||
|
import { useResponseErrorHandler } from '../../hooks/ResponseHelper';
|
||||||
|
import { useApi } from '../../providers/ApiProvider';
|
||||||
|
import { formHook } from '../../providers/FormProvider';
|
||||||
|
import type { Route } from './+types/login';
|
||||||
|
import { SearchParamKeys } from '../../lib/constants';
|
||||||
|
import { useEffect, useState } from 'react';
|
||||||
|
import { AxiosError } from 'axios';
|
||||||
|
|
||||||
|
const loginFormSchema = v.object({
|
||||||
|
username: v.pipe(v.string(), v.trim(), v.minLength(1, 'Username is required')),
|
||||||
|
password: v.pipe(v.string(), v.minLength(1, 'Password is required')),
|
||||||
|
});
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-empty-pattern
|
||||||
|
export function meta({}: Route.MetaArgs): Route.MetaDescriptors {
|
||||||
|
return [{ title: 'Login | YANPM' }];
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: remember me
|
||||||
|
export default function LoginRoute() {
|
||||||
|
const navigate = useNavigate();
|
||||||
|
const location = useLocation();
|
||||||
|
const { tanstackApiClient } = useApi();
|
||||||
|
const { defaultResponseErrorHandler } = useResponseErrorHandler();
|
||||||
|
const [previousSearchParamMessage, setPreviousSearchParamMessage] = useState<string>('');
|
||||||
|
|
||||||
|
const { mutateAsync: login, isPending } = useMutation({
|
||||||
|
...tanstackApiClient.mutation('post', '/api/auth/login').mutationOptions,
|
||||||
|
onSuccess: async () => {
|
||||||
|
const searchParams = new URLSearchParams(location.search);
|
||||||
|
const redirectTo = searchParams.get(SearchParamKeys.Redirect);
|
||||||
|
if (redirectTo) {
|
||||||
|
navigate(redirectTo);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
navigate('/');
|
||||||
|
},
|
||||||
|
onError: (error) => {
|
||||||
|
if (defaultResponseErrorHandler(error, { disableUnauthorizedHandling: true })) return;
|
||||||
|
if (error instanceof AxiosError && error.status === 401) {
|
||||||
|
toast.error('Invalid username or password.', {
|
||||||
|
position: 'top-center',
|
||||||
|
autoClose: 5000,
|
||||||
|
hideProgressBar: false,
|
||||||
|
closeOnClick: true,
|
||||||
|
pauseOnHover: true,
|
||||||
|
draggable: false,
|
||||||
|
progress: undefined,
|
||||||
|
theme: 'colored',
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
console.error('Login failed:', error);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const form = formHook.useAppForm({
|
||||||
|
defaultValues: {
|
||||||
|
username: '',
|
||||||
|
password: '',
|
||||||
|
},
|
||||||
|
validators: {
|
||||||
|
onBlur: loginFormSchema,
|
||||||
|
onSubmit: loginFormSchema,
|
||||||
|
},
|
||||||
|
|
||||||
|
onSubmit: async ({ value }) => {
|
||||||
|
toast.dismiss();
|
||||||
|
return await login({ body: { password: value.password, username: value.username } }).catch(() => {});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const searchParams = new URLSearchParams(location.search);
|
||||||
|
const message = searchParams.get(SearchParamKeys.Message);
|
||||||
|
if (message && message !== previousSearchParamMessage) {
|
||||||
|
setPreviousSearchParamMessage(message);
|
||||||
|
toast.info(message, {
|
||||||
|
position: 'top-center',
|
||||||
|
autoClose: 5000,
|
||||||
|
hideProgressBar: false,
|
||||||
|
closeOnClick: true,
|
||||||
|
pauseOnHover: true,
|
||||||
|
draggable: false,
|
||||||
|
progress: undefined,
|
||||||
|
theme: 'colored',
|
||||||
|
toastId: 'login-route-info-message',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, [location.search]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Flex align="center" justify="center" style={{ minHeight: 'calc(100vh - 64px)' }}>
|
||||||
|
<Container size="3" p="0">
|
||||||
|
<Box
|
||||||
|
style={{
|
||||||
|
display: 'flex',
|
||||||
|
flexDirection: 'column',
|
||||||
|
maxWidth: 420,
|
||||||
|
margin: '40px auto',
|
||||||
|
backgroundColor: 'white',
|
||||||
|
padding: 24,
|
||||||
|
borderRadius: 8,
|
||||||
|
boxShadow: '0 6px 18px rgba(15,23,42,0.2)',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Heading size="6" style={{ marginBottom: 16, alignSelf: 'center' }}>
|
||||||
|
Sign In
|
||||||
|
</Heading>
|
||||||
|
<form
|
||||||
|
onSubmit={(e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
form.handleSubmit();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<form.AppField
|
||||||
|
name="username"
|
||||||
|
children={(field) => (
|
||||||
|
<>
|
||||||
|
<field.TextField
|
||||||
|
label={'Username'}
|
||||||
|
value={field.state.value}
|
||||||
|
autoComplete="username"
|
||||||
|
spellCheck={false}
|
||||||
|
required
|
||||||
|
onChange={(e) => field.handleChange(e.target.value)}
|
||||||
|
/>
|
||||||
|
<field.TextFieldErrorMessage {...field.state.meta} />
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<form.AppField
|
||||||
|
name="password"
|
||||||
|
children={(field) => (
|
||||||
|
<>
|
||||||
|
<field.TextField
|
||||||
|
label={'Password'}
|
||||||
|
value={field.state.value}
|
||||||
|
type="password"
|
||||||
|
required
|
||||||
|
autoComplete="current-password"
|
||||||
|
onChange={(e) => field.handleChange(e.target.value)}
|
||||||
|
showPasswordToggle
|
||||||
|
/>
|
||||||
|
<field.TextFieldErrorMessage {...field.state.meta} />
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div style={{ marginTop: 18, display: 'flex', gap: 8, justifySelf: 'center' }}>
|
||||||
|
<form.SubmitButton
|
||||||
|
loading={isPending}
|
||||||
|
label={{
|
||||||
|
default: 'Sign In',
|
||||||
|
loading: 'Signing In…',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</Box>
|
||||||
|
</Container>
|
||||||
|
</Flex>
|
||||||
|
<ToastContainer
|
||||||
|
position="top-center"
|
||||||
|
autoClose={false}
|
||||||
|
newestOnTop={false}
|
||||||
|
closeOnClick
|
||||||
|
rtl={false}
|
||||||
|
pauseOnFocusLoss
|
||||||
|
draggable={false}
|
||||||
|
theme="colored"
|
||||||
|
transition={Slide}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,13 +1,73 @@
|
|||||||
import { Text } from '@radix-ui/themes';
|
import { Box, Button, Card, Flex, Grid, Heading, Text } from '@radix-ui/themes';
|
||||||
import type { Route } from './+types/home';
|
import type { Route } from './+types/home';
|
||||||
import { useContext } from 'react';
|
import TablePlaceholder from '../components/home/TablePlaceholder';
|
||||||
import { useApi } from '../providers/ApiProvider';
|
import { useLayout } from '../providers/LayoutProvider';
|
||||||
import { useQuery } from '@tanstack/react-query';
|
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-empty-pattern
|
||||||
export function meta({}: Route.MetaArgs) {
|
export function meta({}: Route.MetaArgs) {
|
||||||
return [{ title: 'YANPM' }, { name: 'description', content: 'Welcome to Yet Another Nginx Proxy Manager!' }];
|
return [{ title: 'Proxy Host Demo | YANPM' }, { name: 'description', content: 'Demo of the unified navigation paradigm.' }];
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function Home() {
|
export default function ProxyHostDemo() {
|
||||||
return <Text>Welcome to Yet Another Nginx Proxy Manager!</Text>;
|
const { activeTab } = useLayout();
|
||||||
|
return (
|
||||||
|
<Box>
|
||||||
|
<Heading size="7" mb="1">
|
||||||
|
{activeTab}
|
||||||
|
</Heading>
|
||||||
|
<Text color="gray" mb="4" as="p">
|
||||||
|
This is the {activeTab.toLowerCase()} page demo.
|
||||||
|
</Text>
|
||||||
|
|
||||||
|
<Grid columns={{ initial: '1', sm: '2', lg: '3' }} gap="4">
|
||||||
|
<Card size="2">
|
||||||
|
<Flex direction="column" gap="2">
|
||||||
|
<Text size="2" weight="bold">
|
||||||
|
Status Overview
|
||||||
|
</Text>
|
||||||
|
<Text size="2" color="gray">
|
||||||
|
Everything is running smoothly in your {activeTab.toLowerCase()} section.
|
||||||
|
</Text>
|
||||||
|
<Button variant="surface" size="1" style={{ width: 'fit-content' }} mt="1">
|
||||||
|
View Details
|
||||||
|
</Button>
|
||||||
|
</Flex>
|
||||||
|
</Card>
|
||||||
|
<Card size="2">
|
||||||
|
<Flex direction="column" gap="2">
|
||||||
|
<Text size="2" weight="bold">
|
||||||
|
Recent Activity
|
||||||
|
</Text>
|
||||||
|
<Text size="2" color="gray">
|
||||||
|
No recent changes detected in the last 24 hours.
|
||||||
|
</Text>
|
||||||
|
<Button variant="surface" size="1" style={{ width: 'fit-content' }} mt="1">
|
||||||
|
Refresh
|
||||||
|
</Button>
|
||||||
|
</Flex>
|
||||||
|
</Card>
|
||||||
|
<Card size="2">
|
||||||
|
<Flex direction="column" gap="2">
|
||||||
|
<Text size="2" weight="bold">
|
||||||
|
Quick Actions
|
||||||
|
</Text>
|
||||||
|
<Text size="2" color="gray">
|
||||||
|
Common tasks related to {activeTab.toLowerCase()} are available here.
|
||||||
|
</Text>
|
||||||
|
<Button variant="solid" size="1" style={{ width: 'fit-content' }} mt="1">
|
||||||
|
Get Started
|
||||||
|
</Button>
|
||||||
|
</Flex>
|
||||||
|
</Card>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
{activeTab === 'Proxy Hosts' && (
|
||||||
|
<Box mt="6">
|
||||||
|
<Card variant="surface">
|
||||||
|
<TablePlaceholder />
|
||||||
|
</Card>
|
||||||
|
</Box>
|
||||||
|
)}
|
||||||
|
</Box>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
170
apps/frontend/app/routes/init.tsx
Normal file
170
apps/frontend/app/routes/init.tsx
Normal file
@@ -0,0 +1,170 @@
|
|||||||
|
import { Box, Container, Flex, Heading, Text } from '@radix-ui/themes';
|
||||||
|
import { useMutation, useQuery } from '@tanstack/react-query';
|
||||||
|
import { useNavigate } from 'react-router';
|
||||||
|
import { Slide, toast, ToastContainer } from 'react-toastify';
|
||||||
|
import * as v from 'valibot';
|
||||||
|
import { useResponseErrorHandler } from '../hooks/ResponseHelper';
|
||||||
|
import { useApi } from '../providers/ApiProvider';
|
||||||
|
import { formHook } from '../providers/FormProvider';
|
||||||
|
import { TooltipContentContainer } from '../components/info';
|
||||||
|
import { SearchParamKeys } from '../lib/constants';
|
||||||
|
|
||||||
|
const initFormSchema = v.object({
|
||||||
|
username: v.pipe(v.string(), v.trim(), v.minLength(1, 'Username is required')),
|
||||||
|
password: v.pipe(v.string(), v.minLength(1, 'Password is required')),
|
||||||
|
setup_secret: v.pipe(v.string(), v.minLength(1, 'Setup secret is required')),
|
||||||
|
});
|
||||||
|
|
||||||
|
export default function InitRoute() {
|
||||||
|
const navigate = useNavigate();
|
||||||
|
const { tanstackApiClient } = useApi();
|
||||||
|
const { defaultResponseErrorHandler } = useResponseErrorHandler();
|
||||||
|
|
||||||
|
const { mutateAsync: initAdmin, isPending } = useMutation({
|
||||||
|
...tanstackApiClient.mutation('post', '/api/auth/init_admin').mutationOptions,
|
||||||
|
onSuccess: async () => {
|
||||||
|
const searchParams = new URLSearchParams();
|
||||||
|
searchParams.set(SearchParamKeys.Message, 'Initialization successful. Please log in.');
|
||||||
|
navigate(`/login?${searchParams.toString()}`);
|
||||||
|
},
|
||||||
|
onError: (error) => {
|
||||||
|
if (defaultResponseErrorHandler(error)) return;
|
||||||
|
console.error('Init failed:', error);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const { queryOptions: healthInfoQuery } = tanstackApiClient.get('/api/health/info');
|
||||||
|
useQuery({
|
||||||
|
...healthInfoQuery,
|
||||||
|
queryFn: async (...args) => {
|
||||||
|
try {
|
||||||
|
const data = await healthInfoQuery.queryFn!(...args);
|
||||||
|
if (data.is_initialized) {
|
||||||
|
navigate('/');
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
} catch (error) {
|
||||||
|
if (defaultResponseErrorHandler(error)) return {} as never;
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const form = formHook.useAppForm({
|
||||||
|
defaultValues: { username: '', password: '', setup_secret: '' },
|
||||||
|
validators: { onBlur: initFormSchema, onSubmit: initFormSchema },
|
||||||
|
onSubmit: async ({ value }) => {
|
||||||
|
toast.dismiss();
|
||||||
|
return await initAdmin({ body: { username: value.username, password: value.password, setup_secret: value.setup_secret } });
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Flex align="center" justify="center" style={{ minHeight: 'calc(100vh - 64px)' }}>
|
||||||
|
<Container size="3" p="0">
|
||||||
|
<Box
|
||||||
|
style={{
|
||||||
|
display: 'flex',
|
||||||
|
flexDirection: 'column',
|
||||||
|
maxWidth: 480,
|
||||||
|
margin: '40px auto',
|
||||||
|
backgroundColor: 'white',
|
||||||
|
padding: 24,
|
||||||
|
borderRadius: 8,
|
||||||
|
boxShadow: '0 6px 18px rgba(15,23,42,0.06)',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Heading size="6" style={{ marginBottom: 12, alignSelf: 'center' }}>
|
||||||
|
Initialize YANPM
|
||||||
|
</Heading>
|
||||||
|
|
||||||
|
<Heading size="3" style={{ marginBottom: 24, color: 'var(--gray-11)', alignSelf: 'center' }}>
|
||||||
|
Create the initial admin user
|
||||||
|
</Heading>
|
||||||
|
<form
|
||||||
|
onSubmit={(e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
form.handleSubmit();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<form.AppField
|
||||||
|
name="username"
|
||||||
|
children={(field) => (
|
||||||
|
<>
|
||||||
|
<field.TextField
|
||||||
|
label="Username"
|
||||||
|
value={field.state.value}
|
||||||
|
autoComplete="username"
|
||||||
|
spellCheck={false}
|
||||||
|
required
|
||||||
|
onChange={(e) => field.handleChange(e.target.value)}
|
||||||
|
/>
|
||||||
|
<field.TextFieldErrorMessage {...field.state.meta} />
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<form.AppField
|
||||||
|
name="password"
|
||||||
|
children={(field) => (
|
||||||
|
<>
|
||||||
|
<field.TextField
|
||||||
|
label="Password"
|
||||||
|
value={field.state.value}
|
||||||
|
type="password"
|
||||||
|
required
|
||||||
|
autoComplete="new-password"
|
||||||
|
onChange={(e) => field.handleChange(e.target.value)}
|
||||||
|
showPasswordToggle
|
||||||
|
/>
|
||||||
|
<field.TextFieldErrorMessage {...field.state.meta} />
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<form.AppField
|
||||||
|
name="setup_secret"
|
||||||
|
children={(field) => (
|
||||||
|
<>
|
||||||
|
<field.TextField
|
||||||
|
label="Setup Secret"
|
||||||
|
value={field.state.value}
|
||||||
|
required
|
||||||
|
onChange={(e) => field.handleChange(e.target.value)}
|
||||||
|
infoIconProps={{
|
||||||
|
children: (
|
||||||
|
<TooltipContentContainer>
|
||||||
|
<Text>This secret is provided when the API server is first started. Refer to your server logs to find it.</Text>
|
||||||
|
</TooltipContentContainer>
|
||||||
|
),
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<field.TextFieldErrorMessage {...field.state.meta} />
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div style={{ marginTop: 18, display: 'flex', gap: 8, justifySelf: 'center' }}>
|
||||||
|
<form.SubmitButton loading={isPending} label={{ default: 'Initialize' }} />
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</Box>
|
||||||
|
</Container>
|
||||||
|
</Flex>
|
||||||
|
|
||||||
|
<ToastContainer
|
||||||
|
position="top-center"
|
||||||
|
autoClose={false}
|
||||||
|
newestOnTop={false}
|
||||||
|
closeOnClick
|
||||||
|
rtl={false}
|
||||||
|
pauseOnFocusLoss
|
||||||
|
draggable={false}
|
||||||
|
theme="colored"
|
||||||
|
transition={Slide}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
88
apps/frontend/app/routes/layout.tsx
Normal file
88
apps/frontend/app/routes/layout.tsx
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
import { Flex, Box, Container, Dialog, Heading, IconButton, TextField } from '@radix-ui/themes';
|
||||||
|
import SidebarContent from '../components/layout/SidebarContent';
|
||||||
|
import { useLayout } from '../providers/LayoutProvider';
|
||||||
|
import { Menu, Search, Bell } from 'lucide-react';
|
||||||
|
import { Outlet } from 'react-router';
|
||||||
|
|
||||||
|
export default function LayoutContainer() {
|
||||||
|
const { activeTab, isMobileMenuOpen, setIsMobileMenuOpen } = useLayout();
|
||||||
|
return (
|
||||||
|
<Flex style={{ minHeight: '100vh', backgroundColor: 'var(--gray-2)' }}>
|
||||||
|
{/* Desktop Sidebar */}
|
||||||
|
<Box
|
||||||
|
display={{ initial: 'none', md: 'block' }}
|
||||||
|
style={{
|
||||||
|
width: '260px',
|
||||||
|
backgroundColor: 'white',
|
||||||
|
borderRight: '1px solid var(--gray-4)',
|
||||||
|
position: 'sticky',
|
||||||
|
top: 0,
|
||||||
|
minHeight: '100vh',
|
||||||
|
overflowY: 'auto',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<SidebarContent />
|
||||||
|
</Box>
|
||||||
|
|
||||||
|
{/* Main Content Area */}
|
||||||
|
<Box style={{ flex: 1, minWidth: 0 }}>
|
||||||
|
{' '}
|
||||||
|
{/* Top Header (Mobile & Desktop) */}
|
||||||
|
<Flex
|
||||||
|
align="center"
|
||||||
|
justify="between"
|
||||||
|
px="4"
|
||||||
|
style={{
|
||||||
|
height: '64px',
|
||||||
|
backgroundColor: 'white',
|
||||||
|
borderBottom: '1px solid var(--gray-4)',
|
||||||
|
position: 'sticky',
|
||||||
|
top: 0,
|
||||||
|
zIndex: 10,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Flex align="center" gap="3">
|
||||||
|
<Box display={{ md: 'none' }}>
|
||||||
|
<Dialog.Root open={isMobileMenuOpen} onOpenChange={setIsMobileMenuOpen}>
|
||||||
|
<Dialog.Trigger>
|
||||||
|
<IconButton variant="ghost" color="gray">
|
||||||
|
<Menu />
|
||||||
|
</IconButton>
|
||||||
|
</Dialog.Trigger>
|
||||||
|
<Dialog.Content
|
||||||
|
style={{
|
||||||
|
position: 'fixed',
|
||||||
|
left: 0,
|
||||||
|
top: 0,
|
||||||
|
bottom: 0,
|
||||||
|
margin: 0,
|
||||||
|
width: '280px',
|
||||||
|
borderRadius: 0,
|
||||||
|
padding: 0,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<SidebarContent />
|
||||||
|
</Dialog.Content>
|
||||||
|
</Dialog.Root>
|
||||||
|
</Box>
|
||||||
|
<Heading size="4">{activeTab}</Heading>
|
||||||
|
</Flex>
|
||||||
|
|
||||||
|
<Flex align="center" gap="3">
|
||||||
|
<TextField.Root placeholder="Search..." size="2">
|
||||||
|
<TextField.Slot>
|
||||||
|
<Search />
|
||||||
|
</TextField.Slot>
|
||||||
|
</TextField.Root>
|
||||||
|
<IconButton variant="ghost" color="gray">
|
||||||
|
<Bell />
|
||||||
|
</IconButton>
|
||||||
|
</Flex>
|
||||||
|
</Flex>
|
||||||
|
<Container size="4" p="5" style={{ paddingTop: 20 }}>
|
||||||
|
<Outlet />
|
||||||
|
</Container>
|
||||||
|
</Box>
|
||||||
|
</Flex>
|
||||||
|
);
|
||||||
|
}
|
||||||
5
apps/frontend/app/vite-env.d.ts
vendored
5
apps/frontend/app/vite-env.d.ts
vendored
@@ -1,7 +1,6 @@
|
|||||||
interface ViteTypeOptions {
|
interface ViteTypeOptions {
|
||||||
// By adding this line, you can make the type of ImportMetaEnv strict
|
// disallow unknown keys.
|
||||||
// to disallow unknown keys.
|
strictImportMetaEnv: unknown;
|
||||||
// strictImportMetaEnv: unknown
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ImportMetaEnv {
|
interface ImportMetaEnv {
|
||||||
|
|||||||
@@ -21,9 +21,6 @@ export default tseslint.config(
|
|||||||
tsconfigRootDir: import.meta.dirname,
|
tsconfigRootDir: import.meta.dirname,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {},
|
||||||
// Add custom rules here
|
|
||||||
'no-console': 'warn',
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -12,17 +12,22 @@
|
|||||||
"generate:openapi": "typed-openapi ../api/swagger.json --tanstack tanstack-client.ts -o ./app/generated/api-client/api-client.ts"
|
"generate:openapi": "typed-openapi ../api/swagger.json --tanstack tanstack-client.ts -o ./app/generated/api-client/api-client.ts"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@radix-ui/react-tooltip": "^1.2.8",
|
||||||
"@radix-ui/themes": "^3.2.1",
|
"@radix-ui/themes": "^3.2.1",
|
||||||
"@react-router/node": "^7.9.2",
|
"@react-router/node": "^7.9.2",
|
||||||
"@react-router/serve": "^7.9.2",
|
"@react-router/serve": "^7.9.2",
|
||||||
|
"@tanstack/react-form": "^1.27.5",
|
||||||
"@tanstack/react-query": "^5.90.12",
|
"@tanstack/react-query": "^5.90.12",
|
||||||
"axios": "^1.13.2",
|
"axios": "^1.13.2",
|
||||||
"globals": "^16.5.0",
|
"globals": "^16.5.0",
|
||||||
"isbot": "^5.1.31",
|
"isbot": "^5.1.31",
|
||||||
|
"lucide-react": "^0.562.0",
|
||||||
"radix-ui": "^1.4.3",
|
"radix-ui": "^1.4.3",
|
||||||
"react": "^19.1.1",
|
"react": "^19.1.1",
|
||||||
"react-dom": "^19.1.1",
|
"react-dom": "^19.1.1",
|
||||||
"react-router": "^7.9.2"
|
"react-router": "^7.9.2",
|
||||||
|
"react-toastify": "^11.0.5",
|
||||||
|
"valibot": "^1.2.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@eslint/js": "^9.39.2",
|
"@eslint/js": "^9.39.2",
|
||||||
|
|||||||
103
apps/frontend/pnpm-lock.yaml
generated
103
apps/frontend/pnpm-lock.yaml
generated
@@ -8,6 +8,9 @@ importers:
|
|||||||
|
|
||||||
.:
|
.:
|
||||||
dependencies:
|
dependencies:
|
||||||
|
'@radix-ui/react-tooltip':
|
||||||
|
specifier: ^1.2.8
|
||||||
|
version: 1.2.8(@types/react-dom@19.2.3(@types/react@19.2.7))(@types/react@19.2.7)(react-dom@19.2.0(react@19.2.0))(react@19.2.0)
|
||||||
'@radix-ui/themes':
|
'@radix-ui/themes':
|
||||||
specifier: ^3.2.1
|
specifier: ^3.2.1
|
||||||
version: 3.2.1(@types/react-dom@19.2.3(@types/react@19.2.7))(@types/react@19.2.7)(react-dom@19.2.0(react@19.2.0))(react@19.2.0)
|
version: 3.2.1(@types/react-dom@19.2.3(@types/react@19.2.7))(@types/react@19.2.7)(react-dom@19.2.0(react@19.2.0))(react@19.2.0)
|
||||||
@@ -17,6 +20,9 @@ importers:
|
|||||||
'@react-router/serve':
|
'@react-router/serve':
|
||||||
specifier: ^7.9.2
|
specifier: ^7.9.2
|
||||||
version: 7.9.6(react-router@7.9.6(react-dom@19.2.0(react@19.2.0))(react@19.2.0))(typescript@5.9.3)
|
version: 7.9.6(react-router@7.9.6(react-dom@19.2.0(react@19.2.0))(react@19.2.0))(typescript@5.9.3)
|
||||||
|
'@tanstack/react-form':
|
||||||
|
specifier: ^1.27.5
|
||||||
|
version: 1.27.5(react-dom@19.2.0(react@19.2.0))(react@19.2.0)
|
||||||
'@tanstack/react-query':
|
'@tanstack/react-query':
|
||||||
specifier: ^5.90.12
|
specifier: ^5.90.12
|
||||||
version: 5.90.12(react@19.2.0)
|
version: 5.90.12(react@19.2.0)
|
||||||
@@ -29,6 +35,9 @@ importers:
|
|||||||
isbot:
|
isbot:
|
||||||
specifier: ^5.1.31
|
specifier: ^5.1.31
|
||||||
version: 5.1.32
|
version: 5.1.32
|
||||||
|
lucide-react:
|
||||||
|
specifier: ^0.562.0
|
||||||
|
version: 0.562.0(react@19.2.0)
|
||||||
radix-ui:
|
radix-ui:
|
||||||
specifier: ^1.4.3
|
specifier: ^1.4.3
|
||||||
version: 1.4.3(@types/react-dom@19.2.3(@types/react@19.2.7))(@types/react@19.2.7)(react-dom@19.2.0(react@19.2.0))(react@19.2.0)
|
version: 1.4.3(@types/react-dom@19.2.3(@types/react@19.2.7))(@types/react@19.2.7)(react-dom@19.2.0(react@19.2.0))(react@19.2.0)
|
||||||
@@ -41,6 +50,12 @@ importers:
|
|||||||
react-router:
|
react-router:
|
||||||
specifier: ^7.9.2
|
specifier: ^7.9.2
|
||||||
version: 7.9.6(react-dom@19.2.0(react@19.2.0))(react@19.2.0)
|
version: 7.9.6(react-dom@19.2.0(react@19.2.0))(react@19.2.0)
|
||||||
|
react-toastify:
|
||||||
|
specifier: ^11.0.5
|
||||||
|
version: 11.0.5(react-dom@19.2.0(react@19.2.0))(react@19.2.0)
|
||||||
|
valibot:
|
||||||
|
specifier: ^1.2.0
|
||||||
|
version: 1.2.0(typescript@5.9.3)
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@eslint/js':
|
'@eslint/js':
|
||||||
specifier: ^9.39.2
|
specifier: ^9.39.2
|
||||||
@@ -1482,14 +1497,46 @@ packages:
|
|||||||
peerDependencies:
|
peerDependencies:
|
||||||
vite: ^5.2.0 || ^6 || ^7
|
vite: ^5.2.0 || ^6 || ^7
|
||||||
|
|
||||||
|
'@tanstack/devtools-event-client@0.4.0':
|
||||||
|
resolution: {integrity: sha512-RPfGuk2bDZgcu9bAJodvO2lnZeHuz4/71HjZ0bGb/SPg8+lyTA+RLSKQvo7fSmPSi8/vcH3aKQ8EM9ywf1olaw==}
|
||||||
|
engines: {node: '>=18'}
|
||||||
|
|
||||||
|
'@tanstack/form-core@1.27.5':
|
||||||
|
resolution: {integrity: sha512-A8EriWfn+2QsxEbzt6AXn6CC6ILv3VPDXhBDAeE5LTiCHryy7xuj+zo1Q2JWBkhJxS1AuEgY1BZr5AP2mWiHQQ==}
|
||||||
|
|
||||||
|
'@tanstack/pacer-lite@0.1.1':
|
||||||
|
resolution: {integrity: sha512-y/xtNPNt/YeyoVxE/JCx+T7yjEzpezmbb+toK8DDD1P4m7Kzs5YR956+7OKexG3f8aXgC3rLZl7b1V+yNUSy5w==}
|
||||||
|
engines: {node: '>=18'}
|
||||||
|
|
||||||
'@tanstack/query-core@5.90.12':
|
'@tanstack/query-core@5.90.12':
|
||||||
resolution: {integrity: sha512-T1/8t5DhV/SisWjDnaiU2drl6ySvsHj1bHBCWNXd+/T+Hh1cf6JodyEYMd5sgwm+b/mETT4EV3H+zCVczCU5hg==}
|
resolution: {integrity: sha512-T1/8t5DhV/SisWjDnaiU2drl6ySvsHj1bHBCWNXd+/T+Hh1cf6JodyEYMd5sgwm+b/mETT4EV3H+zCVczCU5hg==}
|
||||||
|
|
||||||
|
'@tanstack/react-form@1.27.5':
|
||||||
|
resolution: {integrity: sha512-B0nSrlOh4+i/zq2U2ezyRYVz4+6vVzviVAFSZL3FCrJiwryEPM4/0E/RpwkbMZiY2UHp/4KHenPcBQZGhXS+tw==}
|
||||||
|
peerDependencies:
|
||||||
|
'@tanstack/react-start': '*'
|
||||||
|
react: ^17.0.0 || ^18.0.0 || ^19.0.0
|
||||||
|
peerDependenciesMeta:
|
||||||
|
'@tanstack/react-start':
|
||||||
|
optional: true
|
||||||
|
|
||||||
'@tanstack/react-query@5.90.12':
|
'@tanstack/react-query@5.90.12':
|
||||||
resolution: {integrity: sha512-graRZspg7EoEaw0a8faiUASCyJrqjKPdqJ9EwuDRUF9mEYJ1YPczI9H+/agJ0mOJkPCJDk0lsz5QTrLZ/jQ2rg==}
|
resolution: {integrity: sha512-graRZspg7EoEaw0a8faiUASCyJrqjKPdqJ9EwuDRUF9mEYJ1YPczI9H+/agJ0mOJkPCJDk0lsz5QTrLZ/jQ2rg==}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
react: ^18 || ^19
|
react: ^18 || ^19
|
||||||
|
|
||||||
|
'@tanstack/react-store@0.8.0':
|
||||||
|
resolution: {integrity: sha512-1vG9beLIuB7q69skxK9r5xiLN3ztzIPfSQSs0GfeqWGO2tGIyInZx0x1COhpx97RKaONSoAb8C3dxacWksm1ow==}
|
||||||
|
peerDependencies:
|
||||||
|
react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0
|
||||||
|
react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0
|
||||||
|
|
||||||
|
'@tanstack/store@0.7.7':
|
||||||
|
resolution: {integrity: sha512-xa6pTan1bcaqYDS9BDpSiS63qa6EoDkPN9RsRaxHuDdVDNntzq3xNwR5YKTU/V3SkSyC9T4YVOPh2zRQN0nhIQ==}
|
||||||
|
|
||||||
|
'@tanstack/store@0.8.0':
|
||||||
|
resolution: {integrity: sha512-Om+BO0YfMZe//X2z0uLF2j+75nQga6TpTJgLJQBiq85aOyZNIhkCgleNcud2KQg4k4v9Y9l+Uhru3qWMPGTOzQ==}
|
||||||
|
|
||||||
'@types/eslint@8.56.12':
|
'@types/eslint@8.56.12':
|
||||||
resolution: {integrity: sha512-03ruubjWyOHlmljCVoxSuNDdmfZDzsrrz0P2LeJsOXr+ZwFQ+0yQIwNCwt/GYhV7Z31fgtXJTAEs+FYlEL851g==}
|
resolution: {integrity: sha512-03ruubjWyOHlmljCVoxSuNDdmfZDzsrrz0P2LeJsOXr+ZwFQ+0yQIwNCwt/GYhV7Z31fgtXJTAEs+FYlEL851g==}
|
||||||
|
|
||||||
@@ -1744,6 +1791,10 @@ packages:
|
|||||||
classnames@2.5.1:
|
classnames@2.5.1:
|
||||||
resolution: {integrity: sha512-saHYOzhIQs6wy2sVxTM6bUDsQO4F50V9RQ22qBpEdCW+I+/Wmke2HOl6lS6dTpdxVhb88/I6+Hs+438c3lfUow==}
|
resolution: {integrity: sha512-saHYOzhIQs6wy2sVxTM6bUDsQO4F50V9RQ22qBpEdCW+I+/Wmke2HOl6lS6dTpdxVhb88/I6+Hs+438c3lfUow==}
|
||||||
|
|
||||||
|
clsx@2.1.1:
|
||||||
|
resolution: {integrity: sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==}
|
||||||
|
engines: {node: '>=6'}
|
||||||
|
|
||||||
color-convert@2.0.1:
|
color-convert@2.0.1:
|
||||||
resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==}
|
resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==}
|
||||||
engines: {node: '>=7.0.0'}
|
engines: {node: '>=7.0.0'}
|
||||||
@@ -2501,6 +2552,11 @@ packages:
|
|||||||
resolution: {integrity: sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==}
|
resolution: {integrity: sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==}
|
||||||
engines: {node: '>=12'}
|
engines: {node: '>=12'}
|
||||||
|
|
||||||
|
lucide-react@0.562.0:
|
||||||
|
resolution: {integrity: sha512-82hOAu7y0dbVuFfmO4bYF1XEwYk/mEbM5E+b1jgci/udUBEE/R7LF5Ip0CCEmXe8AybRM8L+04eP+LGZeDvkiw==}
|
||||||
|
peerDependencies:
|
||||||
|
react: ^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0
|
||||||
|
|
||||||
magic-string@0.30.21:
|
magic-string@0.30.21:
|
||||||
resolution: {integrity: sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==}
|
resolution: {integrity: sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==}
|
||||||
|
|
||||||
@@ -2854,6 +2910,12 @@ packages:
|
|||||||
'@types/react':
|
'@types/react':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
|
react-toastify@11.0.5:
|
||||||
|
resolution: {integrity: sha512-EpqHBGvnSTtHYhCPLxML05NLY2ZX0JURbAdNYa6BUkk+amz4wbKBQvoKQAB0ardvSarUBuY4Q4s1sluAzZwkmA==}
|
||||||
|
peerDependencies:
|
||||||
|
react: ^18 || ^19
|
||||||
|
react-dom: ^18 || ^19
|
||||||
|
|
||||||
react@19.2.0:
|
react@19.2.0:
|
||||||
resolution: {integrity: sha512-tmbWg6W31tQLeB5cdIBOicJDJRR2KzXsV7uSK9iNfLWQ5bIZfxuPEHp7M8wiHyHnn0DD1i7w3Zmin0FtkrwoCQ==}
|
resolution: {integrity: sha512-tmbWg6W31tQLeB5cdIBOicJDJRR2KzXsV7uSK9iNfLWQ5bIZfxuPEHp7M8wiHyHnn0DD1i7w3Zmin0FtkrwoCQ==}
|
||||||
engines: {node: '>=0.10.0'}
|
engines: {node: '>=0.10.0'}
|
||||||
@@ -4761,13 +4823,42 @@ snapshots:
|
|||||||
tailwindcss: 4.1.17
|
tailwindcss: 4.1.17
|
||||||
vite: 7.2.6(@types/node@22.19.1)(jiti@2.6.1)(lightningcss@1.30.2)(yaml@2.8.2)
|
vite: 7.2.6(@types/node@22.19.1)(jiti@2.6.1)(lightningcss@1.30.2)(yaml@2.8.2)
|
||||||
|
|
||||||
|
'@tanstack/devtools-event-client@0.4.0': {}
|
||||||
|
|
||||||
|
'@tanstack/form-core@1.27.5':
|
||||||
|
dependencies:
|
||||||
|
'@tanstack/devtools-event-client': 0.4.0
|
||||||
|
'@tanstack/pacer-lite': 0.1.1
|
||||||
|
'@tanstack/store': 0.7.7
|
||||||
|
|
||||||
|
'@tanstack/pacer-lite@0.1.1': {}
|
||||||
|
|
||||||
'@tanstack/query-core@5.90.12': {}
|
'@tanstack/query-core@5.90.12': {}
|
||||||
|
|
||||||
|
'@tanstack/react-form@1.27.5(react-dom@19.2.0(react@19.2.0))(react@19.2.0)':
|
||||||
|
dependencies:
|
||||||
|
'@tanstack/form-core': 1.27.5
|
||||||
|
'@tanstack/react-store': 0.8.0(react-dom@19.2.0(react@19.2.0))(react@19.2.0)
|
||||||
|
react: 19.2.0
|
||||||
|
transitivePeerDependencies:
|
||||||
|
- react-dom
|
||||||
|
|
||||||
'@tanstack/react-query@5.90.12(react@19.2.0)':
|
'@tanstack/react-query@5.90.12(react@19.2.0)':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@tanstack/query-core': 5.90.12
|
'@tanstack/query-core': 5.90.12
|
||||||
react: 19.2.0
|
react: 19.2.0
|
||||||
|
|
||||||
|
'@tanstack/react-store@0.8.0(react-dom@19.2.0(react@19.2.0))(react@19.2.0)':
|
||||||
|
dependencies:
|
||||||
|
'@tanstack/store': 0.8.0
|
||||||
|
react: 19.2.0
|
||||||
|
react-dom: 19.2.0(react@19.2.0)
|
||||||
|
use-sync-external-store: 1.6.0(react@19.2.0)
|
||||||
|
|
||||||
|
'@tanstack/store@0.7.7': {}
|
||||||
|
|
||||||
|
'@tanstack/store@0.8.0': {}
|
||||||
|
|
||||||
'@types/eslint@8.56.12':
|
'@types/eslint@8.56.12':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/estree': 1.0.8
|
'@types/estree': 1.0.8
|
||||||
@@ -5098,6 +5189,8 @@ snapshots:
|
|||||||
|
|
||||||
classnames@2.5.1: {}
|
classnames@2.5.1: {}
|
||||||
|
|
||||||
|
clsx@2.1.1: {}
|
||||||
|
|
||||||
color-convert@2.0.1:
|
color-convert@2.0.1:
|
||||||
dependencies:
|
dependencies:
|
||||||
color-name: 1.1.4
|
color-name: 1.1.4
|
||||||
@@ -5962,6 +6055,10 @@ snapshots:
|
|||||||
|
|
||||||
lru-cache@7.18.3: {}
|
lru-cache@7.18.3: {}
|
||||||
|
|
||||||
|
lucide-react@0.562.0(react@19.2.0):
|
||||||
|
dependencies:
|
||||||
|
react: 19.2.0
|
||||||
|
|
||||||
magic-string@0.30.21:
|
magic-string@0.30.21:
|
||||||
dependencies:
|
dependencies:
|
||||||
'@jridgewell/sourcemap-codec': 1.5.5
|
'@jridgewell/sourcemap-codec': 1.5.5
|
||||||
@@ -6323,6 +6420,12 @@ snapshots:
|
|||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
'@types/react': 19.2.7
|
'@types/react': 19.2.7
|
||||||
|
|
||||||
|
react-toastify@11.0.5(react-dom@19.2.0(react@19.2.0))(react@19.2.0):
|
||||||
|
dependencies:
|
||||||
|
clsx: 2.1.1
|
||||||
|
react: 19.2.0
|
||||||
|
react-dom: 19.2.0(react@19.2.0)
|
||||||
|
|
||||||
react@19.2.0: {}
|
react@19.2.0: {}
|
||||||
|
|
||||||
readdirp@4.1.2: {}
|
readdirp@4.1.2: {}
|
||||||
|
|||||||
Reference in New Issue
Block a user