@@ -83,11 +83,11 @@ import DomainCheckbox, { domainToPublishName } from "./domain-checkbox";
83
83
import { CopyToClipboard } from "~/builder/shared/copy-to-clipboard" ;
84
84
import { $openProjectSettings } from "~/shared/nano-states/project-settings" ;
85
85
import { RelativeTime } from "~/builder/shared/relative-time" ;
86
- import cmsUpgradeBanner from "../settings-panel/cms-upgrade-banner.svg?url" ;
87
86
import { showAttribute } from "@webstudio-is/react-sdk" ;
88
- import { $styleObjectModel } from "../style-panel/shared/model" ;
89
87
import { toValue , type CssProperty } from "@webstudio-is/css-engine" ;
90
88
import { getComputedStyleDecl } from "~/shared/style-object-model" ;
89
+ import { $styleObjectModel } from "../style-panel/shared/model" ;
90
+ import cmsUpgradeBanner from "../settings-panel/cms-upgrade-banner.svg?url" ;
91
91
92
92
type ChangeProjectDomainProps = {
93
93
project : Project ;
@@ -786,6 +786,108 @@ const buttonLinkClass = css({
786
786
...textVariants . link ,
787
787
} ) . toString ( ) ;
788
788
789
+ const UpgradeBanner = ( ) => {
790
+ const usedProFeatures = useStore ( $usedProFeatures ) ;
791
+ const { canAddDomain, maxDomainsAllowedPerUser } = useCanAddDomain ( ) ;
792
+ const { userPublishCount, maxPublishesAllowedPerUser } =
793
+ useUserPublishCount ( ) ;
794
+
795
+ if ( userPublishCount >= maxPublishesAllowedPerUser ) {
796
+ return (
797
+ < PanelBanner >
798
+ < Text variant = "regularBold" >
799
+ Upgrade to publish more than { maxPublishesAllowedPerUser } times per
800
+ day:
801
+ </ Text >
802
+ < Link
803
+ className = { buttonStyle ( { color : "gradient" } ) }
804
+ color = "contrast"
805
+ underline = "none"
806
+ href = "https://webstudio.is/pricing"
807
+ target = "_blank"
808
+ >
809
+ Upgrade
810
+ </ Link >
811
+ </ PanelBanner >
812
+ ) ;
813
+ }
814
+
815
+ if ( usedProFeatures . size > 0 ) {
816
+ return (
817
+ < PanelBanner >
818
+ < img
819
+ src = { cmsUpgradeBanner }
820
+ alt = "Upgrade for CMS"
821
+ width = { rawTheme . spacing [ 28 ] }
822
+ style = { { aspectRatio : "4.1" } }
823
+ />
824
+ < Text variant = "regularBold" > Following Pro features are used:</ Text >
825
+ < Text as = "ul" color = "destructive" css = { { paddingLeft : "1em" } } >
826
+ { Array . from ( usedProFeatures ) . map (
827
+ ( [ message , { awareness, info } = { } ] , index ) => (
828
+ < li key = { index } >
829
+ < Flex align = "center" gap = "1" >
830
+ { awareness ? (
831
+ < button
832
+ className = { buttonLinkClass }
833
+ type = "button"
834
+ onClick = { ( ) => $awareness . set ( awareness ) }
835
+ >
836
+ { message }
837
+ </ button >
838
+ ) : (
839
+ message
840
+ ) }
841
+ { info && (
842
+ < Tooltip variant = "wrapped" content = { info } >
843
+ < SmallIconButton icon = { < HelpIcon /> } />
844
+ </ Tooltip >
845
+ ) }
846
+ </ Flex >
847
+ </ li >
848
+ )
849
+ ) }
850
+ </ Text >
851
+ < Text > You can delete these features or upgrade.</ Text >
852
+ < Flex align = "center" gap = { 1 } >
853
+ < UpgradeIcon />
854
+ < Link
855
+ color = "inherit"
856
+ target = "_blank"
857
+ href = "https://webstudio.is/pricing"
858
+ >
859
+ Upgrade to Pro
860
+ </ Link >
861
+ </ Flex >
862
+ </ PanelBanner >
863
+ ) ;
864
+ }
865
+ if ( canAddDomain === false ) {
866
+ return (
867
+ < PanelBanner >
868
+ < Text variant = "regularBold" > Free domains limit reached</ Text >
869
+ < Text variant = "regular" >
870
+ You have reached the limit of { maxDomainsAllowedPerUser } custom
871
+ domains on your account.{ " " }
872
+ < Text variant = "regularBold" inline >
873
+ Upgrade to a Pro account
874
+ </ Text > { " " }
875
+ to add unlimited domains and publish to each domain individually.
876
+ </ Text >
877
+ < Link
878
+ className = { buttonStyle ( { color : "gradient" } ) }
879
+ color = "contrast"
880
+ underline = "none"
881
+ href = "https://webstudio.is/pricing"
882
+ target = "_blank"
883
+ >
884
+ Upgrade
885
+ </ Link >
886
+ </ PanelBanner >
887
+ ) ;
888
+ }
889
+ } ;
890
+
789
891
const Content = ( props : {
790
892
projectId : Project [ "id" ] ;
791
893
onExportClick : ( ) => void ;
@@ -801,99 +903,12 @@ const Content = (props: {
801
903
}
802
904
const projectState = "idle" ;
803
905
804
- const { canAddDomain, maxDomainsAllowedPerUser } = useCanAddDomain ( ) ;
805
906
const { userPublishCount, maxPublishesAllowedPerUser } =
806
907
useUserPublishCount ( ) ;
807
908
808
909
return (
809
910
< form >
810
911
< ScrollArea >
811
- { userPublishCount >= maxPublishesAllowedPerUser ? (
812
- < PanelBanner >
813
- < Text variant = "regularBold" >
814
- Upgrade to publish more than { maxPublishesAllowedPerUser } times
815
- per day:
816
- </ Text >
817
- < Link
818
- className = { buttonStyle ( { color : "gradient" } ) }
819
- color = "contrast"
820
- underline = "none"
821
- href = "https://webstudio.is/pricing"
822
- target = "_blank"
823
- >
824
- Upgrade
825
- </ Link >
826
- </ PanelBanner >
827
- ) : usedProFeatures . size > 0 && hasProPlan === false ? (
828
- < PanelBanner >
829
- < img
830
- src = { cmsUpgradeBanner }
831
- alt = "Upgrade for CMS"
832
- width = { rawTheme . spacing [ 28 ] }
833
- style = { { aspectRatio : "4.1" } }
834
- />
835
- < Text variant = "regularBold" >
836
- Upgrade to publish with following features:
837
- </ Text >
838
- < Text as = "ul" >
839
- { Array . from ( usedProFeatures ) . map (
840
- ( [ message , { awareness, info } = { } ] , index ) => (
841
- < li key = { index } >
842
- < Flex align = "center" gap = "1" >
843
- { awareness ? (
844
- < button
845
- className = { buttonLinkClass }
846
- type = "button"
847
- onClick = { ( ) => $awareness . set ( awareness ) }
848
- >
849
- { message }
850
- </ button >
851
- ) : (
852
- message
853
- ) }
854
- { info && (
855
- < Tooltip variant = "wrapped" content = { info } >
856
- < SmallIconButton icon = { < HelpIcon /> } />
857
- </ Tooltip >
858
- ) }
859
- </ Flex >
860
- </ li >
861
- )
862
- ) }
863
- </ Text >
864
- < Flex align = "center" gap = { 1 } >
865
- < UpgradeIcon />
866
- < Link
867
- color = "inherit"
868
- target = "_blank"
869
- href = "https://webstudio.is/pricing"
870
- >
871
- Upgrade to Pro
872
- </ Link >
873
- </ Flex >
874
- </ PanelBanner >
875
- ) : canAddDomain === false ? (
876
- < PanelBanner >
877
- < Text variant = "regularBold" > Free domains limit reached</ Text >
878
- < Text variant = "regular" >
879
- You have reached the limit of { maxDomainsAllowedPerUser } custom
880
- domains on your account.{ " " }
881
- < Text variant = "regularBold" inline >
882
- Upgrade to a Pro account
883
- </ Text > { " " }
884
- to add unlimited domains and publish to each domain individually.
885
- </ Text >
886
- < Link
887
- className = { buttonStyle ( { color : "gradient" } ) }
888
- color = "contrast"
889
- underline = "none"
890
- href = "https://webstudio.is/pricing"
891
- target = "_blank"
892
- >
893
- Upgrade
894
- </ Link >
895
- </ PanelBanner >
896
- ) : null }
897
912
< RadioGroup name = "publishDomain" >
898
913
< ChangeProjectDomain
899
914
refresh = { refreshProject }
@@ -923,6 +938,7 @@ const Content = (props: {
923
938
} }
924
939
onExportClick = { props . onExportClick }
925
940
/>
941
+ { hasProPlan === false && < UpgradeBanner /> }
926
942
< Publish
927
943
project = { project }
928
944
refresh = { refreshProject }
0 commit comments