@@ -3,14 +3,37 @@ import { ArchiveWorkspace } from "@/features/workspace/components/archive-worksp
3
3
import { SystemPromptEditor } from "@/features/workspace-system-prompt/components/system-prompt-editor" ;
4
4
import { WorkspaceHeading } from "@/features/workspace/components/workspace-heading" ;
5
5
import { WorkspaceName } from "@/features/workspace/components/workspace-name" ;
6
- import { Breadcrumb , Breadcrumbs } from "@stacklok/ui-kit" ;
6
+ import { Alert , Breadcrumb , Breadcrumbs } from "@stacklok/ui-kit" ;
7
7
import { useParams } from "react-router-dom" ;
8
+ import { useArchivedWorkspaces } from "@/features/workspace/hooks/use-archived-workspaces" ;
9
+ import { useRestoreWorkspaceButton } from "@/features/workspace/hooks/use-restore-workspace-button" ;
10
+
11
+ function WorkspaceArchivedBanner ( { name } : { name : string } ) {
12
+ const restoreButtonProps = useRestoreWorkspaceButton ( { workspaceName : name } ) ;
13
+
14
+ return (
15
+ < Alert
16
+ variant = "warning"
17
+ title = "This workspace has been archived"
18
+ className = "mb-8 animate-in fade-in zoom-in-95"
19
+ actionButtonProps = { restoreButtonProps }
20
+ >
21
+ You can still view this workspace's configuration. To begin using it
22
+ again, you must restore it.
23
+ </ Alert >
24
+ ) ;
25
+ }
8
26
9
27
export function RouteWorkspace ( ) {
10
28
const { name } = useParams ( ) ;
11
29
12
30
if ( ! name ) throw Error ( "Workspace name is required" ) ;
13
31
32
+ const { data : isArchived } = useArchivedWorkspaces < boolean > ( {
33
+ select : ( data ) =>
34
+ data ?. workspaces . find ( ( w ) => w . name === name ) !== undefined ,
35
+ } ) ;
36
+
14
37
return (
15
38
< >
16
39
< Breadcrumbs >
@@ -20,9 +43,20 @@ export function RouteWorkspace() {
20
43
</ Breadcrumbs >
21
44
22
45
< WorkspaceHeading title = "Workspace settings" />
23
- < WorkspaceName className = "mb-4" workspaceName = { name } />
24
- < SystemPromptEditor workspaceName = { name } className = "mb-4" />
25
- < ArchiveWorkspace workspaceName = { name } />
46
+
47
+ { isArchived ? < WorkspaceArchivedBanner name = { name } /> : null }
48
+
49
+ < WorkspaceName
50
+ isArchived = { isArchived }
51
+ className = "mb-4"
52
+ workspaceName = { name }
53
+ />
54
+ < SystemPromptEditor
55
+ isArchived = { isArchived }
56
+ workspaceName = { name }
57
+ className = "mb-4"
58
+ />
59
+ < ArchiveWorkspace isArchived = { isArchived } workspaceName = { name } />
26
60
</ >
27
61
) ;
28
62
}
0 commit comments