chore: standardize security and quality foundations
This commit is contained in:
@@ -1,43 +1,63 @@
|
||||
'use client'
|
||||
"use client";
|
||||
|
||||
import { useEffect, useRef, type ReactNode } from 'react'
|
||||
import { useEffect, useRef, type ReactNode } from "react";
|
||||
|
||||
export default function IssueFlowStep({
|
||||
number, title, summary, active, complete, onEdit, children,
|
||||
number,
|
||||
title,
|
||||
summary,
|
||||
active,
|
||||
complete,
|
||||
onEdit,
|
||||
children,
|
||||
}: {
|
||||
number: number
|
||||
title: string
|
||||
summary: string
|
||||
active: boolean
|
||||
complete: boolean
|
||||
onEdit: () => void
|
||||
children: ReactNode
|
||||
number: number;
|
||||
title: string;
|
||||
summary: string;
|
||||
active: boolean;
|
||||
complete: boolean;
|
||||
onEdit: () => void;
|
||||
children: ReactNode;
|
||||
}) {
|
||||
const heading = useRef<HTMLHeadingElement>(null)
|
||||
const heading = useRef<HTMLHeadingElement>(null);
|
||||
useEffect(() => {
|
||||
if (!active || number === 1) return
|
||||
heading.current?.focus({ preventScroll: true })
|
||||
heading.current?.scrollIntoView({ block: 'nearest', behavior: 'instant' })
|
||||
}, [active, number])
|
||||
if (!active || number === 1) return;
|
||||
heading.current?.focus({ preventScroll: true });
|
||||
heading.current?.scrollIntoView({ block: "nearest", behavior: "instant" });
|
||||
}, [active, number]);
|
||||
|
||||
if (!active && !complete) return null
|
||||
if (!active && !complete) return null;
|
||||
return (
|
||||
<section className={`issue-procedure-step ${active ? 'is-current' : 'is-complete'}`} aria-label={title}>
|
||||
<section className={`issue-procedure-step ${active ? "is-current" : "is-complete"}`} aria-label={title}>
|
||||
{active ? (
|
||||
<>
|
||||
<div className="issue-flow-heading">
|
||||
<span className="issue-step-number" aria-hidden="true">{String(number).padStart(2, '0')}</span>
|
||||
<h2 ref={heading} tabIndex={-1}>{title}</h2>
|
||||
<span className="issue-step-number" aria-hidden="true">
|
||||
{String(number).padStart(2, "0")}
|
||||
</span>
|
||||
<h2 ref={heading} tabIndex={-1}>
|
||||
{title}
|
||||
</h2>
|
||||
</div>
|
||||
<div className="issue-procedure-content">{children}</div>
|
||||
</>
|
||||
) : (
|
||||
<button type="button" className="issue-step-summary" onClick={onEdit} aria-label={`Change ${title}: ${summary}`}>
|
||||
<span className="issue-step-number" aria-hidden="true">✓</span>
|
||||
<span className="issue-step-summary-copy"><small>{title}</small><strong>{summary}</strong></span>
|
||||
<button
|
||||
type="button"
|
||||
className="issue-step-summary"
|
||||
onClick={onEdit}
|
||||
aria-label={`Change ${title}: ${summary}`}
|
||||
>
|
||||
<span className="issue-step-number" aria-hidden="true">
|
||||
✓
|
||||
</span>
|
||||
<span className="issue-step-summary-copy">
|
||||
<small>{title}</small>
|
||||
<strong>{summary}</strong>
|
||||
</span>
|
||||
<span className="issue-step-change">Change</span>
|
||||
</button>
|
||||
)}
|
||||
</section>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
+1928
-1746
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,5 @@
|
||||
import PortalClient from '../PortalClient'
|
||||
import PortalClient from "../PortalClient";
|
||||
|
||||
export default function IssuePortalPage() {
|
||||
return <PortalClient workspace="issue" />
|
||||
return <PortalClient workspace="issue" />;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { redirect } from 'next/navigation'
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
export default function PortalIndexPage() {
|
||||
redirect('/new-requests')
|
||||
redirect("/new-requests");
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { redirect } from 'next/navigation'
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
export default function RequestPortalPage() {
|
||||
redirect('/new-requests')
|
||||
redirect("/new-requests");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user