Fix Android WebView API access and mobile shell layout

This commit is contained in:
yoyuzh
2026-04-03 14:37:21 +08:00
parent f02ff9342f
commit 56f2a9fe0d
121 changed files with 4751 additions and 700 deletions

View File

@@ -22,6 +22,7 @@ export interface RequestLineChartModel {
type MetricValueKind = 'bytes' | 'count';
const BYTE_UNITS = ['B', 'KB', 'MB', 'GB', 'TB', 'PB'];
const REQUEST_CHART_X_AXIS_HOURS = [0, 6, 12, 18, 23];
export function formatMetricValue(value: number, kind: MetricValueKind): string {
if (kind === 'count') {
@@ -103,6 +104,23 @@ export function buildRequestLineChartModel(timeline: AdminRequestTimelinePoint[]
};
}
export function buildRequestLineChartXAxisPoints(points: RequestLineChartPoint[]): RequestLineChartPoint[] {
if (points.length === 0) {
return [];
}
const firstHour = points[0]?.hour ?? 0;
const lastHour = points.at(-1)?.hour ?? firstHour;
const visibleHours = new Set<number>([firstHour, lastHour]);
for (const hour of REQUEST_CHART_X_AXIS_HOURS) {
if (hour > firstHour && hour < lastHour) {
visibleHours.add(hour);
}
}
return points.filter((point) => visibleHours.has(point.hour));
}
export function getInviteCodePanelState(summary: AdminSummary | null | undefined): InviteCodePanelState {
const inviteCode = summary?.inviteCode?.trim() ?? '';
if (!inviteCode) {