Sets up the complete mRemotify project — a browser-based remote connection manager — with a working pnpm workspace monorepo: Frontend (React + TypeScript + Vite + Ant Design 5): - Login page with JWT auth - Resizable sidebar with drag-and-drop connection tree (folders + connections) - Tabbed session area (SSH via xterm.js, RDP via guacamole-common-js) - Connection CRUD modal with SSH/RDP-specific fields - Zustand store for auth, tree data, and open sessions Backend (Fastify + TypeScript + Prisma + PostgreSQL): - JWT authentication (login + /me endpoint) - Full CRUD REST API for folders (self-referencing) and connections - AES-256-CBC password encryption at rest - WebSocket proxy for SSH sessions (ssh2 <-> xterm.js) - WebSocket proxy for RDP sessions (guacd TCP handshake + bidirectional relay) - Admin user seeding on first start Infrastructure: - Docker Compose: postgres (healthcheck) + guacd + backend + frontend/nginx - nginx: serves SPA, proxies /api and /ws (with WebSocket upgrade) to backend - .env.example with all required variables documented Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
47 lines
1.2 KiB
TypeScript
47 lines
1.2 KiB
TypeScript
import React from 'react';
|
|
import { Layout, Typography, Dropdown, Avatar, Space } from 'antd';
|
|
import { UserOutlined, LogoutOutlined } from '@ant-design/icons';
|
|
import type { MenuProps } from 'antd';
|
|
import { useStore } from '../../store';
|
|
|
|
const { Header } = Layout;
|
|
|
|
export const TopNav: React.FC = () => {
|
|
const user = useStore((s) => s.user);
|
|
const logout = useStore((s) => s.logout);
|
|
|
|
const menuItems: MenuProps['items'] = [
|
|
{
|
|
key: 'logout',
|
|
icon: <LogoutOutlined />,
|
|
label: 'Sign out',
|
|
onClick: logout,
|
|
},
|
|
];
|
|
|
|
return (
|
|
<Header
|
|
style={{
|
|
display: 'flex',
|
|
alignItems: 'center',
|
|
justifyContent: 'space-between',
|
|
padding: '0 16px',
|
|
background: '#001529',
|
|
height: 48,
|
|
lineHeight: '48px',
|
|
}}
|
|
>
|
|
<Typography.Text strong style={{ color: '#fff', fontSize: 16 }}>
|
|
mRemotify
|
|
</Typography.Text>
|
|
|
|
<Dropdown menu={{ items: menuItems }} placement="bottomRight" arrow>
|
|
<Space style={{ cursor: 'pointer', color: '#fff' }}>
|
|
<Avatar size="small" icon={<UserOutlined />} />
|
|
<Typography.Text style={{ color: '#fff' }}>{user?.username}</Typography.Text>
|
|
</Space>
|
|
</Dropdown>
|
|
</Header>
|
|
);
|
|
};
|