Modernize frontend and centralize branding

This commit is contained in:
wfalkowski committed 2026-10-18 20:35:12 +00:00
1 parent bc4542d0fb
commit 2d61d80550
55 files changed
+1901 -14446

No files matched your search

@@ -13,6 +13,7 @@ import ServerDetailsModal from '../servers/ServerDetailsModal';
import NodeTerminalModal from './NodeTerminalModal';
import TicketSystem from '../support/TicketSystem';
import { colors } from '../../theme/colors';
import branding from '../../branding';
import { API_BASE_URL } from '../../config/api';
import {
StatTile,
@@ -1121,7 +1122,7 @@ const AdminSection = ({ user, activeTab: parentActiveTab, showAlert }) => {
>
<div className="mb-8">
<p className="text-sm text-dash-textMuted leading-relaxed max-w-2xl">
Select three customer sites to feature on the public homepage. Use full URLs (e.g., https://site.anchorhost.eu). Leaving a URL empty will hide that slot.
Select three customer sites to feature on the public homepage. Use full URLs (e.g., https://site.{branding.domain}). Leaving a URL empty will hide that slot.
</p>
</div>
@@ -1,4 +1,5 @@
import React, { useState, useEffect, useRef, useCallback } from 'react';
import branding from '../../branding';
import { createPortal } from 'react-dom';
import {
Terminal as TerminalIcon,
@@ -58,7 +59,7 @@ const NodeTerminalModal = ({ node, onClose }) => {
const connectTerminal = useCallback(() => {
if (!node || !sendMessage) return;
setIsLoading(true);
setTerminalOutput(prev => prev + `\r\n\x1b[36m[AnchorHost.eu]\x1b[0m Requesting shell session on node \x1b[1m${node.name}\x1b[0m...\r\n`);
setTerminalOutput(prev => prev + `\r\n\x1b[36m[${branding.name}]\x1b[0m Requesting shell session on node \x1b[1m${node.name}\x1b[0m...\r\n`);
sendMessage({
type: 'node_terminal_connect',
nodeName: node.name
@@ -3,6 +3,7 @@ import { createPortal } from 'react-dom';
import { Calendar, Tag, ChevronRight, X, User } from "lucide-react";
import { colors } from "../../theme/colors";
import { API_BASE_URL } from '../../config/api';
import branding from '../../branding';
const AnnouncementModal = ({ announcement, onClose }) => {
const dialogRef = useRef(null);
@@ -194,7 +195,7 @@ const AnnouncementsSection = () => {
<section id="announcements" className="site-section site-announcements">
<div className="site-section-heading">
<div><p className="site-kicker">Platform updates</p><h2>Latest announcements.</h2></div>
<p>Service changes and notes from the AnchorHost.eu team.</p>
<p>Service changes and notes from the {branding.name} team.</p>
</div>
<div className="site-announcement-list">
{displayedAnnouncements.map((item) => (
@@ -4,6 +4,7 @@ import { ArrowLeft } from 'lucide-react';
import { DashboardViewShell, PageHeaderBar, ActionButton } from '../../components/dashboardPrimitives';
import { dashLayout } from '../../theme/dashboardTokens';
import { colors } from '../../theme/colors';
import branding from '../../branding';
/**
* Shared chrome for Terms / Privacy: dashboard shell, dash borders, typography.
@@ -26,9 +27,9 @@ export function LegalPageShell({ title, icon: Icon, accentColor = colors.blue, l
className="flex items-center gap-3 min-w-0 text-left rounded-xl focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/45 group"
>
<div className="p-2 rounded-lg bg-white/5 border border-white/10 group-hover:scale-110 transition-transform">
<img src="./assets/transparent_anchorhost.png" alt="" className="h-6 w-auto shrink-0" />
<img src={branding.logoPath} alt="" className="h-6 w-auto shrink-0" />
</div>
<span className="text-xl font-bold text-dash-text truncate tracking-tight">AnchorHost.eu</span>
<span className="text-xl font-bold text-dash-text truncate tracking-tight">{branding.name}</span>
</button>
<ActionButton variant="secondary" className="!min-h-0 !px-4 !py-2.5 !text-sm !font-bold !rounded-xl" onClick={() => navigate('/')}>
<ArrowLeft className="w-4 h-4 shrink-0 mr-2" aria-hidden />
@@ -51,7 +52,7 @@ export function LegalPageShell({ title, icon: Icon, accentColor = colors.blue, l
<div className="text-center pt-8 border-t border-dash-border">
<p className="text-xs font-bold text-dash-textMuted uppercase tracking-[0.3em] opacity-40">
© {new Date().getFullYear()} AnchorHost.eu • High-Performance Cloud Solutions
© {new Date().getFullYear()} {branding.name} • {branding.footerDescription}
</p>
</div>
</div>
@@ -5,6 +5,7 @@ import { colors } from '../../theme/colors';
import { Dropdown } from '../../components/dashboardPrimitives';
import { API_BASE_URL, WS_BASE_URL as WS_URL } from '../../config/api';
import branding from '../../branding';
function PluginDetails() {
const { pluginId } = useParams();
@@ -34,7 +35,7 @@ function PluginDetails() {
`${API_BASE_URL}/api/modrinth/project/${pluginId}`,
{
headers: {
'User-Agent': 'AnchorHost.eu/1.0'
'User-Agent': `${branding.name}/1.0`
}
}
);
File renamed without changes.
@@ -5,6 +5,7 @@ import {
import { colors, Dropdown, SectionCard, minecraftVersions } from '../../components/DashboardComponents';
import { API_BASE_URL } from '../../config/api';
import branding from '../../branding';
// Embedded Plugin Store Component for Dashboard
const PluginStoreEmbedded = ({ serverId }) => {
@@ -34,7 +35,7 @@ const PluginStoreEmbedded = ({ serverId }) => {
`${API_BASE_URL}/api/modrinth/project/${pluginId}`,
{
headers: {
'User-Agent': 'AnchorHost.eu/1.0'
'User-Agent': `${branding.name}/1.0`
}
}
);
@@ -398,4 +399,4 @@ const PluginStoreEmbedded = ({ serverId }) => {
);
};
export default PluginStoreEmbedded;
export default PluginStoreEmbedded;
File renamed without changes.
@@ -4,7 +4,7 @@ import {
Folder, File, FolderOpen, Upload, Download, Edit, FolderPlus, FileText, Archive, Image,
ChevronLeft, ChevronRight, Search, Check, Trash2, Copy, X, RefreshCw, CheckCircle
} from "lucide-react";
import { colors, UnifiedTooltip, CustomTooltip } from '../../components/DashboardComponents.js';
import { colors, UnifiedTooltip, CustomTooltip } from '../../components/DashboardComponents.jsx';
// File Manager Component with forwardRef
const FileManager = forwardRef(({ serverId, serverImage, sendMessage, isActive, connectionStatus, showAlert }, ref) => {
File renamed without changes.
+196
View File
@@ -0,0 +1,196 @@
import React, { useEffect, useState } from 'react';
import {
Clock,
Coins,
Cpu,
Database,
Gamepad2,
Globe,
HardDrive,
MemoryStick,
Play,
Server,
Square,
Terminal,
} from 'lucide-react';
import { ActionButton, getServerStatusInfo } from '../../components/DashboardComponents.jsx';
import { colors } from '../../theme/colors.js';
const serverTypeIcons = {
vps: { icon: Server, color: colors.blue },
game: { icon: Gamepad2, color: colors.red },
website: { icon: Globe, color: colors.green },
database: { icon: Database, color: colors.magenta },
};
function calculateServerCost(server, pricing) {
if (server.is_demo === true || server.is_demo === 1) return 0;
const cpuCost = (parseInt(server.cpu, 10) || 0) * (pricing.price_cpu || 35);
const ramCost = (parseInt(server.ram, 10) || 0) * (pricing.price_ram || 35);
const storageCost = (parseInt(server.storage, 10) || 0) * (pricing.price_storage || 5);
const typeMultiplier = {
vps: pricing.multiplier_vps || 1,
game: pricing.multiplier_game || 0.8,
website: pricing.multiplier_website || 1.5,
database: pricing.multiplier_database || 1.3,
}[server.type] || 1;
return Math.round((cpuCost + ramCost + storageCost) * typeMultiplier);
}
export default function ServerCard({
server,
pricing,
userRole,
calculateCurrencyValue,
getCurrencySymbol,
onConvertDemo,
onOpenConsole,
onServerAction,
}) {
const statusInfo = getServerStatusInfo(server.status);
const { icon: ServerIcon, color: serverColor } = serverTypeIcons[server.type] || serverTypeIcons.vps;
const isDatabase = server.type === 'database';
const dbType = server.image || 'Unknown';
const isDemo = server.is_demo === true || server.is_demo === 1;
const monthlyCost = calculateServerCost(server, pricing);
const [timeRemaining, setTimeRemaining] = useState(null);
useEffect(() => {
if (!isDemo || !server.demo_expires_at) {
setTimeRemaining(null);
return undefined;
}
const updateTimer = () => {
const expiresAt = new Date(server.demo_expires_at);
const difference = expiresAt.getTime() - Date.now();
if (Number.isNaN(expiresAt.getTime())) {
setTimeRemaining(null);
} else if (difference <= 0) {
setTimeRemaining('Expired');
} else {
const hours = Math.floor(difference / 3_600_000);
const minutes = Math.floor((difference % 3_600_000) / 60_000);
const seconds = Math.floor((difference % 60_000) / 1000);
setTimeRemaining(`${hours}:${String(minutes).padStart(2, '0')}:${String(seconds).padStart(2, '0')}`);
}
};
updateTimer();
const interval = window.setInterval(updateTimer, 1000);
return () => window.clearInterval(interval);
}, [isDemo, server.demo_expires_at]);
return (
<article className="ah-server-card relative h-full" style={{ '--server-accent': serverColor }}>
<div className="ah-server-card-content">
<header className="ah-server-card-header">
<div className="ah-server-card-identity">
<div className="ah-server-type-icon" aria-hidden="true">
<ServerIcon className="w-5 h-5" style={{ color: serverColor }} />
</div>
<div className="ah-server-card-heading">
<div className="flex min-w-0 items-center gap-2">
<h3 className="ah-server-name" title={server.name}>{server.name}</h3>
{isDemo && <span className="ah-server-demo-tag">DEMO</span>}
</div>
<p className="ah-server-type-label">{isDatabase ? `${dbType} db` : `${server.type} node`}</p>
{isDemo && timeRemaining && (
<div className="ah-server-demo-time">
<Clock className="w-3 h-3" aria-hidden="true" />
<p>{timeRemaining === 'Expired' ? 'EXPIRED' : timeRemaining}</p>
</div>
)}
</div>
</div>
<div
className="ah-server-status"
aria-label={`Server status: ${statusInfo.label}`}
style={{
backgroundColor: `${statusInfo.color}15`,
borderColor: statusInfo.color,
color: statusInfo.color,
}}
>
{statusInfo.label}
</div>
</header>
<div className="ah-server-resource-grid">
<div className="ah-server-resource">
<div className="ah-server-resource-label"><Cpu className="w-4 h-4" aria-hidden="true" /><span>CPU</span></div>
<p>{server.cpu}</p>
</div>
<div className="ah-server-resource">
<div className="ah-server-resource-label"><MemoryStick className="w-4 h-4" aria-hidden="true" /><span>Memory</span></div>
<p>{server.ram}</p>
</div>
<div className="ah-server-resource">
<div className="ah-server-resource-label"><HardDrive className="w-4 h-4" aria-hidden="true" /><span>Storage</span></div>
<p>{server.storage}</p>
</div>
<div className="ah-server-resource ah-server-cost">
<div className="ah-server-resource-label"><Coins className="w-4 h-4" aria-hidden="true" /><span>Monthly cost</span></div>
<p className="ah-server-cost-value">
{isDemo ? 'FREE' : `${calculateCurrencyValue(monthlyCost)} ${getCurrencySymbol()}`}
</p>
</div>
</div>
<div className="ah-server-card-actions">
{isDemo && userRole !== 'admin' ? (
<ActionButton
variant="primary"
onClick={() => onConvertDemo(server.id)}
className="flex-1 !min-h-0 !py-3"
style={{ backgroundColor: colors.brightYellow, borderColor: colors.brightYellow, color: colors.black }}
>
<Coins className="w-4 h-4" />
<span className="font-black uppercase tracking-widest text-[10px]">Convert to paid</span>
</ActionButton>
) : (
<>
<ActionButton variant="secondary" onClick={() => onOpenConsole(server)} className="flex-1 !min-h-0 !py-3">
<Terminal className="w-4 h-4" />
<span className="font-black uppercase tracking-widest text-[10px]">Console</span>
</ActionButton>
{isDemo && (
<ActionButton
variant="warning"
onClick={() => onConvertDemo(server.id)}
className="aspect-square !p-0 !min-w-[48px]"
title="Convert demo to paid"
aria-label={`Convert ${server.name} demo to paid`}
>
<Coins className="w-4 h-4 text-yellow-400" />
</ActionButton>
)}
{server.status === 'Running' ? (
<ActionButton
variant="danger"
onClick={() => onServerAction(server.id, 'stop')}
className="aspect-square !p-0 !min-w-[48px]"
title={`Stop ${server.name}`}
aria-label={`Stop ${server.name}`}
>
<Square className="w-4 h-4 fill-current" />
</ActionButton>
) : (
<ActionButton
variant="success"
onClick={() => onServerAction(server.id, 'start')}
className="aspect-square !p-0 !min-w-[48px]"
title={`Start ${server.name}`}
aria-label={`Start ${server.name}`}
>
<Play className="w-4 h-4 fill-current" />
</ActionButton>
)}
</>
)}
</div>
</div>
</article>
);
}
@@ -1,4 +1,5 @@
import React, { useState, useEffect, useRef, useCallback } from 'react';
import branding from '../../branding';
import { createPortal } from 'react-dom';
import {
Server, Terminal, Play, Square, RefreshCw, Trash2, Maximize2, Minimize2, X,
@@ -888,7 +889,7 @@ const ServerDetailsModal = ({ server, onClose, onServerAction, showAlert }) => {
</div>
<div>
<p className="text-xs font-bold text-white">Automated Firewall</p>
<p className="text-[10px] opacity-40 leading-relaxed">The AnchorHost.eu firewall automatically opens all exposed ports in real-time.</p>
<p className="text-[10px] opacity-40 leading-relaxed">The {branding.name} firewall automatically opens all exposed ports in real-time.</p>
</div>
</div>
</div>
File renamed without changes.
@@ -16,6 +16,7 @@ import {
} from '../../components/DashboardComponents';
import { API_BASE_URL } from '../../config/api';
import branding from '../../branding';
const currencyFlags = {
EUR: '🇪🇺',
@@ -203,7 +204,7 @@ function StoreSection({ userCredits, onAddCredits, onRefreshCredits, selectedCur
<SectionCard title="What are Credits?" icon={Info} color={colors.blue}>
<div className="space-y-4">
<p className="text-sm leading-relaxed" style={{ color: colors.foreground }}>
Credits are the <span className="text-brightWhite font-bold">universal currency</span> of AnchorHost.eu.
Credits are the <span className="text-brightWhite font-bold">universal currency</span> of {branding.name}.
They allow you to pay for all our services with maximum flexibility.
</p>
<div className="grid grid-cols-1 sm:grid-cols-2 gap-3">
@@ -1,7 +1,7 @@
// TicketSystem.js - Updated with auto-reloading feature
// TicketSystem.jsx - Updated with auto-reloading feature
import React, { useState, useEffect, useContext, useRef, useCallback } from 'react';
import { createPortal } from 'react-dom';
import { AuthContext } from '../../App.js';
import { AuthContext } from '../../App.jsx';
import useWebSocket from '../../hooks/useWebSocket.js';
import {
MessageCircle, Plus, Search, Filter, Clock, AlertCircle, CheckCircle,