Back up recovered AnchorHost frontend
This commit is contained in:
commit
4ce031f667
72 files changed
+37643
No files matched your search
@@ -0,0 +1,329 @@
|
||||
import React, { useContext, useState, useEffect } from 'react';
|
||||
import { Navigate, useNavigate } from 'react-router-dom';
|
||||
import {
|
||||
Users,
|
||||
LogOut,
|
||||
ArrowLeft,
|
||||
Shield,
|
||||
Menu,
|
||||
X,
|
||||
Megaphone,
|
||||
MessageSquare,
|
||||
CheckCircle,
|
||||
AlertCircle,
|
||||
AlertTriangle,
|
||||
Info,
|
||||
Globe,
|
||||
Layout,
|
||||
Activity,
|
||||
Coins,
|
||||
Wifi,
|
||||
WifiOff,
|
||||
Sliders,
|
||||
} from 'lucide-react';
|
||||
import { AuthContext } from '../App';
|
||||
import AdminSection from '../features/admin/AdminSection';
|
||||
import { colors } from '../theme/colors';
|
||||
import useWebSocket from '../hooks/useWebSocket';
|
||||
import { API_BASE_URL, WS_BASE_URL } from '../config/api';
|
||||
import {
|
||||
ActionButton,
|
||||
UnifiedTooltip
|
||||
} from '../components/DashboardComponents';
|
||||
|
||||
const AdminPage = () => {
|
||||
const { user, isAuthenticated, logout, isLoading } = useContext(AuthContext);
|
||||
const navigate = useNavigate();
|
||||
const [mobileMenuOpen, setMobileMenuOpen] = useState(false);
|
||||
const [activeTab, setActiveTab] = useState('users');
|
||||
const [userCredits, setUserCredits] = useState(user?.credits || 0);
|
||||
const token = localStorage.getItem('anchorhost_token');
|
||||
|
||||
const {
|
||||
connectionStatus: dashboardStatus,
|
||||
lastJsonMessage: lastMessage
|
||||
} = useWebSocket(`${WS_BASE_URL}/dashboard${token ? `?token=${token}` : ''}`);
|
||||
|
||||
const [alertModal, setAlertModal] = useState({
|
||||
open: false,
|
||||
title: '',
|
||||
message: '',
|
||||
type: 'info',
|
||||
});
|
||||
|
||||
const showAlert = (title, message, type = 'info') => {
|
||||
setAlertModal({
|
||||
open: true,
|
||||
title,
|
||||
message,
|
||||
type,
|
||||
});
|
||||
};
|
||||
useEffect(() => {
|
||||
if (lastMessage) {
|
||||
const data = lastMessage;
|
||||
|
||||
if (data.type === 'admin_stats') {
|
||||
setUserCredits(data.credits || 0);
|
||||
}
|
||||
}
|
||||
}, [lastMessage]);
|
||||
|
||||
useEffect(() => {
|
||||
// Initial fetch for credits if needed or rely on WS
|
||||
const fetchCredits = async () => {
|
||||
try {
|
||||
const response = await fetch(`${API_BASE_URL}/api/user/profile`, {
|
||||
headers: {
|
||||
'Authorization': `Bearer ${token}`
|
||||
}
|
||||
});
|
||||
const data = await response.json();
|
||||
if (data.success && data.user) {
|
||||
setUserCredits(data.user.credits);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Failed to fetch credits:', err);
|
||||
}
|
||||
};
|
||||
if (isAuthenticated && user?.role === 'admin') {
|
||||
fetchCredits();
|
||||
}
|
||||
}, [token, isAuthenticated, user?.role]);
|
||||
|
||||
if (isLoading) {
|
||||
return (
|
||||
<div className="min-h-app bg-dash-surface flex items-center justify-center px-4">
|
||||
<div className="text-dash-text text-fluid-base">Loading...</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (!isAuthenticated || !user) {
|
||||
return <Navigate to="/" replace />;
|
||||
}
|
||||
|
||||
if (user.role !== 'admin') {
|
||||
return <Navigate to="/dashboard" replace />;
|
||||
}
|
||||
|
||||
const menuItems = [
|
||||
{ id: 'users', label: 'User Management', icon: Users, color: colors.blue },
|
||||
{ id: 'servers', label: 'Server Management', icon: Layout, color: colors.brightYellow },
|
||||
{ id: 'cluster', label: 'Cluster Management', icon: Activity, color: colors.brightMagenta },
|
||||
{ id: 'announcements', label: 'Announcements', icon: Megaphone, color: colors.brightCyan },
|
||||
{ id: 'homepage', label: 'Homepage Showcase', icon: Globe, color: colors.orange },
|
||||
{ id: 'pricing', label: 'Service Pricing', icon: Coins, color: colors.brightGreen },
|
||||
{ id: 'settings', label: 'Panel Settings', icon: Sliders, color: colors.brightRed },
|
||||
{ id: 'tickets', label: 'Tickets', icon: MessageSquare, color: colors.blue },
|
||||
];
|
||||
|
||||
return (
|
||||
<div className="flex h-screen overflow-hidden bg-dash-surface font-sans selection:bg-brightRed/30 text-dash-textMuted antialiased">
|
||||
{/* Sidebar */}
|
||||
<aside
|
||||
className={`fixed inset-y-0 left-0 z-50 w-72 transform transition-transform duration-300 ease-in-out md:relative md:translate-x-0 border-r border-dash-border bg-dash-surfaceElevated/50 backdrop-blur-md pt-[env(safe-area-inset-top,0px)] ${
|
||||
mobileMenuOpen ? 'translate-x-0' : '-translate-x-full'
|
||||
}`}
|
||||
>
|
||||
<div className="flex flex-col h-full">
|
||||
<div className="p-6 border-b border-dash-border bg-black/10">
|
||||
<div className="flex items-center space-x-3 group cursor-pointer" onClick={() => navigate('/')}>
|
||||
<div className="p-2 rounded-xl bg-brightRed/10 border border-brightRed/20 transition-all group-hover:scale-110 shadow-lg shadow-brightRed/5">
|
||||
<img src="/assets/transparent_anchorhost.png" alt="" className="h-7 w-auto shrink-0" />
|
||||
</div>
|
||||
<div className="min-w-0">
|
||||
<h1 className="text-xl font-bold tracking-tight text-dash-text truncate">
|
||||
Admin
|
||||
</h1>
|
||||
<p className="text-[10px] font-bold text-dash-textMuted/40 uppercase tracking-[0.2em]">
|
||||
System Management
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="px-6 py-4 flex flex-col gap-2 border-b border-dash-border bg-black/5 shrink-0">
|
||||
<div
|
||||
className="flex items-center gap-2 text-[10px] font-bold uppercase tracking-wider px-3 py-2.5 rounded-xl justify-center border border-dash-border bg-black/20"
|
||||
>
|
||||
{dashboardStatus === 'connected' ? (
|
||||
<Wifi className="w-3.5 h-3.5 shrink-0" style={{ color: colors.green }} />
|
||||
) : (
|
||||
<WifiOff className="w-3.5 h-3.5 shrink-0" style={{ color: colors.red }} />
|
||||
)}
|
||||
<span style={{ color: dashboardStatus === 'connected' ? colors.green : colors.red }}>
|
||||
{dashboardStatus === 'connected' ? 'Live' : 'Offline'}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<UnifiedTooltip content={`${userCredits.toLocaleString()} credits`} placement="bottom">
|
||||
<div
|
||||
className="flex items-center gap-2 text-[10px] font-bold uppercase tracking-wider px-3 py-2.5 rounded-xl w-full justify-center border border-dash-border bg-black/20"
|
||||
>
|
||||
<Coins className="w-3.5 h-3.5 shrink-0" style={{ color: colors.yellow }} />
|
||||
<span style={{ color: colors.brightWhite }} className="truncate min-w-0">
|
||||
{(userCredits / 100).toFixed(2)} €
|
||||
</span>
|
||||
</div>
|
||||
</UnifiedTooltip>
|
||||
</div>
|
||||
|
||||
<nav className="flex-1 overflow-y-auto py-6 px-4 space-y-1.5 custom-scrollbar">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => navigate('/dashboard')}
|
||||
className="w-full flex items-center space-x-3 px-4 py-3 rounded-xl transition-all duration-200 group text-sm font-bold hover:bg-white/5 border border-dash-border/10 mb-6 bg-brightBlack/20"
|
||||
>
|
||||
<div className="p-1.5 rounded-lg bg-white/5 group-hover:bg-white/10 transition-colors">
|
||||
<ArrowLeft className="w-4 h-4 group-hover:-translate-x-1 transition-transform" />
|
||||
</div>
|
||||
<span className="text-dash-text">Exit to Dashboard</span>
|
||||
</button>
|
||||
|
||||
<div className="px-4 mb-3 text-[10px] font-bold uppercase tracking-[0.3em] text-dash-textMuted/30">
|
||||
Management
|
||||
</div>
|
||||
|
||||
{menuItems.map((item) => (
|
||||
<button
|
||||
key={item.id}
|
||||
type="button"
|
||||
onClick={() => {
|
||||
setActiveTab(item.id);
|
||||
setMobileMenuOpen(false);
|
||||
}}
|
||||
className={`w-full flex items-center space-x-3 px-4 py-3 rounded-xl transition-all duration-200 group text-sm font-bold border ${
|
||||
activeTab === item.id
|
||||
? 'bg-brightRed/10 border-brightRed/25 text-dash-text shadow-lg shadow-brightRed/5'
|
||||
: 'border-transparent text-dash-textMuted/60 hover:bg-white/5 hover:text-dash-text hover:border-dash-border/20'
|
||||
}`}
|
||||
>
|
||||
<div
|
||||
className={`p-2 rounded-lg transition-all duration-300 ${
|
||||
activeTab === item.id
|
||||
? 'bg-brightRed/20 scale-110'
|
||||
: 'bg-white/5 group-hover:bg-white/10 group-hover:scale-110'
|
||||
}`}
|
||||
>
|
||||
<item.icon
|
||||
className="w-4 h-4 transition-transform group-hover:rotate-3"
|
||||
style={{ color: activeTab === item.id ? colors.brightRed : colors.foreground }}
|
||||
/>
|
||||
</div>
|
||||
<span>{item.label}</span>
|
||||
</button>
|
||||
))}
|
||||
</nav>
|
||||
|
||||
{/* User Profile Footer */}
|
||||
<div className="p-4 border-t border-dash-border bg-black/20 pb-[calc(1rem+env(safe-area-inset-bottom,0px))]">
|
||||
<div className="flex items-center p-3 rounded-2xl border border-dash-border bg-dash-surfaceElevated/50">
|
||||
<div className="w-10 h-10 rounded-xl bg-brightRed/10 border border-brightRed/25 flex items-center justify-center font-bold text-sm text-brightRed shadow-inner">
|
||||
{user.username.substring(0, 2).toUpperCase()}
|
||||
</div>
|
||||
<div className="ml-3 flex-1 min-w-0">
|
||||
<p className="text-sm font-bold truncate text-dash-text">
|
||||
{user.username}
|
||||
</p>
|
||||
<p className="text-[10px] uppercase font-bold tracking-[0.15em] text-dash-textMuted/40">
|
||||
{user.role}
|
||||
</p>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
onClick={logout}
|
||||
className="p-2.5 rounded-xl hover:bg-brightRed/10 text-dash-textMuted/40 hover:text-brightRed transition-all group"
|
||||
title="Logout"
|
||||
>
|
||||
<LogOut className="w-4 h-4 group-hover:scale-110 group-hover:-translate-x-0.5 transition-transform" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
{/* Mobile Overlay */}
|
||||
{mobileMenuOpen && (
|
||||
<button
|
||||
type="button"
|
||||
className="fixed inset-0 z-40 bg-black/60 md:hidden backdrop-blur-sm transition-opacity duration-300"
|
||||
onClick={() => setMobileMenuOpen(false)}
|
||||
aria-label="Close menu"
|
||||
/>
|
||||
)}
|
||||
|
||||
{/* Main Content Area */}
|
||||
<main className="flex-1 flex flex-col min-w-0 overflow-hidden relative">
|
||||
{/* Mobile Header */}
|
||||
<header className="md:hidden flex items-center justify-between p-4 border-b border-dash-border bg-dash-surfaceElevated/80 backdrop-blur-md pt-[calc(1rem+env(safe-area-inset-top,0px))]">
|
||||
<div className="flex items-center space-x-3">
|
||||
<div className="p-2 rounded-lg bg-brightRed/10 border border-brightRed/20 shadow-sm">
|
||||
<Shield className="w-5 h-5 text-brightRed" />
|
||||
</div>
|
||||
<span className="font-bold text-dash-text tracking-tight">Admin Dashboard</span>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setMobileMenuOpen(!mobileMenuOpen)}
|
||||
className="p-2.5 rounded-xl text-dash-textMuted hover:bg-white/10 transition-all border border-transparent hover:border-dash-border/20 active:scale-90"
|
||||
>
|
||||
{mobileMenuOpen ? <X className="w-6 h-6" /> : <Menu className="w-6 h-6" />}
|
||||
</button>
|
||||
</header>
|
||||
|
||||
{/* Dynamic Content */}
|
||||
<div className="flex-1 overflow-auto custom-scrollbar p-4 md:p-8 lg:p-10">
|
||||
<div className="max-w-7xl mx-auto space-y-8 animate-in fade-in slide-in-from-bottom-2 duration-500">
|
||||
<AdminSection user={user} activeTab={activeTab} showAlert={showAlert} />
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
{/* Alert Modal */}
|
||||
{alertModal.open && (
|
||||
<div className="fixed inset-0 bg-black/80 flex items-center justify-center z-[9999] p-4 backdrop-blur-sm animate-in fade-in duration-300">
|
||||
<div className="rounded-2xl w-full max-w-md border border-dash-border bg-dash-surfaceElevated shadow-2xl overflow-hidden animate-in zoom-in-95 duration-200">
|
||||
<div className={`p-6 border-b flex justify-between items-center ${
|
||||
alertModal.type === 'error' ? 'border-brightRed/20' :
|
||||
alertModal.type === 'success' ? 'border-brightGreen/20' : 'border-dash-border'
|
||||
}`}>
|
||||
<div className="flex items-center space-x-3">
|
||||
{alertModal.type === 'success' && <CheckCircle className="w-5 h-5 text-brightGreen" />}
|
||||
{alertModal.type === 'error' && <AlertCircle className="w-5 h-5 text-brightRed" />}
|
||||
{alertModal.type === 'warning' && <AlertTriangle className="w-5 h-5 text-brightYellow" />}
|
||||
{alertModal.type === 'info' && <Info className="w-5 h-5 text-primary" />}
|
||||
<h3 className="text-lg font-bold text-dash-text tracking-tight">{alertModal.title}</h3>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setAlertModal({ ...alertModal, open: false })}
|
||||
className="p-2 rounded-lg text-dash-textMuted hover:bg-white/5 transition-colors"
|
||||
>
|
||||
<X className="w-5 h-5" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div className="p-6">
|
||||
<p className="text-sm leading-relaxed text-dash-textMuted font-medium">
|
||||
{alertModal.message}
|
||||
</p>
|
||||
|
||||
<div className="flex justify-end mt-8">
|
||||
<ActionButton
|
||||
variant={alertModal.type === 'info' ? 'primary' : (alertModal.type === 'error' ? 'danger' : alertModal.type)}
|
||||
onClick={() => setAlertModal({ ...alertModal, open: false })}
|
||||
className="w-full sm:w-auto font-bold"
|
||||
>
|
||||
Confirm Action
|
||||
</ActionButton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default AdminPage;
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,134 @@
|
||||
import React from 'react';
|
||||
import { Shield } from 'lucide-react';
|
||||
import { colors } from '../theme/colors';
|
||||
import { LegalPageShell, LegalSection, LegalList, LegalLink } from '../features/legal/LegalDocumentLayout';
|
||||
|
||||
const LAST_UPDATED = 'April 5, 2026';
|
||||
|
||||
function PrivacyPolicy() {
|
||||
return (
|
||||
<LegalPageShell
|
||||
title="Privacy Policy"
|
||||
icon={Shield}
|
||||
accentColor={colors.magenta}
|
||||
lastUpdated={LAST_UPDATED}
|
||||
>
|
||||
<LegalSection title="1. General Information">
|
||||
<p>This Privacy Policy explains how AnchorHost.eu processes personal data.</p>
|
||||
<p>
|
||||
<strong className="text-dash-text">Data Controller:</strong>
|
||||
<br />
|
||||
Wiktor Falkowski (unregistered business activity under Polish law)
|
||||
</p>
|
||||
<p>
|
||||
<strong className="text-dash-text">Contact:</strong>
|
||||
<br />
|
||||
<LegalLink href="mailto:privacy@anchorhost.eu">privacy@anchorhost.eu</LegalLink>
|
||||
</p>
|
||||
<p>We process data in accordance with GDPR.</p>
|
||||
</LegalSection>
|
||||
|
||||
<LegalSection title="2. Data We Collect">
|
||||
<p>We may collect:</p>
|
||||
<LegalList
|
||||
items={[
|
||||
'Account information (email, username)',
|
||||
'Payment information (handled by third-party providers)',
|
||||
'Service usage data (logs, performance metrics)',
|
||||
'Technical data (IP address, device info)',
|
||||
'Communication data',
|
||||
]}
|
||||
/>
|
||||
</LegalSection>
|
||||
|
||||
<LegalSection title="3. Legal Basis for Processing">
|
||||
<p>We process data based on:</p>
|
||||
<LegalList
|
||||
items={[
|
||||
'Contract performance (Art. 6(1)(b) GDPR)',
|
||||
'Legal obligations (Art. 6(1)(c))',
|
||||
'Legitimate interest (Art. 6(1)(f))',
|
||||
'Consent (Art. 6(1)(a)) where required',
|
||||
]}
|
||||
/>
|
||||
</LegalSection>
|
||||
|
||||
<LegalSection title="4. Purpose of Processing">
|
||||
<p>We use data to:</p>
|
||||
<LegalList
|
||||
items={[
|
||||
'Provide and maintain services',
|
||||
'Process payments',
|
||||
'Ensure security',
|
||||
'Improve performance',
|
||||
'Communicate with users',
|
||||
]}
|
||||
/>
|
||||
</LegalSection>
|
||||
|
||||
<LegalSection title="5. Data Sharing">
|
||||
<p>We may share data with:</p>
|
||||
<LegalList
|
||||
items={[
|
||||
'Payment providers',
|
||||
'Infrastructure providers (hosting, cloud)',
|
||||
'Legal authorities when required',
|
||||
]}
|
||||
/>
|
||||
<p>We do NOT sell personal data.</p>
|
||||
</LegalSection>
|
||||
|
||||
<LegalSection title="6. Data Retention">
|
||||
<p>We retain data:</p>
|
||||
<LegalList
|
||||
items={['As long as necessary for service provision', 'As required by law (e.g., accounting)']}
|
||||
/>
|
||||
<p>Inactive accounts may be deleted.</p>
|
||||
</LegalSection>
|
||||
|
||||
<LegalSection title="7. User Rights">
|
||||
<p>Under GDPR, you have the right to:</p>
|
||||
<LegalList
|
||||
items={[
|
||||
'Access your data',
|
||||
'Rectify data',
|
||||
'Delete data',
|
||||
'Restrict processing',
|
||||
'Object to processing',
|
||||
'Data portability',
|
||||
]}
|
||||
/>
|
||||
<p>
|
||||
Requests: <LegalLink href="mailto:privacy@anchorhost.eu">privacy@anchorhost.eu</LegalLink>
|
||||
</p>
|
||||
</LegalSection>
|
||||
|
||||
<LegalSection title="8. Data Security">
|
||||
<p>We implement technical and organizational measures to protect data, including:</p>
|
||||
<LegalList items={['encryption', 'access control', 'monitoring systems']} />
|
||||
</LegalSection>
|
||||
|
||||
<LegalSection title="9. Cookies">
|
||||
<p>We use cookies to:</p>
|
||||
<LegalList items={['maintain sessions', 'improve functionality', 'analyze usage']} />
|
||||
<p>You can control cookies via browser settings.</p>
|
||||
</LegalSection>
|
||||
|
||||
<LegalSection title="10. International Transfers">
|
||||
<p>Data may be processed outside the EEA with appropriate safeguards.</p>
|
||||
</LegalSection>
|
||||
|
||||
<LegalSection title="11. Changes to Policy">
|
||||
<p>We may update this Privacy Policy.</p>
|
||||
</LegalSection>
|
||||
|
||||
<LegalSection title="12. Contact">
|
||||
<p>
|
||||
<LegalLink href="mailto:privacy@anchorhost.eu">privacy@anchorhost.eu</LegalLink>
|
||||
</p>
|
||||
</LegalSection>
|
||||
</LegalPageShell>
|
||||
);
|
||||
}
|
||||
|
||||
export default PrivacyPolicy;
|
||||
@@ -0,0 +1,201 @@
|
||||
import React from 'react';
|
||||
import { FileText } from 'lucide-react';
|
||||
import { colors } from '../theme/colors';
|
||||
import { LegalPageShell, LegalSection, LegalList, LegalLink } from '../features/legal/LegalDocumentLayout';
|
||||
|
||||
const LAST_UPDATED = 'April 5, 2026';
|
||||
|
||||
function TermsOfService() {
|
||||
return (
|
||||
<LegalPageShell
|
||||
title="Terms of Service"
|
||||
icon={FileText}
|
||||
accentColor={colors.blue}
|
||||
lastUpdated={LAST_UPDATED}
|
||||
>
|
||||
<LegalSection title="1. General Information">
|
||||
<p>
|
||||
These Terms of Service ("Terms") govern the use of services provided under the brand AnchorHost.eu via the website{' '}
|
||||
<LegalLink href="https://www.anchorhost.eu">https://www.anchorhost.eu</LegalLink>.
|
||||
</p>
|
||||
<p>
|
||||
<strong className="text-dash-text">Service Provider:</strong>
|
||||
<br />
|
||||
Wiktor Falkowski (unregistered business activity under Polish law)
|
||||
</p>
|
||||
<p>
|
||||
<strong className="text-dash-text">Contact:</strong>
|
||||
<br />
|
||||
<LegalLink href="mailto:legal@anchorhost.eu">legal@anchorhost.eu</LegalLink>
|
||||
</p>
|
||||
<p>By using the Service, you agree to these Terms.</p>
|
||||
</LegalSection>
|
||||
|
||||
<LegalSection title="2. Definitions">
|
||||
<LegalList
|
||||
items={[
|
||||
<>
|
||||
<strong className="text-dash-text">"Service"</strong> – hosting services including VPS, game
|
||||
servers, web hosting, and databases
|
||||
</>,
|
||||
<>
|
||||
<strong className="text-dash-text">"User"</strong> – any individual or entity using the Service
|
||||
</>,
|
||||
<>
|
||||
<strong className="text-dash-text">"Consumer"</strong> – a natural person acting outside business
|
||||
activity
|
||||
</>,
|
||||
<>
|
||||
<strong className="text-dash-text">"Credits"</strong> – prepaid virtual units used to purchase
|
||||
services
|
||||
</>,
|
||||
<>
|
||||
<strong className="text-dash-text">"Agreement"</strong> – contract between User and Service
|
||||
Provider
|
||||
</>,
|
||||
]}
|
||||
/>
|
||||
</LegalSection>
|
||||
|
||||
<LegalSection title="3. Scope of Services">
|
||||
<p>We provide hosting infrastructure services, including:</p>
|
||||
<LegalList
|
||||
items={[
|
||||
'Virtual Private Servers (VPS)',
|
||||
'Game servers',
|
||||
'Web hosting',
|
||||
'Database hosting',
|
||||
]}
|
||||
/>
|
||||
<p>We do not guarantee uninterrupted availability of services.</p>
|
||||
</LegalSection>
|
||||
|
||||
<LegalSection title="4. Account Terms">
|
||||
<LegalList
|
||||
items={[
|
||||
'You must be at least 18 years old',
|
||||
'You must provide accurate information',
|
||||
'You are responsible for account security',
|
||||
'You are responsible for all activity under your account',
|
||||
]}
|
||||
/>
|
||||
</LegalSection>
|
||||
|
||||
<LegalSection title="5. Acceptable Use">
|
||||
<p>You may NOT use the Service for:</p>
|
||||
<LegalList
|
||||
items={[
|
||||
'Illegal activities',
|
||||
'Copyright infringement',
|
||||
'Malware, phishing, or spam',
|
||||
'Attacks on infrastructure',
|
||||
'Hosting unlawful content',
|
||||
]}
|
||||
/>
|
||||
<p>We reserve the right to suspend services for violations.</p>
|
||||
</LegalSection>
|
||||
|
||||
<LegalSection title="6. Credit System">
|
||||
<p>The Service operates on a prepaid credit system.</p>
|
||||
<LegalList
|
||||
items={[
|
||||
'Credits are virtual and non-transferable',
|
||||
'Credits are not legal tender or financial instruments',
|
||||
'Credits cannot be exchanged for money',
|
||||
]}
|
||||
/>
|
||||
<p>Credits are purchased in advance and assigned to your account.</p>
|
||||
</LegalSection>
|
||||
|
||||
<LegalSection title="7. Use of Credits">
|
||||
<p>Credits can be used to activate services, including:</p>
|
||||
<LegalList items={['VPS', 'Game servers', 'Web hosting', 'Databases']} />
|
||||
<p>
|
||||
<strong className="text-dash-text">Services are activated:</strong>
|
||||
</p>
|
||||
<LegalList items={['Until the end of the current calendar month']} />
|
||||
<p>
|
||||
<strong className="text-dash-text">After expiration:</strong>
|
||||
</p>
|
||||
<LegalList items={['Services are automatically deactivated', 'No automatic renewal occurs']} />
|
||||
</LegalSection>
|
||||
|
||||
<LegalSection title="8. Credit Validity">
|
||||
<p>Credits are valid for:</p>
|
||||
<LegalList items={['12 months from purchase']} />
|
||||
<p>Unused credits expire after this period.</p>
|
||||
</LegalSection>
|
||||
|
||||
<LegalSection title="9. Payments and Refunds">
|
||||
<LegalList items={['Payments are made in advance', 'All sales are final unless required by law']} />
|
||||
<p>
|
||||
<strong className="text-dash-text">For Consumers:</strong>
|
||||
</p>
|
||||
<p>
|
||||
By purchasing credits, you explicitly consent to immediate delivery of digital content and acknowledge that you
|
||||
lose your right of withdrawal under EU and Polish consumer law.
|
||||
</p>
|
||||
<p>No refunds are provided for used credits.</p>
|
||||
</LegalSection>
|
||||
|
||||
<LegalSection title="10. Pricing Model">
|
||||
<LegalList
|
||||
items={[
|
||||
'Pricing may be proportional (pro-rata) depending on activation date',
|
||||
'Or fixed for the full calendar month (as specified in pricing)',
|
||||
]}
|
||||
/>
|
||||
</LegalSection>
|
||||
|
||||
<LegalSection title="11. Service Termination">
|
||||
<p>Services expire automatically at the end of the billing period.</p>
|
||||
<p>
|
||||
<strong className="text-dash-text">After expiration:</strong>
|
||||
</p>
|
||||
<LegalList items={['Data may be deleted within 7–30 days', 'You are responsible for backups']} />
|
||||
</LegalSection>
|
||||
|
||||
<LegalSection title="12. Liability">
|
||||
<p>
|
||||
<strong className="text-dash-text">To the maximum extent permitted by law:</strong>
|
||||
</p>
|
||||
<LegalList
|
||||
items={[
|
||||
'We are not liable for data loss',
|
||||
'We are not liable for service interruptions',
|
||||
'Liability towards businesses may be limited to fees paid',
|
||||
]}
|
||||
/>
|
||||
</LegalSection>
|
||||
|
||||
<LegalSection title="13. User Content">
|
||||
<p>You retain ownership of your content.</p>
|
||||
<p>You are fully responsible for:</p>
|
||||
<LegalList items={['legality', 'compliance with law']} />
|
||||
<p>We may remove content that violates laws or these Terms.</p>
|
||||
</LegalSection>
|
||||
|
||||
<LegalSection title="14. Suspension and Termination">
|
||||
<p>We may suspend or terminate services if:</p>
|
||||
<LegalList items={['Terms are violated', 'Illegal activity is detected']} />
|
||||
</LegalSection>
|
||||
|
||||
<LegalSection title="15. Changes to Terms">
|
||||
<LegalList items={['We may update these Terms.', 'Changes take effect after 14 days.']} />
|
||||
</LegalSection>
|
||||
|
||||
<LegalSection title="16. Governing Law">
|
||||
<p>These Terms are governed by the laws of Poland.</p>
|
||||
<p>Consumers may seek assistance from UOKiK or other dispute resolution bodies.</p>
|
||||
</LegalSection>
|
||||
|
||||
<LegalSection title="17. Contact">
|
||||
<p>
|
||||
<LegalLink href="mailto:legal@anchorhost.eu">legal@anchorhost.eu</LegalLink>
|
||||
</p>
|
||||
</LegalSection>
|
||||
</LegalPageShell>
|
||||
);
|
||||
}
|
||||
|
||||
export default TermsOfService;
|
||||
@@ -0,0 +1,113 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { useNavigate, useSearchParams } from 'react-router-dom';
|
||||
import { CheckCircle, AlertCircle, Loader } from "lucide-react";
|
||||
import { colors } from '../theme/colors';
|
||||
import { API_BASE_URL } from '../config/api';
|
||||
|
||||
const VerifyEmail = () => {
|
||||
const [searchParams] = useSearchParams();
|
||||
const navigate = useNavigate();
|
||||
const [status, setStatus] = useState('verifying'); // verifying, success, error
|
||||
const [message, setMessage] = useState('Verifying your email...');
|
||||
|
||||
useEffect(() => {
|
||||
const verifyToken = async () => {
|
||||
const token = searchParams.get('token');
|
||||
|
||||
if (!token) {
|
||||
setStatus('error');
|
||||
setMessage('No verification token provided.');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await fetch(`${API_BASE_URL}/api/verify-email`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({ token })
|
||||
});
|
||||
|
||||
const data = await response.json();
|
||||
|
||||
if (response.ok && data.success) {
|
||||
setStatus('success');
|
||||
setMessage('Email verified successfully! Redirecting to dashboard...');
|
||||
|
||||
// Update local storage user data if present
|
||||
const savedUser = localStorage.getItem('anchorhost_user');
|
||||
if (savedUser) {
|
||||
try {
|
||||
const userData = JSON.parse(savedUser);
|
||||
userData.email_verified = true;
|
||||
localStorage.setItem('anchorhost_user', JSON.stringify(userData));
|
||||
} catch (e) {
|
||||
console.error('Error updating local user data', e);
|
||||
}
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
navigate('/dashboard');
|
||||
}, 3000);
|
||||
} else {
|
||||
setStatus('error');
|
||||
setMessage(data.error || 'Verification failed. The link may have expired.');
|
||||
}
|
||||
} catch (error) {
|
||||
setStatus('error');
|
||||
setMessage('An error occurred. Please try again later.');
|
||||
}
|
||||
};
|
||||
|
||||
verifyToken();
|
||||
}, [searchParams, navigate]);
|
||||
|
||||
return (
|
||||
<div className="min-h-app flex items-center justify-center p-4 sm:p-6" style={{ backgroundColor: colors.background }}>
|
||||
<div className="max-w-md w-full rounded-2xl border p-8 text-center"
|
||||
style={{ backgroundColor: colors.backgroundSecondary, borderColor: colors.brightBlack }}>
|
||||
|
||||
{status === 'verifying' && (
|
||||
<div className="flex flex-col items-center">
|
||||
<Loader className="w-12 h-12 animate-spin mb-4" style={{ color: colors.blue }} />
|
||||
<h2 className="text-xl font-bold mb-2" style={{ color: colors.brightWhite }}>Verifying Email</h2>
|
||||
<p style={{ color: colors.foreground }}>{message}</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{status === 'success' && (
|
||||
<div className="flex flex-col items-center">
|
||||
<CheckCircle className="w-12 h-12 mb-4" style={{ color: colors.green }} />
|
||||
<h2 className="text-xl font-bold mb-2" style={{ color: colors.brightWhite }}>Success!</h2>
|
||||
<p style={{ color: colors.foreground }}>{message}</p>
|
||||
<button
|
||||
onClick={() => navigate('/dashboard')}
|
||||
className="mt-6 px-6 py-2 rounded-lg font-medium transition-colors hover:opacity-90"
|
||||
style={{ backgroundColor: colors.blue, color: colors.brightWhite }}
|
||||
>
|
||||
Go to Dashboard
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{status === 'error' && (
|
||||
<div className="flex flex-col items-center">
|
||||
<AlertCircle className="w-12 h-12 mb-4" style={{ color: colors.red }} />
|
||||
<h2 className="text-xl font-bold mb-2" style={{ color: colors.brightWhite }}>Verification Failed</h2>
|
||||
<p style={{ color: colors.foreground }}>{message}</p>
|
||||
<button
|
||||
onClick={() => navigate('/')}
|
||||
className="mt-6 px-6 py-2 rounded-lg font-medium transition-colors hover:opacity-90 border"
|
||||
style={{ borderColor: colors.brightBlack, color: colors.foreground }}
|
||||
>
|
||||
Back to Home
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default VerifyEmail;
|
||||
Reference in new issue
Block a user