refactor(webui): adopt semantic workspace actions
This commit is contained in:
@@ -4,14 +4,12 @@ import {
|
|||||||
ListPlus,
|
ListPlus,
|
||||||
Pencil,
|
Pencil,
|
||||||
Plus,
|
Plus,
|
||||||
RefreshCw,
|
|
||||||
Search,
|
Search,
|
||||||
ShieldCheck,
|
ShieldCheck,
|
||||||
Vote
|
Vote
|
||||||
} from "lucide-react";
|
} from "lucide-react";
|
||||||
import { useCallback, useEffect, useMemo, useState, type ReactNode } from "react";
|
import { useCallback, useEffect, useMemo, useState, type ReactNode } from "react";
|
||||||
import { ActionToolbar,
|
import { ActionBlockerHint,
|
||||||
ActionBlockerHint,
|
|
||||||
Button,
|
Button,
|
||||||
DocumentationHelpLink,
|
DocumentationHelpLink,
|
||||||
DismissibleAlert,
|
DismissibleAlert,
|
||||||
@@ -24,6 +22,7 @@ import { ActionToolbar,
|
|||||||
hasScope,
|
hasScope,
|
||||||
i18nMessage,
|
i18nMessage,
|
||||||
usePlatformLanguage,
|
usePlatformLanguage,
|
||||||
|
WorkspaceActionBar,
|
||||||
WorkspaceFrame,
|
WorkspaceFrame,
|
||||||
type PlatformRouteContext
|
type PlatformRouteContext
|
||||||
} from "@govoplan/core-webui";
|
} from "@govoplan/core-webui";
|
||||||
@@ -186,16 +185,17 @@ export default function CommitteePage({ settings, auth }: PlatformRouteContext)
|
|||||||
return (
|
return (
|
||||||
<main className="committee-page">
|
<main className="committee-page">
|
||||||
<WorkspaceFrame className="committee-shell" label="Committee workspace" interfaceId="committee.workspace" helpContextId="committee.page.workspace" helpModuleId="committee">
|
<WorkspaceFrame className="committee-shell" label="Committee workspace" interfaceId="committee.workspace" helpContextId="committee.page.workspace" helpModuleId="committee">
|
||||||
<ActionToolbar surface="panel-header" className="committee-toolbar">
|
<WorkspaceActionBar
|
||||||
<FilterBar as="form" surface="control" wrap="never" width="compact" onSubmit={(event) => { event.preventDefault(); void refresh(); }} className="committee-search">
|
scope="workspace"
|
||||||
|
variant="collection"
|
||||||
|
refreshable
|
||||||
|
reloadAction={{ onReload: () => void refresh(), loading }}
|
||||||
|
className="committee-toolbar"
|
||||||
|
contextActions={<FilterBar as="form" surface="control" wrap="never" width="compact" onSubmit={(event) => { event.preventDefault(); void refresh(); }} className="committee-search">
|
||||||
<Search size={16} aria-hidden="true" />
|
<Search size={16} aria-hidden="true" />
|
||||||
<input value={query} onChange={(event) => setQuery(event.target.value)} placeholder="Search bodies" aria-label="Search committee bodies" />
|
<input value={query} onChange={(event) => setQuery(event.target.value)} placeholder="Search bodies" aria-label="Search committee bodies" />
|
||||||
</FilterBar>
|
</FilterBar>}
|
||||||
<Button variant="ghost" onClick={() => void refresh()} disabled={loading} disabledReason={loading ? COMMITTEE_INTERFACE_I18N.loading : undefined}>
|
createAction={<Button
|
||||||
<RefreshCw size={16} aria-hidden="true" />
|
|
||||||
Refresh
|
|
||||||
</Button>
|
|
||||||
<Button
|
|
||||||
variant="primary"
|
variant="primary"
|
||||||
disabled={!canWrite || loading}
|
disabled={!canWrite || loading}
|
||||||
disabledReason={committeeDisabledReason({ loading, permitted: canWrite })}
|
disabledReason={committeeDisabledReason({ loading, permitted: canWrite })}
|
||||||
@@ -203,9 +203,9 @@ export default function CommitteePage({ settings, auth }: PlatformRouteContext)
|
|||||||
>
|
>
|
||||||
<Plus size={16} aria-hidden="true" />
|
<Plus size={16} aria-hidden="true" />
|
||||||
New body
|
New body
|
||||||
</Button>
|
</Button>}
|
||||||
<DocumentationHelpLink reference={COMMITTEE_DOCUMENTATION} />
|
helpAction={<DocumentationHelpLink reference={COMMITTEE_DOCUMENTATION} />}
|
||||||
</ActionToolbar>
|
/>
|
||||||
|
|
||||||
{error ? <DismissibleAlert tone="danger" resetKey={error} className="committee-alert">{error}</DismissibleAlert> : null}
|
{error ? <DismissibleAlert tone="danger" resetKey={error} className="committee-alert">{error}</DismissibleAlert> : null}
|
||||||
{loading && bodies.length === 0 ? <LoadingIndicator label="Loading committee workspace" /> : null}
|
{loading && bodies.length === 0 ? <LoadingIndicator label="Loading committee workspace" /> : null}
|
||||||
|
|||||||
Reference in New Issue
Block a user