4
4
* See License.AGPL.txt in the project root for license information.
5
5
*/
6
6
7
- import { OrganizationSettings } from "@gitpod/public-api/lib/gitpod/v1/organization_pb" ;
8
7
import { FormEvent , useCallback , useEffect , useState } from "react" ;
9
8
import { Heading2 , Heading3 , Subheading } from "../components/typography/headings" ;
10
9
import { useIsOwner } from "../data/organizations/members-query" ;
11
10
import { useOrgSettingsQuery } from "../data/organizations/org-settings-query" ;
12
11
import { useCurrentOrg } from "../data/organizations/orgs-query" ;
13
- import { useUpdateOrgSettingsMutation } from "../data/organizations/update-org-settings-mutation" ;
12
+ import {
13
+ UpdateOrganizationSettingsArgs ,
14
+ useUpdateOrgSettingsMutation ,
15
+ } from "../data/organizations/update-org-settings-mutation" ;
14
16
import { OrgSettingsPage } from "./OrgSettingsPage" ;
15
17
import { ConfigurationSettingsField } from "../repositories/detail/ConfigurationSettingsField" ;
16
18
import { useDocumentTitle } from "../hooks/use-document-title" ;
17
19
import { useToast } from "../components/toasts/Toasts" ;
18
- import type { PlainMessage } from "@bufbuild/protobuf" ;
19
20
import { InputField } from "../components/forms/InputField" ;
20
21
import { TextInput } from "../components/forms/TextInputField" ;
21
22
import { LoadingButton } from "@podkit/buttons/LoadingButton" ;
@@ -24,11 +25,16 @@ import { useOrgSuggestedRepos } from "../data/organizations/suggested-repositori
24
25
import { RepositoryListItem } from "../repositories/list/RepoListItem" ;
25
26
import { LoadingState } from "@podkit/loading/LoadingState" ;
26
27
import { Table , TableHeader , TableRow , TableHead , TableBody } from "@podkit/tables/Table" ;
28
+ import { WelcomeMessageConfigurationField } from "./onboarding/WelcomeMessageConfigurationField" ;
29
+
30
+ export type UpdateTeamSettingsOptions = {
31
+ throwMutateError ?: boolean ;
32
+ } ;
27
33
28
34
export default function TeamOnboardingPage ( ) {
29
35
useDocumentTitle ( "Organization Settings - Onboarding" ) ;
30
36
const { toast } = useToast ( ) ;
31
- const org = useCurrentOrg ( ) . data ;
37
+ const { data : org } = useCurrentOrg ( ) ;
32
38
const isOwner = useIsOwner ( ) ;
33
39
34
40
const { data : settings } = useOrgSettingsQuery ( ) ;
@@ -39,7 +45,7 @@ export default function TeamOnboardingPage() {
39
45
const [ internalLink , setInternalLink ] = useState < string | undefined > ( undefined ) ;
40
46
41
47
const handleUpdateTeamSettings = useCallback (
42
- async ( newSettings : Partial < PlainMessage < OrganizationSettings > > , options ?: { throwMutateError ?: boolean } ) => {
48
+ async ( newSettings : UpdateOrganizationSettingsArgs , options ?: UpdateTeamSettingsOptions ) => {
43
49
if ( ! org ?. id ) {
44
50
throw new Error ( "no organization selected" ) ;
45
51
}
@@ -70,11 +76,10 @@ export default function TeamOnboardingPage() {
70
76
await handleUpdateTeamSettings ( {
71
77
onboardingSettings : {
72
78
internalLink,
73
- recommendedRepositories : settings ?. onboardingSettings ?. recommendedRepositories ?? [ ] ,
74
79
} ,
75
80
} ) ;
76
81
} ,
77
- [ handleUpdateTeamSettings , internalLink , settings ?. onboardingSettings ?. recommendedRepositories ] ,
82
+ [ handleUpdateTeamSettings , internalLink ] ,
78
83
) ;
79
84
80
85
useEffect ( ( ) => {
@@ -146,7 +151,7 @@ export default function TeamOnboardingPage() {
146
151
</ TableRow >
147
152
</ TableHeader >
148
153
< TableBody >
149
- { ( suggestedRepos ?? [ ] ) . map ( ( repo ) => (
154
+ { suggestedRepos ? .map ( ( repo ) => (
150
155
< RepositoryListItem
151
156
key = { repo . configurationId }
152
157
configuration = { repo . configuration }
@@ -157,6 +162,8 @@ export default function TeamOnboardingPage() {
157
162
</ Table >
158
163
) }
159
164
</ ConfigurationSettingsField >
165
+
166
+ < WelcomeMessageConfigurationField handleUpdateTeamSettings = { handleUpdateTeamSettings } />
160
167
</ div >
161
168
</ OrgSettingsPage >
162
169
) ;
0 commit comments