Polish AnchorHost.eu neobrutalist interface
This commit is contained in:
1 parent
6d1ee3c128
commit
bc4542d0fb
25 files changed
+1488
-2854
No files matched your search
@@ -1,7 +1,8 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import React, { useState, useEffect, useMemo } from 'react';
|
||||
import { useParams, useNavigate } from 'react-router-dom';
|
||||
import { ArrowLeft, Download, Star, Calendar, Package, ExternalLink, Tag, Server, ChevronDown } from 'lucide-react';
|
||||
import { ArrowLeft, Download, Star, Calendar, Package, ExternalLink, Tag, Server } from 'lucide-react';
|
||||
import { colors } from '../../theme/colors';
|
||||
import { Dropdown } from '../../components/dashboardPrimitives';
|
||||
|
||||
import { API_BASE_URL, WS_BASE_URL as WS_URL } from '../../config/api';
|
||||
|
||||
@@ -15,9 +16,12 @@ function PluginDetails() {
|
||||
const [selectedVersion, setSelectedVersion] = useState(null);
|
||||
const [servers, setServers] = useState([]);
|
||||
const [selectedServer, setSelectedServer] = useState(null);
|
||||
const [showServerDropdown, setShowServerDropdown] = useState(false);
|
||||
const [downloadingToServer, setDownloadingToServer] = useState(false);
|
||||
const [downloadStatus, setDownloadStatus] = useState('');
|
||||
const serverDropdownOptions = useMemo(
|
||||
() => servers.map((server) => ({ value: server.id, label: server.name })),
|
||||
[servers],
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
const fetchPluginDetails = async () => {
|
||||
@@ -30,7 +34,7 @@ function PluginDetails() {
|
||||
`${API_BASE_URL}/api/modrinth/project/${pluginId}`,
|
||||
{
|
||||
headers: {
|
||||
'User-Agent': 'AnchorHost/1.0'
|
||||
'User-Agent': 'AnchorHost.eu/1.0'
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -407,51 +411,14 @@ function PluginDetails() {
|
||||
<div className="sticky bottom-4 space-y-3">
|
||||
{/* Server Selection Dropdown */}
|
||||
{servers.length > 0 && (
|
||||
<div className="relative">
|
||||
<button
|
||||
onClick={() => setShowServerDropdown(!showServerDropdown)}
|
||||
className="w-full py-3 rounded-xl border font-medium transition-all hover:scale-105 flex items-center justify-between px-4"
|
||||
style={{
|
||||
backgroundColor: colors.backgroundSecondary,
|
||||
borderColor: colors.brightBlack,
|
||||
color: colors.brightWhite
|
||||
}}
|
||||
>
|
||||
<div className="flex items-center gap-2">
|
||||
<Server className="w-4 h-4" />
|
||||
<span>{selectedServer ? selectedServer.name : 'Select a server to download to'}</span>
|
||||
</div>
|
||||
<ChevronDown className={`w-4 h-4 transition-transform ${showServerDropdown ? 'rotate-180' : ''}`} />
|
||||
</button>
|
||||
|
||||
{showServerDropdown && (
|
||||
<div
|
||||
className="absolute bottom-full mb-2 w-full rounded-xl border overflow-hidden z-10 max-h-60 overflow-y-auto"
|
||||
style={{
|
||||
backgroundColor: colors.backgroundSecondary,
|
||||
borderColor: colors.brightBlack
|
||||
}}
|
||||
>
|
||||
{servers.map((server) => (
|
||||
<button
|
||||
key={server.id}
|
||||
onClick={() => {
|
||||
setSelectedServer(server);
|
||||
setShowServerDropdown(false);
|
||||
}}
|
||||
className="w-full px-4 py-3 text-left hover:bg-opacity-50 transition-all"
|
||||
style={{
|
||||
backgroundColor: selectedServer?.id === server.id ? colors.blue : 'transparent',
|
||||
color: colors.brightWhite
|
||||
}}
|
||||
>
|
||||
<div className="font-medium">{server.name}</div>
|
||||
<div className="text-xs opacity-75">{server.version || 'Unknown version'}</div>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<Dropdown
|
||||
ariaLabel="Download target server"
|
||||
placeholder="Select a server to download to"
|
||||
value={selectedServer?.id || ''}
|
||||
options={serverDropdownOptions}
|
||||
onChange={(serverId) => setSelectedServer(servers.find((server) => server.id === serverId) || null)}
|
||||
icon={Server}
|
||||
/>
|
||||
)}
|
||||
|
||||
{/* Download to Server Button */}
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
import React, { useState, useEffect, useCallback, useRef } from 'react';
|
||||
import React, { useState, useEffect, useCallback } from 'react';
|
||||
import {
|
||||
Search,
|
||||
Filter,
|
||||
Download,
|
||||
ChevronDown,
|
||||
Check,
|
||||
Package,
|
||||
Calendar
|
||||
} from "lucide-react";
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { colors } from '../../theme/colors';
|
||||
import { Dropdown } from '../../components/dashboardPrimitives';
|
||||
|
||||
import { API_BASE_URL } from '../../config/api';
|
||||
|
||||
@@ -88,73 +87,6 @@ const PluginStore = () => {
|
||||
return text.substring(0, maxLength) + '...';
|
||||
};
|
||||
|
||||
// Custom Dropdown Component (same style as ticket management)
|
||||
const Dropdown = ({ value, options, onChange, placeholder, icon: Icon }) => {
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
const ref = useRef(null);
|
||||
|
||||
useEffect(() => {
|
||||
const handleClick = (e) => {
|
||||
if (ref.current && !ref.current.contains(e.target)) setIsOpen(false);
|
||||
};
|
||||
document.addEventListener('mousedown', handleClick);
|
||||
return () => document.removeEventListener('mousedown', handleClick);
|
||||
}, []);
|
||||
|
||||
const selected = options.find(o => o.value === value);
|
||||
|
||||
return (
|
||||
<div ref={ref} className="relative">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setIsOpen(!isOpen)}
|
||||
className="w-full rounded-xl px-4 py-3 flex items-center justify-between transition-all duration-200 border-2"
|
||||
style={{
|
||||
backgroundColor: colors.brightBlack,
|
||||
borderColor: isOpen ? colors.blue : 'transparent',
|
||||
color: colors.brightWhite
|
||||
}}
|
||||
>
|
||||
<div className="flex items-center space-x-2">
|
||||
{Icon && <Icon className="w-4 h-4" style={{ color: colors.foreground }} />}
|
||||
<span className="text-sm">{selected?.label || placeholder}</span>
|
||||
</div>
|
||||
<ChevronDown className={`w-4 h-4 transition-transform duration-200 ${isOpen ? 'rotate-180' : ''}`} />
|
||||
</button>
|
||||
|
||||
{isOpen && (
|
||||
<div className="absolute z-20 w-full mt-2 rounded-xl shadow-xl border overflow-hidden"
|
||||
style={{
|
||||
backgroundColor: colors.black,
|
||||
borderColor: colors.blue
|
||||
}}>
|
||||
<div className="max-h-48 overflow-auto">
|
||||
{options.map((option) => (
|
||||
<button
|
||||
key={option.value}
|
||||
type="button"
|
||||
onClick={() => {
|
||||
onChange(option.value);
|
||||
setIsOpen(false);
|
||||
}}
|
||||
className="w-full text-left px-4 py-3 flex items-center justify-between transition-all duration-150 text-sm hover:opacity-80"
|
||||
style={{
|
||||
color: colors.brightWhite,
|
||||
backgroundColor: value === option.value ? `${colors.blue}20` : 'transparent'
|
||||
}}
|
||||
>
|
||||
<span>{option.label}</span>
|
||||
{value === option.value && (
|
||||
<Check className="w-4 h-4" style={{ color: colors.blue }} />
|
||||
)}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="min-h-app antialiased" style={{ backgroundColor: colors.background }}>
|
||||
|
||||
@@ -34,7 +34,7 @@ const PluginStoreEmbedded = ({ serverId }) => {
|
||||
`${API_BASE_URL}/api/modrinth/project/${pluginId}`,
|
||||
{
|
||||
headers: {
|
||||
'User-Agent': 'AnchorHost/1.0'
|
||||
'User-Agent': 'AnchorHost.eu/1.0'
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user