mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-16 10:50:38 +09:00
Smooth agent config save button state
This commit is contained in:
parent
c2c63868e9
commit
4b49efa02e
5 changed files with 80 additions and 17 deletions
24
ui/src/lib/issueDetailBreadcrumb.ts
Normal file
24
ui/src/lib/issueDetailBreadcrumb.ts
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
type IssueDetailBreadcrumb = {
|
||||
label: string;
|
||||
href: string;
|
||||
};
|
||||
|
||||
type IssueDetailLocationState = {
|
||||
issueDetailBreadcrumb?: IssueDetailBreadcrumb;
|
||||
};
|
||||
|
||||
function isIssueDetailBreadcrumb(value: unknown): value is IssueDetailBreadcrumb {
|
||||
if (typeof value !== "object" || value === null) return false;
|
||||
const candidate = value as Partial<IssueDetailBreadcrumb>;
|
||||
return typeof candidate.label === "string" && typeof candidate.href === "string";
|
||||
}
|
||||
|
||||
export function createIssueDetailLocationState(label: string, href: string): IssueDetailLocationState {
|
||||
return { issueDetailBreadcrumb: { label, href } };
|
||||
}
|
||||
|
||||
export function readIssueDetailBreadcrumb(state: unknown): IssueDetailBreadcrumb | null {
|
||||
if (typeof state !== "object" || state === null) return null;
|
||||
const candidate = (state as IssueDetailLocationState).issueDetailBreadcrumb;
|
||||
return isIssueDetailBreadcrumb(candidate) ? candidate : null;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue