CI / check (push) Canceled after 0s
CI / tests-unit (push) Canceled after 0s
CI / tests-integration (push) Canceled after 0s
CI / tests-ui (push) Canceled after 0s
CI / preflight (push) Canceled after 0s
CI / deploy (push) Canceled after 0s
Gitea Runner Clean Test / test-job (push) Canceled after 0s
Gitea Actions Runner Test / test-job (push) Canceled after 0s
- P1: new src/lib/admin/rank-guard.ts with tryGuardRank/guardRank + RankGuardTarget/Result; extracted from users.ts; applied to admin-bans (create/lift + rank redirect) and admin-badges (caps + rank guard + error surfacing); import-url-safety.ts SSRF guard wired into clone save+icon fetch; logAudit await in help-tickets; antiddos mutations SETTINGS_EDIT; markAllAlertsRead NOTIFICATIONS_EDIT; rankError/saveError in all 25 message files; tests rew/new for bans/badges/rank-guard/import-url-safety - P2: ticket-inbox merged pagination reworked to single UNION ALL SQL with LIMIT/OFFSET (avoids O(offset) materialization); getCachedAdminCount with cacheFiltered option applied to devops/errors/photos/items/guilds/help-tickets/moderation pages; admin-theme catches→?error=1+banner+25 locales; logger in silent catches (rare-values/writeable-boxes); catalog-items-loader CAST→plain equality; count caching helper extended with opt-in cacheFiltered - P3: removed dead modules is-staff/notice/recent-furni-resync/log-filters plus load-user-sanctions/user-sanction-timeline; removed orphaned CATALOG_PAGE_COLUMNS re-export; removed getFurniIconUrl from studio-furni-icons Build: lint 0, typecheck 0, 3480 tests pass, i18n:check exit 0, colors exit 0. Circular chunk warning (9452/10535/66463) is webpack code-splitting artifact; build succeeds.
34 lines
1.4 KiB
TypeScript
34 lines
1.4 KiB
TypeScript
import type { SyntheticEvent } from "react";
|
|
|
|
import type { FurniItem } from "./studio-types";
|
|
|
|
export function getFurniImageUrl(item: FurniItem) {
|
|
if (item.iconUrl) return item.iconUrl;
|
|
const iconName = item.classname.replace(/\*/g, "_");
|
|
return `/swf/dcr/hof_furni/icons/${encodeURIComponent(iconName)}_icon.png`;
|
|
}
|
|
|
|
export function handleImgError(
|
|
e: SyntheticEvent<HTMLImageElement>,
|
|
item: FurniItem,
|
|
) {
|
|
const img = e.target as HTMLImageElement;
|
|
const iconName = item.classname.replace(/\*/g, "_");
|
|
if (!img.dataset.fallback) {
|
|
img.dataset.fallback = "1";
|
|
img.src = `/swf/dcr/hof_furni/icons/${encodeURIComponent(iconName)}_icon.png`;
|
|
} else if (img.dataset.fallback === "1") {
|
|
img.dataset.fallback = "2";
|
|
img.src =
|
|
'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="56" height="56" viewBox="0 0 24 24" fill="none" stroke="%2399a0aa" stroke-width="1.5"><rect x="3" y="3" width="18" height="18" rx="2.5"/><circle cx="8.5" cy="8.5" r="1.5"/><path d="m21 15-5-5L5 21"/></svg>';
|
|
} else {
|
|
img.src =
|
|
'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="56" height="56" viewBox="0 0 24 24" fill="none" stroke="%2399a0aa" stroke-width="1.5"><rect x="3" y="3" width="18" height="18" rx="2.5"/><circle cx="8.5" cy="8.5" r="1.5"/><path d="m21 15-5-5L5 21"/></svg>';
|
|
}
|
|
}
|
|
|
|
export const TYPE_LABELS: Record<string, string> = {
|
|
flooritem: "Floor",
|
|
wallitem: "Wall",
|
|
};
|