More audit cleanup: shared route cache helper, url columns, tab keys
- One CACHE and json() in shape.js for the seven public route files - A url column type: link fields (13 of them) refuse javascript:, data: and any other scheme on save, not only when drawn - The chapter map's logo uses the shared Logo component - Schedule tabs take Home and End as well as the arrows Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
1c94ffb281
commit
d1a6332a45
12 changed files with 66 additions and 75 deletions
|
|
@ -224,11 +224,17 @@ export default function ScheduleBlock({
|
|||
if (days.length === 0) return null
|
||||
const current = days[Math.min(active, days.length - 1)]
|
||||
|
||||
// Arrows move one tab and wrap; Home and End jump to the ends.
|
||||
const onKey = (e: KeyboardEvent<HTMLButtonElement>) => {
|
||||
const step = e.key === 'ArrowRight' ? 1 : e.key === 'ArrowLeft' ? -1 : 0
|
||||
if (!step) return
|
||||
const last = days.length - 1
|
||||
const next =
|
||||
e.key === 'ArrowRight' ? (active + 1) % days.length
|
||||
: e.key === 'ArrowLeft' ? (active + last) % days.length
|
||||
: e.key === 'Home' ? 0
|
||||
: e.key === 'End' ? last
|
||||
: null
|
||||
if (next === null) return
|
||||
e.preventDefault()
|
||||
const next = (active + step + days.length) % days.length
|
||||
setActive(next)
|
||||
document.getElementById(`${baseId}-tab-${next}`)?.focus()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import { useCommunity } from "../../lib/chapters.ts";
|
|||
import { Link } from "react-router-dom";
|
||||
import ArrowLink from "../../components/ArrowLink.tsx";
|
||||
import { mediaUrl } from "../../lib/media.ts";
|
||||
import Logo from "../../components/Logo.tsx";
|
||||
import { initialsFor, orgPath } from "../../lib/organizations.ts";
|
||||
import { AREAS, AREA_NAMES } from "../../data/mapGrid.ts";
|
||||
import { withAlpha, accentText, readableOn } from '../../lib/color.ts'
|
||||
|
|
@ -466,29 +467,23 @@ function RegionBlock({
|
|||
color. Selecting another card swaps the panel's contents.
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
/* Logo, or the organization's initials when there's no file. */
|
||||
/* Logo, or the organization's initials when there's no file or it
|
||||
fails to load. Decorative: the name is right beside it. */
|
||||
function OrgLogo({ org, color, size = "h-14 w-14" }) {
|
||||
const [failed, setFailed] = useState(false);
|
||||
|
||||
if (org.logo && !failed) {
|
||||
return (
|
||||
<img
|
||||
src={mediaUrl(org.logo) ?? undefined}
|
||||
alt={org.name}
|
||||
onError={() => setFailed(true)}
|
||||
className={`${size} object-contain rounded-xl shrink-0`}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div
|
||||
className={`${size} rounded-xl shrink-0 flex items-center justify-center font-extrabold`}
|
||||
style={{ border: `1px solid ${color}`, color }}
|
||||
aria-label={org.name}
|
||||
>
|
||||
{initialsFor(org.name)}
|
||||
</div>
|
||||
<Logo
|
||||
src={mediaUrl(org.logo)}
|
||||
className={`${size} object-contain rounded-xl shrink-0`}
|
||||
fallback={
|
||||
<div
|
||||
className={`${size} rounded-xl shrink-0 flex items-center justify-center font-extrabold`}
|
||||
style={{ border: `1px solid ${color}`, color: accentText(color) }}
|
||||
aria-hidden="true"
|
||||
>
|
||||
{initialsFor(org.name)}
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue