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