Skip to content

Commit b9645f8

Browse files
committed
Enable org creation with "contact sales" info
Enable the New Org modal and add a note about contacting sales for enabling private projects on the new org. Also add a better empty state to the org page (which is now redirected to after org creation).
1 parent 42c38b4 commit b9645f8

File tree

7 files changed

+53
-41
lines changed

7 files changed

+53
-41
lines changed

elm-git.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"git-dependencies": {
33
"direct": {
4-
"https://github.com/unisonweb/ui-core": "370a0dad78e156e5604b1d34c7acaadbb1016bff"
4+
"https://github.com/unisonweb/ui-core": "2e050b11e00a332b8f7a41db78d1f61169e9898f"
55
},
66
"indirect": {}
77
}

src/UnisonShare/AppHeader.elm

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import Html.Attributes exposing (class, classList)
55
import Lib.HttpApi exposing (HttpApi)
66
import Lib.UserHandle as UserHandle exposing (UserHandle)
77
import Time
8-
import UI
98
import UI.ActionMenu as ActionMenu
109
import UI.AnchoredOverlay as AnchoredOverlay
1110
import UI.AppHeader exposing (AppHeader, AppTitle(..))
@@ -270,14 +269,10 @@ view ctx appHeader_ =
270269
[ avatar, Icon.view chevron ]
271270

272271
newOrgButton =
273-
if account.isSuperAdmin then
274-
Button.iconThenLabel ctx.showNewOrgModal Icon.largePlus "New Org"
275-
|> Button.small
276-
|> Button.positive
277-
|> Button.view
278-
279-
else
280-
UI.nothing
272+
Button.iconThenLabel ctx.showNewOrgModal Icon.largePlus "New Org"
273+
|> Button.small
274+
|> Button.positive
275+
|> Button.view
281276

282277
accountMenu =
283278
ActionMenu.items

src/UnisonShare/Link.elm

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ link url =
3535
Click.externalHref url
3636

3737

38+
salesEmail : Click msg
39+
salesEmail =
40+
Click.externalHref "mailto:hello@unison.cloud"
41+
42+
3843
unisonCloudWebsite : Click msg
3944
unisonCloudWebsite =
4045
Click.externalHref "https://unison.cloud"

src/UnisonShare/NewOrgModal.elm

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module UnisonShare.NewOrgModal exposing (..)
22

3-
import Html exposing (Html, div, form)
3+
import Html exposing (Html, br, div, form, span, strong, text)
44
import Http
55
import Json.Decode as Decode
66
import Lib.HttpApi as HttpApi exposing (HttpResult)
@@ -9,7 +9,6 @@ import Lib.Util as Util
99
import RemoteData exposing (RemoteData(..), WebData)
1010
import String.Normalize as StringN
1111
import UI.Button as Button
12-
import UI.Form.RadioField as RadioField
1312
import UI.Form.TextField as TextField
1413
import UI.Icon as Icon
1514
import UI.Modal as Modal
@@ -18,6 +17,7 @@ import UI.StatusIndicator as StatusIndicator
1817
import UnisonShare.Account exposing (AccountSummary)
1918
import UnisonShare.Api as ShareApi
2019
import UnisonShare.AppContext exposing (AppContext)
20+
import UnisonShare.Link as Link
2121
import UnisonShare.Org as Org exposing (OrgSummary)
2222

2323

@@ -221,7 +221,7 @@ update appContext account msg model =
221221
SaveFinished res ->
222222
case res of
223223
Ok org ->
224-
( { model | save = Success org }, Util.delayMsg 1500 CloseModal, NoOutMsg )
224+
( { model | save = Success org }, Cmd.none, AddedOrg org )
225225

226226
Err e ->
227227
( { model | save = Failure e }, Cmd.none, NoOutMsg )
@@ -327,17 +327,20 @@ handleToString orgHandle =
327327
view : Model -> Html Msg
328328
view model =
329329
let
330-
orgTypeOptions =
331-
RadioField.options2
332-
(RadioField.option "Public Org"
333-
"Only allows public projects."
334-
PublicOrg
335-
)
336-
(RadioField.option "Commercial Org"
337-
"Supports both public and private projects. Selecting this will open a support ticket to enable private projects."
338-
CommercialOrg
339-
)
340-
330+
{-
331+
orgTypeOptions =
332+
RadioField.options2
333+
(RadioField.option "Public Org"
334+
"Only allows public projects."
335+
PublicOrg
336+
)
337+
(RadioField.option "Commercial Org"
338+
"Supports both public and private projects. Selecting this will open a support ticket to enable private projects."
339+
CommercialOrg
340+
)
341+
|> RadioField.field "org-type" UpdateOrgType orgTypeOptions model.orgType |> RadioField.view
342+
orgTypeOptions =
343+
-}
341344
handleField =
342345
TextField.fieldWithoutLabel UpdateHandle "Handle, e.g. @unison" (handleToString model.potentialHandle)
343346
|> TextField.withHelpText "The unique identifier of the organization and used in URLs and project references like @unison/base."
@@ -381,7 +384,11 @@ view model =
381384
|> TextField.withAutofocus
382385
|> TextField.view
383386
, TextField.view handleField_
384-
, RadioField.field "org-type" UpdateOrgType orgTypeOptions model.orgType |> RadioField.view
387+
, StatusBanner.info_
388+
(span
389+
[]
390+
[ strong [] [ text "Organizations by default only allow for public projects." ], br [] [], text "To enable private projects, please reach out to Unison sales (", Link.salesEmail |> Link.view "hello@unison.cloud", text " or on ", Link.discord |> Link.view "Discord", text ") after creating the Organization." ]
391+
)
385392
]
386393
]
387394

src/UnisonShare/Page/OrgProfilePage.elm

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module UnisonShare.Page.OrgProfilePage exposing (..)
22

3-
import Html exposing (Html, div, text)
3+
import Html exposing (Html, div, h2, text)
44
import Html.Attributes exposing (class)
55
import Http
66
import Json.Decode as Decode
@@ -12,15 +12,19 @@ import Set
1212
import UI
1313
import UI.Card as Card
1414
import UI.Divider as Divider
15+
import UI.EmptyState as EmptyState
16+
import UI.EmptyStateCard as EmptyStateCard
17+
import UI.Icon as Icon
1518
import UI.PageContent as PageContent exposing (PageContent)
1619
import UI.PageLayout as PageLayout
1720
import UI.PageTitle as PageTitle
21+
import UI.Placeholder as Placeholder
1822
import UI.ProfileSnippet as ProfileSnippet
1923
import UI.Tag as Tag
2024
import UnisonShare.Api as ShareApi
2125
import UnisonShare.AppContext exposing (AppContext)
2226
import UnisonShare.Link as Link
23-
import UnisonShare.Org exposing (OrgDetails)
27+
import UnisonShare.Org as Org exposing (OrgDetails)
2428
import UnisonShare.PageFooter as PageFooter
2529
import UnisonShare.Project as Project exposing (ProjectSummary)
2630
import UnisonShare.Project.ProjectListing as ProjectListing
@@ -99,11 +103,13 @@ fetchProjects appContext handle =
99103
-- VIEW
100104

101105

102-
viewProjects : List ProjectSummary -> Html msg
103-
viewProjects projects_ =
106+
viewProjects : OrgDetails -> List ProjectSummary -> Html msg
107+
viewProjects org projects_ =
104108
case projects_ of
105109
[] ->
106-
UI.nothing
110+
EmptyState.iconCloud (EmptyState.IconCenterPiece Icon.pencilRuler)
111+
|> EmptyState.withContent [ h2 [] [ text (Org.name org ++ " doesn't have any projects yet.") ] ]
112+
|> EmptyStateCard.view
107113

108114
projects ->
109115
let
@@ -147,7 +153,7 @@ view_ org projects =
147153
let
148154
pageContent =
149155
[ projects
150-
|> RemoteData.map viewProjects
156+
|> RemoteData.map (viewProjects org)
151157
|> RemoteData.withDefault UI.nothing
152158
]
153159

@@ -168,10 +174,9 @@ viewLoadingPage =
168174
let
169175
content =
170176
PageContent.oneColumn
171-
[ div [ class "org-profile-page_page-content" ]
172-
[ div [ class "org-profile_main-content" ]
173-
[ text "" ]
174-
]
177+
[ Card.card (Placeholder.texts5 |> List.map Placeholder.view)
178+
|> Card.asContainedWithFade
179+
|> Card.view
175180
]
176181
in
177182
PageLayout.centeredNarrowLayout content PageFooter.pageFooter

src/css/unison-share/page/org-profile-page.css

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,8 @@
33
flex-direction: column;
44
}
55

6-
.org-profile-page .org-profile_main-content {
7-
display: flex;
8-
flex-direction: column;
9-
gap: 1.5rem;
10-
flex: 1;
11-
flex-grow: 1;
6+
.org-profile-page .avatar.avatar_blank {
7+
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
128
}
139

1410
.org-profile-page .projects {

src/css/unison-share/page/user-profile-page.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@
3333
flex-grow: 1;
3434
}
3535

36+
.user-profile-page .avatar.avatar_blank {
37+
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
38+
}
39+
3640
.user-profile-empty-state_instructions-banner {
3741
display: flex;
3842
flex-direction: column;

0 commit comments

Comments
 (0)