Refactor global styles and enhance MITM functionality

- Updated global CSS to implement a new brand color palette and improve light/dark theme consistency.
- Enhanced the MitmServerCard component to provide clearer user feedback regarding admin privileges.
- Filtered LLM combos in the CombosPage to ensure only relevant data is displayed.
- Improved APIPageClient layout for better usability and visual consistency.
- Added functionality to save and load DNS tool states in the MITM manager.
- Updated OAuth configuration URLs for Qwen to reflect the new endpoint structure.
- Refined tunnel management logic to improve reliability and user experience.
This commit is contained in:
decolua
2026-05-03 18:00:35 +07:00
parent 1686adc704
commit 6cdf40b44e
40 changed files with 1029 additions and 762 deletions
+24 -20
View File
@@ -42,7 +42,7 @@ function RecentRequests({ requests = [] }) {
<div className="flex-1 flex items-center justify-center text-text-muted text-sm">No requests yet.</div>
) : (
<div className="flex-1 overflow-y-auto">
<table className="w-full min-w-[420px] border-collapse text-xs">
<table className="w-full min-w-[300px] border-collapse text-xs">
<thead className="sticky top-0 bg-bg z-10">
<tr className="border-b border-border">
<th className="py-1.5 text-left font-semibold text-text-muted w-2"></th>
@@ -181,7 +181,7 @@ const PERIODS = [
{ value: "60d", label: "60D" },
];
export default function UsageStats() {
export default function UsageStats({ period: periodProp, setPeriod: setPeriodProp, hidePeriodSelector = false } = {}) {
const router = useRouter();
const searchParams = useSearchParams();
@@ -194,7 +194,9 @@ export default function UsageStats() {
const [tableView, setTableView] = useState("model");
const [viewMode, setViewMode] = useState("costs");
const [providers, setProviders] = useState([]);
const [period, setPeriod] = useState("7d");
const [periodLocal, setPeriodLocal] = useState("7d");
const period = periodProp ?? periodLocal;
const setPeriod = setPeriodProp ?? setPeriodLocal;
// Fetch connected providers once, deduplicate by provider type
// Always include noAuth free providers (e.g. opencode) regardless of connections
@@ -398,24 +400,26 @@ export default function UsageStats() {
return (
<div className="flex min-w-0 flex-col gap-6">
{/* Period selector */}
<div className="flex w-full items-center gap-2 sm:w-auto sm:self-end">
<div className="grid flex-1 grid-cols-4 items-center gap-1 rounded-lg border border-border bg-bg-subtle p-1 sm:flex sm:flex-none">
{PERIODS.map((p) => (
<button
key={p.value}
onClick={() => setPeriod(p.value)}
disabled={fetching}
className={`rounded-md px-3 py-1 text-sm font-medium transition-colors ${period === p.value ? "bg-primary text-white shadow-sm" : "text-text-muted hover:bg-bg-hover hover:text-text"}`}
>
{p.label}
</button>
))}
{/* Period selector (hidden when controlled by parent) */}
{!hidePeriodSelector && (
<div className="flex w-full items-center gap-2 sm:w-auto sm:self-end">
<div className="grid flex-1 grid-cols-4 items-center gap-1 rounded-lg border border-border bg-bg-subtle p-1 sm:flex sm:flex-none">
{PERIODS.map((p) => (
<button
key={p.value}
onClick={() => setPeriod(p.value)}
disabled={fetching}
className={`rounded-md px-3 py-1 text-sm font-medium transition-colors ${period === p.value ? "bg-primary text-white shadow-sm" : "text-text-muted hover:bg-bg-hover hover:text-text"}`}
>
{p.label}
</button>
))}
</div>
{fetching && (
<span className="material-symbols-outlined text-[16px] text-text-muted animate-spin">progress_activity</span>
)}
</div>
{fetching && (
<span className="material-symbols-outlined text-[16px] text-text-muted animate-spin">progress_activity</span>
)}
</div>
)}
{/* Overview cards */}
{loading ? spinner : <OverviewCards stats={stats} />}